configure: Remove check if ld is GNU

Assume linker has gnu argument input style.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Adhemerval Zanella 2022-12-02 16:00:27 -03:00
parent f35b7ce02f
commit 6cfc50f40a
3 changed files with 91 additions and 127 deletions

32
aclocal.m4 vendored
View File

@ -126,10 +126,6 @@ OBJCOPY=`$CC -print-prog-name=objcopy`
AC_SUBST(OBJCOPY) AC_SUBST(OBJCOPY)
GPROF=`$CC -print-prog-name=gprof` GPROF=`$CC -print-prog-name=gprof`
AC_SUBST(GPROF) AC_SUBST(GPROF)
AC_CACHE_CHECK(whether $LD is GNU ld, libc_cv_prog_ld_gnu,
[LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)])
gnu_ld=$libc_cv_prog_ld_gnu
]) ])
dnl Run a static link test with -nostdlib -nostartfiles. dnl Run a static link test with -nostdlib -nostartfiles.
@ -219,25 +215,23 @@ dnl LIBC_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-f
AC_DEFUN([LIBC_LINKER_FEATURE], AC_DEFUN([LIBC_LINKER_FEATURE],
[AC_MSG_CHECKING([for linker that supports $1]) [AC_MSG_CHECKING([for linker that supports $1])
libc_linker_feature=no libc_linker_feature=no
if test x"$gnu_ld" = x"yes"; then cat > conftest.c <<EOF
cat > conftest.c <<EOF
int _start (void) { return 42; } int _start (void) { return 42; }
EOF EOF
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
$2 -nostdlib -nostartfiles $2 -nostdlib -nostartfiles
-fPIC -shared -o conftest.so conftest.c -fPIC -shared -o conftest.so conftest.c
1>&AS_MESSAGE_LOG_FD]) 1>&AS_MESSAGE_LOG_FD])
then then
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
| grep "warning: $1 ignored" > /dev/null 2>&1; then | grep "warning: $1 ignored" > /dev/null 2>&1; then
true true
else else
libc_linker_feature=yes libc_linker_feature=yes
fi
fi fi
rm -f conftest*
fi fi
rm -f conftest*
if test $libc_linker_feature = yes; then if test $libc_linker_feature = yes; then
$3 $3
else else

158
configure vendored
View File

@ -4155,24 +4155,6 @@ OBJCOPY=`$CC -print-prog-name=objcopy`
GPROF=`$CC -print-prog-name=gprof` GPROF=`$CC -print-prog-name=gprof`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $LD is GNU ld" >&5
$as_echo_n "checking whether $LD is GNU ld... " >&6; }
if ${libc_cv_prog_ld_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
# Most GNU programs take a -v and spit out some text including
# the word 'GNU'. Some try to read stdin, so give them /dev/null.
if $LD -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
libc_cv_prog_ld_gnu=yes
else
libc_cv_prog_ld_gnu=no
fi
rm -fr contest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_prog_ld_gnu" >&5
$as_echo "$libc_cv_prog_ld_gnu" >&6; }
gnu_ld=$libc_cv_prog_ld_gnu
# Accept binutils 2.25 or newer. # Accept binutils 2.25 or newer.
for ac_prog in $AS for ac_prog in $AS
@ -6037,30 +6019,28 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z execstack" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z execstack" >&5
$as_echo_n "checking for linker that supports -z execstack... " >&6; } $as_echo_n "checking for linker that supports -z execstack... " >&6; }
libc_linker_feature=no libc_linker_feature=no
if test x"$gnu_ld" = x"yes"; then cat > conftest.c <<EOF
cat > conftest.c <<EOF
int _start (void) { return 42; } int _start (void) { return 42; }
EOF EOF
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
-Wl,-z,execstack -nostdlib -nostartfiles -Wl,-z,execstack -nostdlib -nostartfiles
-fPIC -shared -o conftest.so conftest.c -fPIC -shared -o conftest.so conftest.c
1>&5' 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5 (eval $ac_try) 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; } test $ac_status = 0; }; }
then then
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,execstack -nostdlib \ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,execstack -nostdlib \
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
| grep "warning: -z execstack ignored" > /dev/null 2>&1; then | grep "warning: -z execstack ignored" > /dev/null 2>&1; then
true true
else else
libc_linker_feature=yes libc_linker_feature=yes
fi
fi fi
rm -f conftest*
fi fi
rm -f conftest*
if test $libc_linker_feature = yes; then if test $libc_linker_feature = yes; then
libc_cv_z_execstack=yes libc_cv_z_execstack=yes
else else
@ -6073,30 +6053,28 @@ $as_echo "$libc_linker_feature" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z start-stop-gc" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z start-stop-gc" >&5
$as_echo_n "checking for linker that supports -z start-stop-gc... " >&6; } $as_echo_n "checking for linker that supports -z start-stop-gc... " >&6; }
libc_linker_feature=no libc_linker_feature=no
if test x"$gnu_ld" = x"yes"; then cat > conftest.c <<EOF
cat > conftest.c <<EOF
int _start (void) { return 42; } int _start (void) { return 42; }
EOF EOF
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
-Wl,-z,start-stop-gc -nostdlib -nostartfiles -Wl,-z,start-stop-gc -nostdlib -nostartfiles
-fPIC -shared -o conftest.so conftest.c -fPIC -shared -o conftest.so conftest.c
1>&5' 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5 (eval $ac_try) 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; } test $ac_status = 0; }; }
then then
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,start-stop-gc -nostdlib \ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,start-stop-gc -nostdlib \
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
| grep "warning: -z start-stop-gc ignored" > /dev/null 2>&1; then | grep "warning: -z start-stop-gc ignored" > /dev/null 2>&1; then
true true
else else
libc_linker_feature=yes libc_linker_feature=yes
fi
fi fi
rm -f conftest*
fi fi
rm -f conftest*
if test $libc_linker_feature = yes; then if test $libc_linker_feature = yes; then
libc_cv_z_start_stop_gc=yes libc_cv_z_start_stop_gc=yes
else else
@ -6110,30 +6088,28 @@ have-z-start-stop-gc = $libc_cv_z_start_stop_gc"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --depaudit" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --depaudit" >&5
$as_echo_n "checking for linker that supports --depaudit... " >&6; } $as_echo_n "checking for linker that supports --depaudit... " >&6; }
libc_linker_feature=no libc_linker_feature=no
if test x"$gnu_ld" = x"yes"; then cat > conftest.c <<EOF
cat > conftest.c <<EOF
int _start (void) { return 42; } int _start (void) { return 42; }
EOF EOF
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
-Wl,--depaudit,x -nostdlib -nostartfiles -Wl,--depaudit,x -nostdlib -nostartfiles
-fPIC -shared -o conftest.so conftest.c -fPIC -shared -o conftest.so conftest.c
1>&5' 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5 (eval $ac_try) 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; } test $ac_status = 0; }; }
then then
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--depaudit,x -nostdlib \ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--depaudit,x -nostdlib \
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
| grep "warning: --depaudit ignored" > /dev/null 2>&1; then | grep "warning: --depaudit ignored" > /dev/null 2>&1; then
true true
else else
libc_linker_feature=yes libc_linker_feature=yes
fi
fi fi
rm -f conftest*
fi fi
rm -f conftest*
if test $libc_linker_feature = yes; then if test $libc_linker_feature = yes; then
libc_cv_depaudit=yes libc_cv_depaudit=yes
else else
@ -6147,30 +6123,28 @@ have-depaudit = $libc_cv_depaudit"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z pack-relative-relocs" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z pack-relative-relocs" >&5
$as_echo_n "checking for linker that supports -z pack-relative-relocs... " >&6; } $as_echo_n "checking for linker that supports -z pack-relative-relocs... " >&6; }
libc_linker_feature=no libc_linker_feature=no
if test x"$gnu_ld" = x"yes"; then cat > conftest.c <<EOF
cat > conftest.c <<EOF
int _start (void) { return 42; } int _start (void) { return 42; }
EOF EOF
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
-Wl,-z,pack-relative-relocs -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs -nostdlib -nostartfiles
-fPIC -shared -o conftest.so conftest.c -fPIC -shared -o conftest.so conftest.c
1>&5' 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5 (eval $ac_try) 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; } test $ac_status = 0; }; }
then then
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,pack-relative-relocs -nostdlib \ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,pack-relative-relocs -nostdlib \
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
| grep "warning: -z pack-relative-relocs ignored" > /dev/null 2>&1; then | grep "warning: -z pack-relative-relocs ignored" > /dev/null 2>&1; then
true true
else else
libc_linker_feature=yes libc_linker_feature=yes
fi
fi fi
rm -f conftest*
fi fi
rm -f conftest*
if test $libc_linker_feature = yes; then if test $libc_linker_feature = yes; then
libc_cv_dt_relr=yes libc_cv_dt_relr=yes
else else
@ -6184,30 +6158,28 @@ have-dt-relr = $libc_cv_dt_relr"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-dynamic-linker" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-dynamic-linker" >&5
$as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; } $as_echo_n "checking for linker that supports --no-dynamic-linker... " >&6; }
libc_linker_feature=no libc_linker_feature=no
if test x"$gnu_ld" = x"yes"; then cat > conftest.c <<EOF
cat > conftest.c <<EOF
int _start (void) { return 42; } int _start (void) { return 42; }
EOF EOF
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
-Wl,--no-dynamic-linker -nostdlib -nostartfiles -Wl,--no-dynamic-linker -nostdlib -nostartfiles
-fPIC -shared -o conftest.so conftest.c -fPIC -shared -o conftest.so conftest.c
1>&5' 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5 (eval $ac_try) 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; } test $ac_status = 0; }; }
then then
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-dynamic-linker -nostdlib \ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-dynamic-linker -nostdlib \
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
| grep "warning: --no-dynamic-linker ignored" > /dev/null 2>&1; then | grep "warning: --no-dynamic-linker ignored" > /dev/null 2>&1; then
true true
else else
libc_linker_feature=yes libc_linker_feature=yes
fi
fi fi
rm -f conftest*
fi fi
rm -f conftest*
if test $libc_linker_feature = yes; then if test $libc_linker_feature = yes; then
libc_cv_no_dynamic_linker=yes libc_cv_no_dynamic_linker=yes
else else

View File

@ -79,30 +79,28 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-tls-get-addr-optimize" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-tls-get-addr-optimize" >&5
$as_echo_n "checking for linker that supports --no-tls-get-addr-optimize... " >&6; } $as_echo_n "checking for linker that supports --no-tls-get-addr-optimize... " >&6; }
libc_linker_feature=no libc_linker_feature=no
if test x"$gnu_ld" = x"yes"; then cat > conftest.c <<EOF
cat > conftest.c <<EOF
int _start (void) { return 42; } int _start (void) { return 42; }
EOF EOF
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
-Wl,--no-tls-get-addr-optimize -nostdlib -nostartfiles -Wl,--no-tls-get-addr-optimize -nostdlib -nostartfiles
-fPIC -shared -o conftest.so conftest.c -fPIC -shared -o conftest.so conftest.c
1>&5' 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5 (eval $ac_try) 2>&5
ac_status=$? ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; } test $ac_status = 0; }; }
then then
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-tls-get-addr-optimize -nostdlib \ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-tls-get-addr-optimize -nostdlib \
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
| grep "warning: --no-tls-get-addr-optimize ignored" > /dev/null 2>&1; then | grep "warning: --no-tls-get-addr-optimize ignored" > /dev/null 2>&1; then
true true
else else
libc_linker_feature=yes libc_linker_feature=yes
fi
fi fi
rm -f conftest*
fi fi
rm -f conftest*
if test $libc_linker_feature = yes; then if test $libc_linker_feature = yes; then
libc_cv_tls_get_addr_optimize=yes libc_cv_tls_get_addr_optimize=yes
else else