[PATCH] PR gold/17640

H.J. Lu hjl.tools@gmail.com
Mon Feb 2 14:41:00 GMT 2015


On Mon, Feb 2, 2015 at 5:47 AM, Ilya Tocar <tocarip.intel@gmail.com> wrote:
> Hi,
>
> This patch adds mov to lea conversion to gold (as discussed in PR).
> It provides about 1.5% performance gain on SPEC2000 geomean,
> when pie is used.
> OK for trunk?

The patch is incomplete.  Gold generates a useless R_386_RELATIVE
relocation together with an unused GOT slot:

[hjl@gnu-tools-1 gold]$ cat lea1.s
.text
.globl foo
.type foo, @function
foo:
ret
.size foo, .-foo
.globl _start
.type _start, @function
_start:
movl foo@GOT(%ecx), %eax
.size _start, .-_start
[hjl@gnu-tools-1 gold]$ gcc -c -m32 lea1.s
[hjl@gnu-tools-1 gold]$ ./ld-new -pie -melf_i386 lea1.o
[hjl@gnu-tools-1 gold]$ readelf -r a.out

Relocation section '.rel.dyn' at offset 0x10c contains 1 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
000011a4  00000008 R_386_RELATIVE
[hjl@gnu-tools-1 gold]$ readelf -SW a.out  | grep ".got "
  [ 8] .got              PROGBITS        000011a4 0001a4 000004 00  WA  0   0  4
[hjl@gnu-tools-1 gold]$ ld.bfd -pie -melf_i386 lea1.o
[hjl@gnu-tools-1 gold]$ readelf -r a.out

There are no relocations in this file.
[hjl@gnu-tools-1 gold]$ readelf -SW a.out  | grep ".got "
[hjl@gnu-tools-1 gold]$


H.J.



More information about the Binutils mailing list