mirror of
https://github.com/reactos/CMake.git
synced 2024-12-02 08:37:09 +00:00
9ef3f8e820
The commit "Drop -rdynamic from Linux build rules" removed default use of the flag on Linux. It was expected to be compatible because any project using plugins should set ENABLE_EXPORTS on its executables to export their symbols for use by the plugins in a cross-platform way. However, it is possible to build without ENABLE_EXPORTS and load plugins that do not link to any symbols from the executable explicitly. These plugins may need to see RTTI and other executable symbols needed by the language implementation. Executables using such plugins were broken by the change. If we want to remove the -rdynamic flag in the future we should do so in a compatible way. At that time we should also remove equivalent flags on other platforms (like -bexpall on AIX). We will either need a policy or an explicit API to disable symbol exports on executables. The primary purpose of the above-mentioned commit was to avoid passing the -rdynamic flag to compilers on Linux that do not support it. In this commit we restore the flag but only on GNU and Intel compilers which are known to support it. See issue #9985.
26 lines
972 B
CMake
26 lines
972 B
CMake
|
|
#=============================================================================
|
|
# Copyright 2010 Kitware, Inc.
|
|
#
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
# see accompanying file Copyright.txt for details.
|
|
#
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
# See the License for more information.
|
|
#=============================================================================
|
|
# (To distributed this file outside of CMake, substitute the full
|
|
# License text for the above reference.)
|
|
|
|
# This module is shared by multiple languages; use include blocker.
|
|
if(__LINUX_COMPILER_GNU)
|
|
return()
|
|
endif()
|
|
set(__LINUX_COMPILER_GNU 1)
|
|
|
|
macro(__linux_compiler_gnu lang)
|
|
# We pass this for historical reasons. Projects may have
|
|
# executables that use dlopen but do not set ENABLE_EXPORTS.
|
|
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-rdynamic")
|
|
endmacro()
|