This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR gold/17640
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Ilya Tocar <tocarip dot intel at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>, Cary Coutant <ccoutant at google dot com>
- Date: Mon, 2 Feb 2015 06:41:17 -0800
- Subject: Re: [PATCH] PR gold/17640
- Authentication-results: sourceware.org; auth=none
- References: <20150202134701 dot GA91020 at msticlxl7 dot ims dot intel dot com>
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.