-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
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 8487d94..66f5383 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -1039,8 +1039,8 @@
 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 697abab..251c8a4 100644
--- a/autoconf/m4/link_options.m4
+++ b/autoconf/m4/link_options.m4
@@ -40,14 +40,14 @@
 ])
 
 #
-# 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 @@
     (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
 ])