mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Add an autoconf check for -retain-symbols-file and conditionalize
use of that option with it. This eliminates an imprecise "Linux" test, and should help support old versions of gold. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101560 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f7e2bc80d1
commit
e05f609b61
@ -337,3 +337,7 @@ ENABLE_LLVMC_DYNAMIC_PLUGINS = 1
|
||||
NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@
|
||||
# -Wno-variadic-macros
|
||||
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@
|
||||
|
@ -561,7 +561,7 @@ ifeq ($(HOST_OS),Darwin)
|
||||
# Get "4" out of 10.4 for later pieces in the makefile.
|
||||
DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/')
|
||||
|
||||
SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress \
|
||||
SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined,suppress \
|
||||
-dynamiclib
|
||||
ifneq ($(ARCH),ARM)
|
||||
SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)
|
||||
@ -990,13 +990,12 @@ endif
|
||||
# Now add the linker command-line options to use the native export file.
|
||||
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
LLVMLibsOptions += -Wl,-exported_symbols_list -Wl,$(NativeExportsFile)
|
||||
LLVMLibsOptions += -Wl,-exported_symbols_list,$(NativeExportsFile)
|
||||
endif
|
||||
|
||||
# This isn't really Linux-specific; it works at least on gold and bfd ld, but
|
||||
# there's no convenient way to detect it.
|
||||
ifeq ($(HOST_OS),Linux)
|
||||
LLVMLibsOptions += -Wl,-retain-symbols-file -Wl,$(NativeExportsFile)
|
||||
# gold, bfd ld, etc.
|
||||
ifeq ($(HAVE_LINK_RETAIN_SYMBOLS_FILE),1)
|
||||
LLVMLibsOptions += -Wl,-retain-symbols-file,$(NativeExportsFile)
|
||||
endif
|
||||
|
||||
endif
|
||||
@ -1297,7 +1296,7 @@ ifeq ($(HOST_OS),Darwin)
|
||||
|
||||
# Tiger tools don't support this.
|
||||
ifneq ($(DARWIN_MAJVERS),4)
|
||||
LD.Flags += -Wl,-exported_symbol -Wl,_main
|
||||
LD.Flags += -Wl,-exported_symbol,_main
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -1022,6 +1022,9 @@ 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 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
|
||||
dnl libtool).
|
||||
|
@ -39,3 +39,46 @@ if test "$llvm_cv_link_use_export_dynamic" = yes ; then
|
||||
fi
|
||||
])
|
||||
|
||||
#
|
||||
# Determine if the system can handle the -retain-symbols-file 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_LANG_PUSH([C])
|
||||
oldcflags="$CFLAGS"
|
||||
|
||||
# The following code is from the autoconf manual,
|
||||
# "11.13: Limitations of Usual Tools".
|
||||
# Create a temporary directory $tmp in $TMPDIR (default /tmp).
|
||||
# Use mktemp if possible; otherwise fall back on mkdir,
|
||||
# with $RANDOM to make collisions less likely.
|
||||
: ${TMPDIR=/tmp}
|
||||
{
|
||||
tmp=`
|
||||
(umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
|
||||
` &&
|
||||
test -n "$tmp" && test -d "$tmp"
|
||||
} || {
|
||||
tmp=$TMPDIR/foo$$-$RANDOM
|
||||
(umask 077 && mkdir "$tmp")
|
||||
} || exit $?
|
||||
|
||||
echo "main" > "$tmp/exports"
|
||||
|
||||
CFLAGS="$CFLAGS -Wl,-retain-symbols-file=$tmp/exports"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
|
||||
[llvm_cv_link_use_retain_symbols_file=yes],[llvm_cv_link_use_retain_symbols_file=no])
|
||||
rm "$tmp/exports"
|
||||
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)
|
||||
fi
|
||||
])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user