https://sourceware.org/bugzilla/show_bug.cgi?id=33552
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Rainer Orth from comment #2) > > --- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> --- > > (In reply to Rainer Orth from comment #0) > > >> $ 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 > >> > > > > Originally "jmp *_start@GOT" wasn't supported. It was added with > > R_386_GOT32X > > by > > > > commit 02a866936de7e63ad4962ccba56c8cd05c231275 > > Author: H.J. Lu <[email protected]> > > Date: Thu Oct 22 04:46:51 2015 -0700 > > > > Add R_386_GOT32X support to gas and ld > > 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 You can change the HAVE_AS_IX86_GOT32X check with a base register: [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 [hjl@gnu-tgl-3 tmp]$ objdump -dwr x.o x.o: file format elf32-i386 Disassembly of section .text: 00000000 <.text>: 0: ff 25 00 00 00 00 jmp *0x0 2: R_386_GOT32X _start 6: ff a3 00 00 00 00 jmp *0x0(%ebx) 8: R_386_GOT32 _start [hjl@gnu-tgl-3 tmp]$ -- You are receiving this mail because: You are on the CC list for the bug.
