https://sourceware.org/bugzilla/show_bug.cgi?id=33552

            Bug ID: 33552
           Summary: gas --32 -mrelax-relocations=no sometimes generates
                    R_386_GOT32X
           Product: binutils
           Version: 2.46 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: ro at gcc dot gnu.org
                CC: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: i?86-*-*

I've recently worked on a patch to always default to -mrelax-relocations=no
on Solaris/x86.  For that, I meant to create a testcase showing that gas
doesn't generate relax relocations even without -mrelax-relocations=no.

However, I found that this options doesn't live up to it claims: starting from
testcase in gcc/configure.ac (HAVE_AS_IX86_GOT32X)

        .data
bar:
        .byte 1
        .text
        .global _start
_start:
         cmpl $0, bar@GOT
         jmp *_start@GOT


I found that the test sets HAVE_AS_IX86_GOT32X to 1 even though gas effectively
defaults to -mrelax-relocations=no on Solaris/x86.

$ gas --32 -mrelax-relocations=no got32x.s -o got32x.o
$ readelf -r got32x.o
Relocation section '.rel.text' at offset 0xa8 contains 2 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000002  00000103 R_386_GOT32       00000000   bar
00000009  0000022b R_386_GOT32X      00000000   _start

which was totally unexpected and contrarary to what the option is documented to
do.  Exactly the same happens with trunk gas on Linux/i686 and has been this
way since binutils 2.26.1 when the option was introduced.

Looking closer, the option reliably inhibits the generation of
R_AMD64_GOTPCRELX
and R_AMD64_REX_GOTPCRELX for 64-bit, while for 32-bit it's only partially
effective.  Running the gas --32 -mrelax-relocations tests with explicit
-mrelax-relocations=no shows just like the example above that out of those
tests
the gas/i386/got.s one shows the same bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to