mirror of git://sourceware.org/git/glibc.git
Check if linker supports -Wl,--undefined-version
Although binutils has supported --no-undefined-version for a long timei (319416359200 back in 2002), --undefined-version was only added more recently (27fb6a1a7fcd on 2.40). Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
parent
20e92c9512
commit
64b6813338
|
|
@ -510,7 +510,7 @@ map-file = $(firstword $($(@F:.so=-map)) \
|
||||||
$(filter $(@F:.so=.map),$(version-maps))))
|
$(filter $(@F:.so=.map),$(version-maps))))
|
||||||
# The map version is created with multiple symbols that might not be
|
# The map version is created with multiple symbols that might not be
|
||||||
# exported depending of the ABI.
|
# exported depending of the ABI.
|
||||||
load-map-file = $(map-file:%=-Wl,--version-script=%) -Wl,--undefined-version
|
load-map-file = $(map-file:%=-Wl,--version-script=%) $(have-undefined-version)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Compiler arguments to use to link a shared object with libc and
|
# Compiler arguments to use to link a shared object with libc and
|
||||||
|
|
|
||||||
|
|
@ -9246,6 +9246,42 @@ printf "%s\n" "$libc_linker_feature" >&6; }
|
||||||
config_vars="$config_vars
|
config_vars="$config_vars
|
||||||
have-ld-gcs = $libc_cv_ld_gcs"
|
have-ld-gcs = $libc_cv_ld_gcs"
|
||||||
|
|
||||||
|
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker that supports --undefined-version" >&5
|
||||||
|
printf %s "checking for linker that supports --undefined-version... " >&6; }
|
||||||
|
libc_linker_feature=no
|
||||||
|
cat > conftest.c <<EOF
|
||||||
|
int _start (void) { return 42; }
|
||||||
|
EOF
|
||||||
|
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
|
||||||
|
-Wl,--undefined-version -nostdlib -nostartfiles
|
||||||
|
-fPIC -shared -o conftest.so conftest.c
|
||||||
|
1>&5'
|
||||||
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }; }
|
||||||
|
then
|
||||||
|
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--undefined-version -nostdlib \
|
||||||
|
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
|
||||||
|
| grep "warning: --undefined-version ignored" > /dev/null 2>&1; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
libc_linker_feature=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
if test $libc_linker_feature = yes; then
|
||||||
|
libc_cv_ld_undefined_version=-Wl,--undefined-version
|
||||||
|
else
|
||||||
|
libc_cv_ld_undefined_version=
|
||||||
|
fi
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
|
||||||
|
printf "%s\n" "$libc_linker_feature" >&6; }
|
||||||
|
config_vars="$config_vars
|
||||||
|
have-undefined-version = $libc_cv_ld_undefined_version"
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can build programs as PIE" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can build programs as PIE" >&5
|
||||||
printf %s "checking if we can build programs as PIE... " >&6; }
|
printf %s "checking if we can build programs as PIE... " >&6; }
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
|
|
||||||
|
|
@ -2066,6 +2066,12 @@ LIBC_LINKER_FEATURE([-z gcs=always], [-Wl,-z,gcs=always],
|
||||||
[libc_cv_ld_gcs=yes], [libc_cv_ld_gcs=no])
|
[libc_cv_ld_gcs=yes], [libc_cv_ld_gcs=no])
|
||||||
LIBC_CONFIG_VAR([have-ld-gcs], [$libc_cv_ld_gcs])
|
LIBC_CONFIG_VAR([have-ld-gcs], [$libc_cv_ld_gcs])
|
||||||
|
|
||||||
|
|
||||||
|
LIBC_LINKER_FEATURE([--undefined-version], [-Wl,--undefined-version],
|
||||||
|
[libc_cv_ld_undefined_version=-Wl,--undefined-version],
|
||||||
|
[libc_cv_ld_undefined_version=])
|
||||||
|
LIBC_CONFIG_VAR([have-undefined-version], [$libc_cv_ld_undefined_version])
|
||||||
|
|
||||||
AC_MSG_CHECKING(if we can build programs as PIE)
|
AC_MSG_CHECKING(if we can build programs as PIE)
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
|
||||||
# error PIE is not supported
|
# error PIE is not supported
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue