diff options
author | Bob Wilson <bob.wilson@apple.com> | 2013-08-02 22:51:06 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2013-08-02 22:51:06 +0000 |
commit | 244acf3a4b172657924d21bbb3a65f6388cb68bd (patch) | |
tree | 763ca3cb635a2db45d48d080f339e7a31e8576b6 | |
parent | 40bacacad3dac9eb5202193f685719d0f37d7f4a (diff) | |
download | external_llvm-244acf3a4b172657924d21bbb3a65f6388cb68bd.zip external_llvm-244acf3a4b172657924d21bbb3a65f6388cb68bd.tar.gz external_llvm-244acf3a4b172657924d21bbb3a65f6388cb68bd.tar.bz2 |
Link with -rdynamic instead of -Wl,-export-dynamic.
Recent versions of the OS X linker support this but follow the existing
OS X linker convention of using an underscore in the option name, i.e.,
-export_dynamic. Rather than changing our configure scripts to check for
that alternate spelling, it is simpler to just use the compiler's -rdynamic
option and let it deal with translating that to the appropriate linker
option. One potential disadvantage of this approach is that the compiler
will typically ignore -rdynamic on platforms where it is not supported, so
the HAVE_LINK_EXPORT_DYNAMIC in config.h will not necessarily show whether
that option has any effect or not. I don't see any in-tree uses of that
macro, so I'm assuming it is OK.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187686 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | autoconf/configure.ac | 4 | ||||
-rw-r--r-- | autoconf/m4/link_options.m4 | 9 | ||||
-rw-r--r-- | include/llvm/Config/config.h.cmake | 2 | ||||
-rw-r--r-- | include/llvm/Config/config.h.in | 2 | ||||
-rw-r--r-- | projects/sample/autoconf/configure.ac | 4 | ||||
-rw-r--r-- | projects/sample/autoconf/m4/link_options.m4 | 9 |
6 files changed, 16 insertions, 14 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 97a1429..5be25af 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1239,7 +1239,7 @@ AC_LINK_GET_VERSION dnl Determine whether the linker supports the -R option. AC_LINK_USE_R -dnl Determine whether the linker supports the -export-dynamic option. +dnl Determine whether the compiler supports the -rdynamic option. AC_LINK_EXPORT_DYNAMIC dnl Determine whether the linker supports the --version-script option. @@ -1863,7 +1863,7 @@ AC_SUBST(RPATH) dnl Determine linker rdynamic flag if test "$llvm_cv_link_use_export_dynamic" = "yes" ; then - RDYNAMIC="-Wl,-export-dynamic" + RDYNAMIC="-rdynamic" else RDYNAMIC="" fi diff --git a/autoconf/m4/link_options.m4 b/autoconf/m4/link_options.m4 index 57da4a0..b58d617 100644 --- a/autoconf/m4/link_options.m4 +++ b/autoconf/m4/link_options.m4 @@ -40,23 +40,24 @@ if test "$llvm_cv_link_use_r" = yes ; then ]) # -# Determine if the system can handle the -R option being passed to the linker. +# Determine if the system can handle the -rdynamic option being passed +# to the compiler. # # This macro is specific to LLVM. # AC_DEFUN([AC_LINK_EXPORT_DYNAMIC], -[AC_CACHE_CHECK([for compiler -Wl,-export-dynamic option], +[AC_CACHE_CHECK([for compiler -rdynamic option], [llvm_cv_link_use_export_dynamic], [ AC_LANG_PUSH([C]) oldcflags="$CFLAGS" - CFLAGS="$CFLAGS -Wl,-export-dynamic" + CFLAGS="$CFLAGS -rdynamic" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no]) CFLAGS="$oldcflags" AC_LANG_POP([C]) ]) if test "$llvm_cv_link_use_export_dynamic" = yes ; then - AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -Wl,-export-dynamic.]) + AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -rdynamic.]) fi ]) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index 98f7417..9703593 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -209,7 +209,7 @@ /* Define to 1 if you have the <limits.h> header file. */ #cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H} -/* Define if you can use -Wl,-export-dynamic. */ +/* Define if you can use -rdynamic. */ #define HAVE_LINK_EXPORT_DYNAMIC 1 /* Define if you can use -Wl,-R. to pass -R. to the linker, in order to add diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 2c4d09c..74b7829 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -220,7 +220,7 @@ /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ -/* Define if you can use -Wl,-export-dynamic. */ +/* Define if you can use -rdynamic. */ #undef HAVE_LINK_EXPORT_DYNAMIC /* Define to 1 if you have the <link.h> header file. */ diff --git a/projects/sample/autoconf/configure.ac b/projects/sample/autoconf/configure.ac index 5c8dbb3..dc0acf3 100644 --- a/projects/sample/autoconf/configure.ac +++ b/projects/sample/autoconf/configure.ac @@ -985,7 +985,7 @@ AC_LINK_GET_VERSION dnl Determine whether the linker supports the -R option. AC_LINK_USE_R -dnl Determine whether the linker supports the -export-dynamic option. +dnl Determine whether the compiler supports the -rdynamic option. AC_LINK_EXPORT_DYNAMIC dnl Determine whether the linker supports the --version-script option. @@ -1464,7 +1464,7 @@ AC_SUBST(RPATH) dnl Determine linker rdynamic flag if test "$llvm_cv_link_use_export_dynamic" = "yes" ; then - RDYNAMIC="-Wl,-export-dynamic" + RDYNAMIC="-rdynamic" else RDYNAMIC="" fi diff --git a/projects/sample/autoconf/m4/link_options.m4 b/projects/sample/autoconf/m4/link_options.m4 index 57da4a0..b58d617 100644 --- a/projects/sample/autoconf/m4/link_options.m4 +++ b/projects/sample/autoconf/m4/link_options.m4 @@ -40,23 +40,24 @@ if test "$llvm_cv_link_use_r" = yes ; then ]) # -# Determine if the system can handle the -R option being passed to the linker. +# Determine if the system can handle the -rdynamic option being passed +# to the compiler. # # This macro is specific to LLVM. # AC_DEFUN([AC_LINK_EXPORT_DYNAMIC], -[AC_CACHE_CHECK([for compiler -Wl,-export-dynamic option], +[AC_CACHE_CHECK([for compiler -rdynamic option], [llvm_cv_link_use_export_dynamic], [ AC_LANG_PUSH([C]) oldcflags="$CFLAGS" - CFLAGS="$CFLAGS -Wl,-export-dynamic" + CFLAGS="$CFLAGS -rdynamic" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no]) CFLAGS="$oldcflags" AC_LANG_POP([C]) ]) if test "$llvm_cv_link_use_export_dynamic" = yes ; then - AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -Wl,-export-dynamic.]) + AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -rdynamic.]) fi ]) |