llvm.org GIT mirror llvm / da612d6
-retain-symbols-file is not what it seems. Update the makefiles and configury to use --version-script. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105271 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
5 changed file(s) with 51 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
343343 NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@
344344
345345 # Flags supported by the linker.
346 # bfd ld / gold -retain-symbols-file file
347 HAVE_LINK_RETAIN_SYMBOLS_FILE = @HAVE_LINK_RETAIN_SYMBOLS_FILE@
346 # bfd ld / gold --version-script=file
347 HAVE_LINK_VERSION_SCRIPT = @HAVE_LINK_VERSION_SCRIPT@
989989 clean-local::
990990 -$(Verb) $(RM) -f $(NativeExportsFile)
991991 else
992 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
993 # Gold and BFD ld require a version script rather than a plain list.
994 NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
995 $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
996 $(Verb) echo "{" > $@
997 $(Verb) grep -q "\<" $< && echo " global:" >> $@ || :
998 $(Verb) sed -e 's/\>/;/' -e 's/^\> $@
999 $(Verb) echo " local: *;" >> $@
1000 $(Verb) echo "};" >> $@
1001 clean-local::
1002 -$(Verb) $(RM) -f $(NativeExportsFile)
1003 else
9921004 NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
1005 endif
9931006 endif
9941007
9951008 # Now add the linker command-line options to use the native export file.
9991012 endif
10001013
10011014 # gold, bfd ld, etc.
1002 ifeq ($(HAVE_LINK_RETAIN_SYMBOLS_FILE),1)
1003 LLVMLibsOptions += -Wl,-retain-symbols-file,$(NativeExportsFile)
1015 ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
1016 LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
10041017 endif
10051018
10061019 endif
10381038 dnl Determine whether the linker supports the -export-dynamic option.
10391039 AC_LINK_EXPORT_DYNAMIC
10401040
1041 dnl Determine whether the linker supports the -retain-symbols-file option.
1042 AC_LINK_RETAIN_SYMBOLS_FILE
1041 dnl Determine whether the linker supports the --version-script option.
1042 AC_LINK_VERSION_SCRIPT
10431043
10441044 dnl Check for libtool and the library that has dlopen function (which must come
10451045 dnl before the AC_PROG_LIBTOOL check in order to enable dlopening libraries with
3939 ])
4040
4141 #
42 # Determine if the system can handle the -retain-symbols-file option being
42 # Determine if the system can handle the --version-script option being
4343 # passed to the linker.
4444 #
4545 # This macro is specific to LLVM.
4646 #
47 AC_DEFUN([AC_LINK_RETAIN_SYMBOLS_FILE],
48 [AC_CACHE_CHECK([for compiler -Wl,-retain-symbols-file option],
49 [llvm_cv_link_use_retain_symbols_file],
47 AC_DEFUN([AC_LINK_VERSION_SCRIPT],
48 [AC_CACHE_CHECK([for compiler -Wl,--version-script option],
49 [llvm_cv_link_use_version_script],
5050 [ AC_LANG_PUSH([C])
5151 oldcflags="$CFLAGS"
5252
6666 (umask 077 && mkdir "$tmp")
6767 } || exit $?
6868
69 echo "main" > "$tmp/exports"
69 echo "{" > "$tmp/export.map"
70 echo " global: main;" >> "$tmp/export.map"
71 echo " local: *;" >> "$tmp/export.map"
72 echo "};" >> "$tmp/export.map"
7073
71 CFLAGS="$CFLAGS -Wl,-retain-symbols-file=$tmp/exports"
74 CFLAGS="$CFLAGS -Wl,--version-script=$tmp/export.map"
7275 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
73 [llvm_cv_link_use_retain_symbols_file=yes],[llvm_cv_link_use_retain_symbols_file=no])
74 rm "$tmp/exports"
76 [llvm_cv_link_use_version_script=yes],[llvm_cv_link_version_script=no])
77 rm "$tmp/export.map"
7578 rmdir "$tmp"
7679 CFLAGS="$oldcflags"
7780 AC_LANG_POP([C])
7881 ])
79 if test "$llvm_cv_link_use_retain_symbols_file" = yes ; then
80 AC_SUBST(HAVE_LINK_RETAIN_SYMBOLS_FILE,1)
82 if test "$llvm_cv_link_use_version_script" = yes ; then
83 AC_SUBST(HAVE_LINK_VERSION_SCRIPT,1)
8184 fi
8285 ])
8386
751751 OCAMLDEP
752752 OCAMLDOC
753753 GAS
754 HAVE_LINK_RETAIN_SYMBOLS_FILE
754 HAVE_LINK_VERSION_SCRIPT
755755 INSTALL_LTDL_TRUE
756756 INSTALL_LTDL_FALSE
757757 CONVENIENCE_LTDL_TRUE
89048904 fi
89058905
89068906
8907 { echo "$as_me:$LINENO: checking for compiler -Wl,-retain-symbols-file option" >&5
8908 echo $ECHO_N "checking for compiler -Wl,-retain-symbols-file option... $ECHO_C" >&6; }
8909 if test "${llvm_cv_link_use_retain_symbols_file+set}" = set; then
8907 { echo "$as_me:$LINENO: checking for compiler -Wl,--version-script option" >&5
8908 echo $ECHO_N "checking for compiler -Wl,--version-script option... $ECHO_C" >&6; }
8909 if test "${llvm_cv_link_use_version_script+set}" = set; then
89108910 echo $ECHO_N "(cached) $ECHO_C" >&6
89118911 else
89128912 ac_ext=c
89338933 (umask 077 && mkdir "$tmp")
89348934 } || exit $?
89358935
8936 echo "main" > "$tmp/exports"
8937
8938 CFLAGS="$CFLAGS -Wl,-retain-symbols-file=$tmp/exports"
8936 echo "{" > "$tmp/export.map"
8937 echo " global: main;" >> "$tmp/export.map"
8938 echo " local: *;" >> "$tmp/export.map"
8939 echo "};" >> "$tmp/export.map"
8940
8941 CFLAGS="$CFLAGS -Wl,--version-script=$tmp/export.map"
89398942 cat >conftest.$ac_ext <<_ACEOF
89408943 /* confdefs.h. */
89418944 _ACEOF
89858988 ac_status=$?
89868989 echo "$as_me:$LINENO: \$? = $ac_status" >&5
89878990 (exit $ac_status); }; }; then
8988 llvm_cv_link_use_retain_symbols_file=yes
8991 llvm_cv_link_use_version_script=yes
89898992 else
89908993 echo "$as_me: failed program was:" >&5
89918994 sed 's/^/| /' conftest.$ac_ext >&5
89928995
8993 llvm_cv_link_use_retain_symbols_file=no
8996 llvm_cv_link_version_script=no
89948997 fi
89958998
89968999 rm -f core conftest.err conftest.$ac_objext \
89979000 conftest$ac_exeext conftest.$ac_ext
8998 rm "$tmp/exports"
9001 rm "$tmp/export.map"
89999002 rmdir "$tmp"
90009003 CFLAGS="$oldcflags"
90019004 ac_ext=c
90069009
90079010
90089011 fi
9009 { echo "$as_me:$LINENO: result: $llvm_cv_link_use_retain_symbols_file" >&5
9010 echo "${ECHO_T}$llvm_cv_link_use_retain_symbols_file" >&6; }
9011 if test "$llvm_cv_link_use_retain_symbols_file" = yes ; then
9012 HAVE_LINK_RETAIN_SYMBOLS_FILE=1
9012 { echo "$as_me:$LINENO: result: $llvm_cv_link_use_version_script" >&5
9013 echo "${ECHO_T}$llvm_cv_link_use_version_script" >&6; }
9014 if test "$llvm_cv_link_use_version_script" = yes ; then
9015 HAVE_LINK_VERSION_SCRIPT=1
90139016
90149017 fi
90159018
1138311386 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1138411387 lt_status=$lt_dlunknown
1138511388 cat > conftest.$ac_ext <
11386 #line 11387 "configure"
11389 #line 11390 "configure"
1138711390 #include "confdefs.h"
1138811391
1138911392 #if HAVE_DLFCN_H
2129621299 OCAMLDEP!$OCAMLDEP$ac_delim
2129721300 OCAMLDOC!$OCAMLDOC$ac_delim
2129821301 GAS!$GAS$ac_delim
21299 HAVE_LINK_RETAIN_SYMBOLS_FILE!$HAVE_LINK_RETAIN_SYMBOLS_FILE$ac_delim
21302 HAVE_LINK_VERSION_SCRIPT!$HAVE_LINK_VERSION_SCRIPT$ac_delim
2130021303 INSTALL_LTDL_TRUE!$INSTALL_LTDL_TRUE$ac_delim
2130121304 INSTALL_LTDL_FALSE!$INSTALL_LTDL_FALSE$ac_delim
2130221305 CONVENIENCE_LTDL_TRUE!$CONVENIENCE_LTDL_TRUE$ac_delim