llvm.org GIT mirror llvm / 244acf3
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 Bob Wilson 6 years ago
6 changed file(s) with 16 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
12381238 dnl Determine whether the linker supports the -R option.
12391239 AC_LINK_USE_R
12401240
1241 dnl Determine whether the linker supports the -export-dynamic option.
1241 dnl Determine whether the compiler supports the -rdynamic option.
12421242 AC_LINK_EXPORT_DYNAMIC
12431243
12441244 dnl Determine whether the linker supports the --version-script option.
18621862
18631863 dnl Determine linker rdynamic flag
18641864 if test "$llvm_cv_link_use_export_dynamic" = "yes" ; then
1865 RDYNAMIC="-Wl,-export-dynamic"
1865 RDYNAMIC="-rdynamic"
18661866 else
18671867 RDYNAMIC=""
18681868 fi
3939 ])
4040
4141 #
42 # Determine if the system can handle the -R option being passed to the linker.
42 # Determine if the system can handle the -rdynamic option being passed
43 # to the compiler.
4344 #
4445 # This macro is specific to LLVM.
4546 #
4647 AC_DEFUN([AC_LINK_EXPORT_DYNAMIC],
47 [AC_CACHE_CHECK([for compiler -Wl,-export-dynamic option],
48 [AC_CACHE_CHECK([for compiler -rdynamic option],
4849 [llvm_cv_link_use_export_dynamic],
4950 [ AC_LANG_PUSH([C])
5051 oldcflags="$CFLAGS"
51 CFLAGS="$CFLAGS -Wl,-export-dynamic"
52 CFLAGS="$CFLAGS -rdynamic"
5253 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
5354 [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no])
5455 CFLAGS="$oldcflags"
5556 AC_LANG_POP([C])
5657 ])
5758 if test "$llvm_cv_link_use_export_dynamic" = yes ; then
58 AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -Wl,-export-dynamic.])
59 AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -rdynamic.])
5960 fi
6061 ])
6162
208208 /* Define to 1 if you have the header file. */
209209 #cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H}
210210
211 /* Define if you can use -Wl,-export-dynamic. */
211 /* Define if you can use -rdynamic. */
212212 #define HAVE_LINK_EXPORT_DYNAMIC 1
213213
214214 /* Define if you can use -Wl,-R. to pass -R. to the linker, in order to add
219219 /* Define to 1 if you have the `z' library (-lz). */
220220 #undef HAVE_LIBZ
221221
222 /* Define if you can use -Wl,-export-dynamic. */
222 /* Define if you can use -rdynamic. */
223223 #undef HAVE_LINK_EXPORT_DYNAMIC
224224
225225 /* Define to 1 if you have the header file. */
984984 dnl Determine whether the linker supports the -R option.
985985 AC_LINK_USE_R
986986
987 dnl Determine whether the linker supports the -export-dynamic option.
987 dnl Determine whether the compiler supports the -rdynamic option.
988988 AC_LINK_EXPORT_DYNAMIC
989989
990990 dnl Determine whether the linker supports the --version-script option.
14631463
14641464 dnl Determine linker rdynamic flag
14651465 if test "$llvm_cv_link_use_export_dynamic" = "yes" ; then
1466 RDYNAMIC="-Wl,-export-dynamic"
1466 RDYNAMIC="-rdynamic"
14671467 else
14681468 RDYNAMIC=""
14691469 fi
3939 ])
4040
4141 #
42 # Determine if the system can handle the -R option being passed to the linker.
42 # Determine if the system can handle the -rdynamic option being passed
43 # to the compiler.
4344 #
4445 # This macro is specific to LLVM.
4546 #
4647 AC_DEFUN([AC_LINK_EXPORT_DYNAMIC],
47 [AC_CACHE_CHECK([for compiler -Wl,-export-dynamic option],
48 [AC_CACHE_CHECK([for compiler -rdynamic option],
4849 [llvm_cv_link_use_export_dynamic],
4950 [ AC_LANG_PUSH([C])
5051 oldcflags="$CFLAGS"
51 CFLAGS="$CFLAGS -Wl,-export-dynamic"
52 CFLAGS="$CFLAGS -rdynamic"
5253 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
5354 [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no])
5455 CFLAGS="$oldcflags"
5556 AC_LANG_POP([C])
5657 ])
5758 if test "$llvm_cv_link_use_export_dynamic" = yes ; then
58 AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -Wl,-export-dynamic.])
59 AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -rdynamic.])
5960 fi
6061 ])
6162