summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-06-01 14:56:56 +0000
committerDan Gohman <gohman@apple.com>2010-06-01 14:56:56 +0000
commitda612d62260220618af9be428aa827d5d04f344f (patch)
tree4824c9b5e9ce4c09d4a1418128dfbd519c067360
parentc6e1f67b17b4cb9d707af1245c1ecf00f91f23c0 (diff)
downloadllvm-da612d62260220618af9be428aa827d5d04f344f.tar.gz
llvm-da612d62260220618af9be428aa827d5d04f344f.tar.bz2
llvm-da612d62260220618af9be428aa827d5d04f344f.tar.xz
-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
-rw-r--r--Makefile.config.in4
-rw-r--r--Makefile.rules17
-rw-r--r--autoconf/configure.ac4
-rw-r--r--autoconf/m4/link_options.m423
-rwxr-xr-xconfigure33
5 files changed, 50 insertions, 31 deletions
diff --git a/Makefile.config.in b/Makefile.config.in
index ec11bb3a52..6c0e5e9898 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -344,5 +344,5 @@ NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@
NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@
# Flags supported by the linker.
-# bfd ld / gold -retain-symbols-file file
-HAVE_LINK_RETAIN_SYMBOLS_FILE = @HAVE_LINK_RETAIN_SYMBOLS_FILE@
+# bfd ld / gold --version-script=file
+HAVE_LINK_VERSION_SCRIPT = @HAVE_LINK_VERSION_SCRIPT@
diff --git a/Makefile.rules b/Makefile.rules
index 408588132f..942cb9d4d7 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -990,8 +990,21 @@ $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
clean-local::
-$(Verb) $(RM) -f $(NativeExportsFile)
else
+ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
+# Gold and BFD ld require a version script rather than a plain list.
+NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
+$(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
+ $(Verb) echo "{" > $@
+ $(Verb) grep -q "\<" $< && echo " global:" >> $@ || :
+ $(Verb) sed -e 's/\>/;/' -e 's/^\</ /' < $< >> $@
+ $(Verb) echo " local: *;" >> $@
+ $(Verb) echo "};" >> $@
+clean-local::
+ -$(Verb) $(RM) -f $(NativeExportsFile)
+else
NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
endif
+endif
# Now add the linker command-line options to use the native export file.
@@ -1000,8 +1013,8 @@ LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
endif
# gold, bfd ld, etc.
-ifeq ($(HAVE_LINK_RETAIN_SYMBOLS_FILE),1)
-LLVMLibsOptions += -Wl,-retain-symbols-file,$(NativeExportsFile)
+ifeq ($(HAVE_LINK_VERSION_SCRIPT),1)
+LLVMLibsOptions += -Wl,--version-script,$(NativeExportsFile)
endif
endif
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 8487d9403c..66f5383091 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -1039,8 +1039,8 @@ AC_LINK_USE_R
dnl Determine whether the linker supports the -export-dynamic option.
AC_LINK_EXPORT_DYNAMIC
-dnl Determine whether the linker supports the -retain-symbols-file option.
-AC_LINK_RETAIN_SYMBOLS_FILE
+dnl Determine whether the linker supports the --version-script option.
+AC_LINK_VERSION_SCRIPT
dnl Check for libtool and the library that has dlopen function (which must come
dnl before the AC_PROG_LIBTOOL check in order to enable dlopening libraries with
diff --git a/autoconf/m4/link_options.m4 b/autoconf/m4/link_options.m4
index 697abab07d..251c8a4f50 100644
--- a/autoconf/m4/link_options.m4
+++ b/autoconf/m4/link_options.m4
@@ -40,14 +40,14 @@ if test "$llvm_cv_link_use_export_dynamic" = yes ; then
])
#
-# Determine if the system can handle the -retain-symbols-file option being
+# Determine if the system can handle the --version-script option being
# passed to the linker.
#
# This macro is specific to LLVM.
#
-AC_DEFUN([AC_LINK_RETAIN_SYMBOLS_FILE],
-[AC_CACHE_CHECK([for compiler -Wl,-retain-symbols-file option],
- [llvm_cv_link_use_retain_symbols_file],
+AC_DEFUN([AC_LINK_VERSION_SCRIPT],
+[AC_CACHE_CHECK([for compiler -Wl,--version-script option],
+ [llvm_cv_link_use_version_script],
[ AC_LANG_PUSH([C])
oldcflags="$CFLAGS"
@@ -67,18 +67,21 @@ AC_DEFUN([AC_LINK_RETAIN_SYMBOLS_FILE],
(umask 077 && mkdir "$tmp")
} || exit $?
- echo "main" > "$tmp/exports"
+ echo "{" > "$tmp/export.map"
+ echo " global: main;" >> "$tmp/export.map"
+ echo " local: *;" >> "$tmp/export.map"
+ echo "};" >> "$tmp/export.map"
- CFLAGS="$CFLAGS -Wl,-retain-symbols-file=$tmp/exports"
+ CFLAGS="$CFLAGS -Wl,--version-script=$tmp/export.map"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
- [llvm_cv_link_use_retain_symbols_file=yes],[llvm_cv_link_use_retain_symbols_file=no])
- rm "$tmp/exports"
+ [llvm_cv_link_use_version_script=yes],[llvm_cv_link_version_script=no])
+ rm "$tmp/export.map"
rmdir "$tmp"
CFLAGS="$oldcflags"
AC_LANG_POP([C])
])
-if test "$llvm_cv_link_use_retain_symbols_file" = yes ; then
- AC_SUBST(HAVE_LINK_RETAIN_SYMBOLS_FILE,1)
+if test "$llvm_cv_link_use_version_script" = yes ; then
+ AC_SUBST(HAVE_LINK_VERSION_SCRIPT,1)
fi
])
diff --git a/configure b/configure
index 755746ff50..668e579afc 100755
--- a/configure
+++ b/configure
@@ -752,7 +752,7 @@ OCAMLOPT
OCAMLDEP
OCAMLDOC
GAS
-HAVE_LINK_RETAIN_SYMBOLS_FILE
+HAVE_LINK_VERSION_SCRIPT
INSTALL_LTDL_TRUE
INSTALL_LTDL_FALSE
CONVENIENCE_LTDL_TRUE
@@ -8905,9 +8905,9 @@ _ACEOF
fi
-{ echo "$as_me:$LINENO: checking for compiler -Wl,-retain-symbols-file option" >&5
-echo $ECHO_N "checking for compiler -Wl,-retain-symbols-file option... $ECHO_C" >&6; }
-if test "${llvm_cv_link_use_retain_symbols_file+set}" = set; then
+{ echo "$as_me:$LINENO: checking for compiler -Wl,--version-script option" >&5
+echo $ECHO_N "checking for compiler -Wl,--version-script option... $ECHO_C" >&6; }
+if test "${llvm_cv_link_use_version_script+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_ext=c
@@ -8934,9 +8934,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
(umask 077 && mkdir "$tmp")
} || exit $?
- echo "main" > "$tmp/exports"
+ echo "{" > "$tmp/export.map"
+ echo " global: main;" >> "$tmp/export.map"
+ echo " local: *;" >> "$tmp/export.map"
+ echo "};" >> "$tmp/export.map"
- CFLAGS="$CFLAGS -Wl,-retain-symbols-file=$tmp/exports"
+ CFLAGS="$CFLAGS -Wl,--version-script=$tmp/export.map"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -8986,17 +8989,17 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- llvm_cv_link_use_retain_symbols_file=yes
+ llvm_cv_link_use_version_script=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- llvm_cv_link_use_retain_symbols_file=no
+ llvm_cv_link_version_script=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- rm "$tmp/exports"
+ rm "$tmp/export.map"
rmdir "$tmp"
CFLAGS="$oldcflags"
ac_ext=c
@@ -9007,10 +9010,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
-{ echo "$as_me:$LINENO: result: $llvm_cv_link_use_retain_symbols_file" >&5
-echo "${ECHO_T}$llvm_cv_link_use_retain_symbols_file" >&6; }
-if test "$llvm_cv_link_use_retain_symbols_file" = yes ; then
- HAVE_LINK_RETAIN_SYMBOLS_FILE=1
+{ echo "$as_me:$LINENO: result: $llvm_cv_link_use_version_script" >&5
+echo "${ECHO_T}$llvm_cv_link_use_version_script" >&6; }
+if test "$llvm_cv_link_use_version_script" = yes ; then
+ HAVE_LINK_VERSION_SCRIPT=1
fi
@@ -11384,7 +11387,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 11387 "configure"
+#line 11390 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -21297,7 +21300,7 @@ OCAMLOPT!$OCAMLOPT$ac_delim
OCAMLDEP!$OCAMLDEP$ac_delim
OCAMLDOC!$OCAMLDOC$ac_delim
GAS!$GAS$ac_delim
-HAVE_LINK_RETAIN_SYMBOLS_FILE!$HAVE_LINK_RETAIN_SYMBOLS_FILE$ac_delim
+HAVE_LINK_VERSION_SCRIPT!$HAVE_LINK_VERSION_SCRIPT$ac_delim
INSTALL_LTDL_TRUE!$INSTALL_LTDL_TRUE$ac_delim
INSTALL_LTDL_FALSE!$INSTALL_LTDL_FALSE$ac_delim
CONVENIENCE_LTDL_TRUE!$CONVENIENCE_LTDL_TRUE$ac_delim