[llvm] r187686 - Link with -rdynamic instead of -Wl,-export-dynamic.

Bob Wilson bob.wilson at apple.com
Fri Aug 2 15:51:07 PDT 2013


Author: bwilson
Date: Fri Aug  2 17:51:06 2013
New Revision: 187686

URL: http://llvm.org/viewvc/llvm-project?rev=187686&view=rev
Log:
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.

Modified:
    llvm/trunk/autoconf/configure.ac
    llvm/trunk/autoconf/m4/link_options.m4
    llvm/trunk/include/llvm/Config/config.h.cmake
    llvm/trunk/include/llvm/Config/config.h.in
    llvm/trunk/projects/sample/autoconf/configure.ac
    llvm/trunk/projects/sample/autoconf/m4/link_options.m4

Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=187686&r1=187685&r2=187686&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Fri Aug  2 17:51:06 2013
@@ -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

Modified: llvm/trunk/autoconf/m4/link_options.m4
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/m4/link_options.m4?rev=187686&r1=187685&r2=187686&view=diff
==============================================================================
--- llvm/trunk/autoconf/m4/link_options.m4 (original)
+++ llvm/trunk/autoconf/m4/link_options.m4 Fri Aug  2 17:51:06 2013
@@ -40,23 +40,24 @@ if test "$llvm_cv_link_use_r" = yes ; th
 ])
 
 #
-# 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
 ])
 

Modified: llvm/trunk/include/llvm/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=187686&r1=187685&r2=187686&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/config.h.cmake Fri Aug  2 17:51:06 2013
@@ -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

Modified: llvm/trunk/include/llvm/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=187686&r1=187685&r2=187686&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.in (original)
+++ llvm/trunk/include/llvm/Config/config.h.in Fri Aug  2 17:51:06 2013
@@ -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. */

Modified: llvm/trunk/projects/sample/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/sample/autoconf/configure.ac?rev=187686&r1=187685&r2=187686&view=diff
==============================================================================
--- llvm/trunk/projects/sample/autoconf/configure.ac (original)
+++ llvm/trunk/projects/sample/autoconf/configure.ac Fri Aug  2 17:51:06 2013
@@ -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

Modified: llvm/trunk/projects/sample/autoconf/m4/link_options.m4
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/sample/autoconf/m4/link_options.m4?rev=187686&r1=187685&r2=187686&view=diff
==============================================================================
--- llvm/trunk/projects/sample/autoconf/m4/link_options.m4 (original)
+++ llvm/trunk/projects/sample/autoconf/m4/link_options.m4 Fri Aug  2 17:51:06 2013
@@ -40,23 +40,24 @@ if test "$llvm_cv_link_use_r" = yes ; th
 ])
 
 #
-# 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
 ])
 





More information about the llvm-commits mailing list