X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=autoconf%2Fm4%2Flink_options.m4;h=57da4a0d926998a1db92b428005b339b2dcb5c9c;hb=f6670729aabc1fab85238d2b306a1c1767a807bb;hp=697abab07d4d47347ff9b26a2c69b7fd2d768abb;hpb=39ed6789c537ab6ec3d9b5944761e87c215f4fab;p=oota-llvm.git diff --git a/autoconf/m4/link_options.m4 b/autoconf/m4/link_options.m4 index 697abab07d4..57da4a0d926 100644 --- a/autoconf/m4/link_options.m4 +++ b/autoconf/m4/link_options.m4 @@ -1,3 +1,24 @@ +# +# Get the linker version string. +# +# This macro is specific to LLVM. +# +AC_DEFUN([AC_LINK_GET_VERSION], + [AC_CACHE_CHECK([for linker version],[llvm_cv_link_version], + [ + version_string="$(ld -v 2>&1 | head -1)" + + # Check for ld64. + if (echo "$version_string" | grep -q "ld64"); then + llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)\( (.*)\)\{0,1\}#\1#") + else + llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#") + fi + ]) + AC_DEFINE_UNQUOTED([HOST_LINK_VERSION],"$llvm_cv_link_version", + [Linker version detected at compile time.]) +]) + # # Determine if the system can handle the -R option being passed to the linker. # @@ -40,14 +61,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 +88,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_use_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 ])