https://sourceware.org/bugzilla/show_bug.cgi?id=33552
Rainer Orth <ro at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|NOTABUG |---
Status|RESOLVED |REOPENED
CC| |jbeulich at suse dot com
--- Comment #4 from Rainer Orth <ro at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #3)
> > If so, why would both Solaris as (which never knew R_32_GOT32X) and
> > e.g. 2.20.1 (which didn't yet) assemble this just fine and produce the
> > same code?
>
> R_386_GOT32 is usually used for PIC. But _start@GOT doesn't have a base
> register
> which won't work for PIC. Linker will check the base less _start@GOT error
> in
> PIC, but only for R_386_GOT32X:
>
> direct GOT relocation R_386_GOT32X against `foo' without base register can
> not be used when making a shared object
This is all fine, but doesn't answer the problem reported in this PR. I may
be particularly dense, but
> [hjl@gnu-tgl-3 tmp]$ cat x.s
> jmp *_start@GOT
> jmp *_start@GOT(%ebx)
> [hjl@gnu-tgl-3 tmp]$ as --32 -mrelax-relocations=no -o x.o x.s
^^^^^^^^^^^^^^^^^^^^^^
this seems to be conflicting with
> [hjl@gnu-tgl-3 tmp]$ objdump -dwr x.o
[...]
> 00000000 <.text>:
> 0: ff 25 00 00 00 00 jmp *0x0 2: R_386_GOT32X _start
^^^^^^^^^^^^
this
> 6: ff a3 00 00 00 00 jmp *0x0(%ebx) 8: R_386_GOT32 _start
c-i386.texi states clearly
@item -mrelax-relocations=@var{no}
@itemx -mrelax-relocations=@var{yes}
These options control whether the assembler should generate relax
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.
so emitting R_386_GOT32X is a clear contract violation in my book: the user
asked not to generate relax relocations, yet gas does exactly that.
Consider some test like gas/i386/nommx-3.s, which, when assembled with
gas --32 -march=+nommx
errors out with
Error: `emms' is not supported on `i386.nommx'
I.e. the user asked not to emit mmx insns and gas errors out if this attempted.
Same here: the user asked *not* to emit R_386_GOT32X, still gas emitted it,
which seems blatantly wrong to me. Remember that -mrelax-relocations=no
was introduced exactly to inhibit the emission of relax relocations on
targets where they are not supported and thus cannot be linked by native tools,
so the option doesn't live up to its claim.
If the input cannot be assembled without that reloc, gas should error out
rather than silently emitting it against the user's wishes!
--
You are receiving this mail because:
You are on the CC list for the bug.