mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 04:24:43 +00:00
gas: Default to -mrelax-relocations=no on Solaris/x86 [PR19520]
I recently noticed a complex case statement in gas/configure.ac controlling
the setting of ac_default_x86_relax_relocations on Solaris/x86. Since it
included all versions of Solaris, it could be massively simplified.
Looking closer however, I found that it was introduced in
commit 0cb4071ef9
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Feb 3 08:25:15 2016 -0800
Add -mrelax-relocations= to x86 assembler
based on PR gas/19520. This PR reported that the new R_386_GOT32X
etc. relocations weren't supported on older versions of Solaris,
breaking gcc bootstrap. In response, they were disabled on all Solaris
versions except Solaris 12, where they had been implemented in the
native toolchain based on my findings.
However, Solaris 12 has been rechristened to 11.4 before release,
effectively disabling DEFAULT_GENERATE_X86_RELAX_RELOCATIONS on all
versions of Solaris/x86.
Since Solaris 11.4 cannot be distinguished from earlier versions in
cross configurations, this patch fixes this by removing
--enable-x86-relax-relocations completely, instead disabling
DEFAULT_GENERATE_X86_RELAX_RELOCATIONS in tc-i386.c on Solaris. It also
adds testcases to verify the -mrelax-relocations default.
Tested on {i386,amd64}-pc-solaris2.11 and {i686,x86_64}-pc-linux-gnu.
2025-10-16 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gas:
PR gas/19520
* configure.ac (ac_default_x86_relax_relocations): Remove.
<i386-*-solaris2* | x86_64-*-solaris2>: Likewise.
* configure: Regenerate.
* config.in: Regenerate.
* config/tc-i386.c (DEFAULT_GENERATE_X86_RELAX_RELOCATIONS): Define.
* doc/c-i386.texi (i386-Options, -mrelax-relocations): Remove
--enable-x86-relax-relocations reference.
* testsuite/gas/i386/gotx.s: New source.
* testsuite/gas/i386/gotx-default.d: New test.
* testsuite/gas/i386/no-gotx-default.d: Likewise.
* testsuite/gas/i386/i386.exp: Run them.
This commit is contained in:
@@ -42,9 +42,6 @@
|
||||
type by default. */
|
||||
#undef DEFAULT_GENERATE_ELF_STT_COMMON
|
||||
|
||||
/* Define to 1 if you want to generate x86 relax relocations by default. */
|
||||
#undef DEFAULT_GENERATE_X86_RELAX_RELOCATIONS
|
||||
|
||||
/* Define to 1 if you want to fix Loongson3 LLSC Errata by default. */
|
||||
#undef DEFAULT_MIPS_FIX_LOONGSON3_LLSC
|
||||
|
||||
|
||||
@@ -750,6 +750,15 @@ lfence_before_ret;
|
||||
|
||||
/* 1 if the assembler should generate relax relocations. */
|
||||
|
||||
#ifdef TE_SOLARIS
|
||||
/* PR gas/19520: The Solaris/x86 linker cannot handle relax relocations
|
||||
before Solaris 11.4 which cannot easily be detected in cross
|
||||
configurations. */
|
||||
#define DEFAULT_GENERATE_X86_RELAX_RELOCATIONS 0
|
||||
#else
|
||||
#define DEFAULT_GENERATE_X86_RELAX_RELOCATIONS 1
|
||||
#endif
|
||||
|
||||
static int generate_relax_relocations
|
||||
= DEFAULT_GENERATE_X86_RELAX_RELOCATIONS;
|
||||
|
||||
|
||||
38
gas/configure
vendored
38
gas/configure
vendored
@@ -818,7 +818,6 @@ enable_targets
|
||||
enable_checking
|
||||
enable_compressed_debug_sections
|
||||
enable_default_compressed_debug_sections_algorithm
|
||||
enable_x86_relax_relocations
|
||||
enable_x86_tls_check
|
||||
enable_elf_stt_common
|
||||
enable_default_sframe
|
||||
@@ -1494,8 +1493,6 @@ Optional Features:
|
||||
--enable-default-compressed-debug-sections-algorithm={zlib,zstd}
|
||||
Default compression algorithm for
|
||||
--enable-compressed-debug-sections.
|
||||
--enable-x86-relax-relocations
|
||||
generate x86 relax relocations by default
|
||||
--enable-x86-tls-check check x86 TLS relocation by default
|
||||
--enable-elf-stt-common generate ELF common symbols with STT_COMMON type by
|
||||
default
|
||||
@@ -11153,7 +11150,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11156 "configure"
|
||||
#line 11153 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@@ -11259,7 +11256,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11262 "configure"
|
||||
#line 11259 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@@ -11942,17 +11939,6 @@ if test "${enable_default_compressed_debug_sections_algorithm+set}" = set; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# PR gas/19520
|
||||
# Decide if x86 assembler should generate relax relocations.
|
||||
ac_default_x86_relax_relocations=unset
|
||||
# Provide a configure time option to override our default.
|
||||
# Check whether --enable-x86_relax_relocations was given.
|
||||
if test "${enable_x86_relax_relocations+set}" = set; then :
|
||||
enableval=$enable_x86_relax_relocations; case "${enableval}" in
|
||||
no) ac_default_x86_relax_relocations=0 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# PR gas/32022
|
||||
# Decide if x86 assembler should check TLS relocation.
|
||||
ac_default_x86_tls_check=unset
|
||||
@@ -12540,17 +12526,6 @@ $as_echo "#define STRICTCOFF 1" >>confdefs.h
|
||||
fi
|
||||
;;
|
||||
|
||||
i386-*-solaris2 \
|
||||
| x86_64-*-solaris2 \
|
||||
| i386-*-solaris2.[0-9] \
|
||||
| i386-*-solaris2.1[01] \
|
||||
| x86_64-*-solaris2.1[01])
|
||||
if test ${this_target} = $target \
|
||||
&& test ${ac_default_x86_relax_relocations} = unset; then
|
||||
ac_default_x86_relax_relocations=0
|
||||
fi
|
||||
;;
|
||||
|
||||
microblaze*)
|
||||
;;
|
||||
|
||||
@@ -13071,15 +13046,6 @@ $as_echo "$with_priv_spec" >&6; }
|
||||
|
||||
done
|
||||
|
||||
if test ${ac_default_x86_relax_relocations} = unset; then
|
||||
ac_default_x86_relax_relocations=1
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define DEFAULT_GENERATE_X86_RELAX_RELOCATIONS $ac_default_x86_relax_relocations
|
||||
_ACEOF
|
||||
|
||||
|
||||
if test ${ac_default_x86_tls_check} = unset; then
|
||||
ac_default_x86_tls_check=1
|
||||
fi
|
||||
|
||||
@@ -84,17 +84,6 @@ AC_ARG_ENABLE(default_compressed_debug_sections_algorithm,
|
||||
zstd) ac_default_compressed_debug_sections_algorithm=COMPRESS_DEBUG_ZSTD ;;
|
||||
esac])dnl
|
||||
|
||||
# PR gas/19520
|
||||
# Decide if x86 assembler should generate relax relocations.
|
||||
ac_default_x86_relax_relocations=unset
|
||||
# Provide a configure time option to override our default.
|
||||
AC_ARG_ENABLE(x86_relax_relocations,
|
||||
AS_HELP_STRING([--enable-x86-relax-relocations],
|
||||
[generate x86 relax relocations by default]),
|
||||
[case "${enableval}" in
|
||||
no) ac_default_x86_relax_relocations=0 ;;
|
||||
esac])dnl
|
||||
|
||||
# PR gas/32022
|
||||
# Decide if x86 assembler should check TLS relocation.
|
||||
ac_default_x86_tls_check=unset
|
||||
@@ -276,17 +265,6 @@ for this_target in $target $canon_targets ; do
|
||||
fi
|
||||
;;
|
||||
|
||||
i386-*-solaris2 \
|
||||
| x86_64-*-solaris2 \
|
||||
| i386-*-solaris2.[[0-9]] \
|
||||
| i386-*-solaris2.1[[01]] \
|
||||
| x86_64-*-solaris2.1[[01]])
|
||||
if test ${this_target} = $target \
|
||||
&& test ${ac_default_x86_relax_relocations} = unset; then
|
||||
ac_default_x86_relax_relocations=0
|
||||
fi
|
||||
;;
|
||||
|
||||
microblaze*)
|
||||
;;
|
||||
|
||||
@@ -735,13 +713,6 @@ changequote([,])dnl
|
||||
|
||||
done
|
||||
|
||||
if test ${ac_default_x86_relax_relocations} = unset; then
|
||||
ac_default_x86_relax_relocations=1
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_X86_RELAX_RELOCATIONS,
|
||||
$ac_default_x86_relax_relocations,
|
||||
[Define to 1 if you want to generate x86 relax relocations by default.])
|
||||
|
||||
if test ${ac_default_x86_tls_check} = unset; then
|
||||
ac_default_x86_tls_check=1
|
||||
fi
|
||||
|
||||
@@ -478,8 +478,7 @@ relocations, R_386_GOT32X, in 32-bit mode, or R_X86_64_GOTPCRELX and
|
||||
R_X86_64_REX_GOTPCRELX, in 64-bit mode.
|
||||
@option{-mrelax-relocations=@var{yes}} will generate relax relocations.
|
||||
@option{-mrelax-relocations=@var{no}} will not generate relax
|
||||
relocations. The default can be controlled by a configure option
|
||||
@option{--enable-x86-relax-relocations}.
|
||||
relocations.
|
||||
|
||||
@cindex @samp{-mtls-check=} option, i386
|
||||
@cindex @samp{-mtls-check=} option, x86-64
|
||||
|
||||
11
gas/testsuite/gas/i386/gotx-default.d
Normal file
11
gas/testsuite/gas/i386/gotx-default.d
Normal file
@@ -0,0 +1,11 @@
|
||||
#source: gotx.s
|
||||
#objdump: -dwr
|
||||
#xfail: *-*-solaris*
|
||||
|
||||
.*: +file format .*
|
||||
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+ <_start>:
|
||||
[ ]*[a-f0-9]+: ff a3 00 00 00 00 jmp \*0x0\(%ebx\) 2: R_386_GOT32X _start
|
||||
4
gas/testsuite/gas/i386/gotx.s
Normal file
4
gas/testsuite/gas/i386/gotx.s
Normal file
@@ -0,0 +1,4 @@
|
||||
.text
|
||||
.global _start
|
||||
_start:
|
||||
jmp *_start@GOT(%ebx)
|
||||
@@ -777,6 +777,9 @@ if [gas_32_check] then {
|
||||
|
||||
run_dump_test "no-got"
|
||||
|
||||
run_dump_test "gotx-default"
|
||||
run_dump_test "no-gotx-default"
|
||||
|
||||
run_dump_test "addend"
|
||||
run_dump_test "nop-3"
|
||||
run_dump_test "nop-4"
|
||||
|
||||
12
gas/testsuite/gas/i386/no-gotx-default.d
Normal file
12
gas/testsuite/gas/i386/no-gotx-default.d
Normal file
@@ -0,0 +1,12 @@
|
||||
#source: gotx.s
|
||||
#objdump: -dwr
|
||||
#xfail: *-*-*
|
||||
#noxfail: *-*-solaris*
|
||||
|
||||
.*: +file format .*
|
||||
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+ <_start>:
|
||||
[ ]*[a-f0-9]+: ff a3 00 00 00 00 jmp \*0x0\(%ebx\) 2: R_386_GOT32 _start
|
||||
Reference in New Issue
Block a user