[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gold/14536] Unnecessary GOT usages
From: |
ccoutant at google dot com |
Subject: |
[Bug gold/14536] Unnecessary GOT usages |
Date: |
Fri, 31 Aug 2012 21:19:20 +0000 |
http://sourceware.org/bugzilla/show_bug.cgi?id=14536
--- Comment #1 from Cary Coutant <ccoutant at google dot com> 2012-08-31
21:19:20 UTC ---
I think this is related to the discussion here:
http://sourceware.org/ml/binutils/2011-03/msg00220.html.
-cary
On Fri, Aug 31, 2012 at 2:11 PM, hjl.tools at gmail dot com
<address@hidden> wrote:
> http://sourceware.org/bugzilla/show_bug.cgi?id=14536
>
> Bug #: 14536
> Summary: Unnecessary GOT usages
> Product: binutils
> Version: 2.23 (HEAD)
> Status: NEW
> Severity: normal
> Priority: P2
> Component: gold
> AssignedTo: address@hidden
> ReportedBy: address@hidden
> CC: address@hidden
> Classification: Unclassified
>
>
> On Linux/x86, gold gives
> address@hidden symbolic-6]$ cat foo.S
> .text
> .globl foo
> .type foo, @function
> foo:
> ret
> .size foo, .-foo
> .globl _start
> .type _start, @function
> _start:
> #ifdef __x86_64__
> movq address@hidden(%rip), %rax
> #else
> movl address@hidden(%ecx), %eax
> #endif
> .size _start, .-_start
> address@hidden symbolic-6]$ cat foo.t
> {
> global:
> _start;
> local:
> *;
> };
> address@hidden symbolic-6]$ make
> gcc -m32 -c -o foo.o foo.S
> ./ld -m elf_i386 -Bsymbolic -shared -o libfoo.so foo.o
> ./ld -m elf_i386 -pie -o pie foo.o
> ./ld -m elf_i386 -o static foo.o
> ./ld -m elf_i386 -shared -o shared foo.o --version-script foo.t
> objdump -dw libfoo.so
>
> libfoo.so: file format elf32-i386
>
>
> Disassembly of section .text:
>
> 0000016c <foo>:
> 16c: c3 ret
>
> 0000016d <_start>:
> 16d: 8b 81 fc ff ff ff mov -0x4(%ecx),%eax
> objdump -dw pie
>
> pie: file format elf32-i386
>
>
> Disassembly of section .text:
>
> 00000114 <foo>:
> 114: c3 ret
>
> 00000115 <_start>:
> 115: 8b 81 fc ff ff ff mov -0x4(%ecx),%eax
> objdump -dw static
>
> static: file format elf32-i386
>
>
> Disassembly of section .text:
>
> 08048074 <foo>:
> 8048074: c3 ret
>
> 08048075 <_start>:
> 8048075: 8b 81 fc ff ff ff mov -0x4(%ecx),%eax
> objdump -dw shared
>
> shared: file format elf32-i386
>
>
> Disassembly of section .text:
>
> 000000f8 <foo>:
> f8: c3 ret
>
> 000000f9 <_start>:
> f9: 8b 81 fc ff ff ff mov -0x4(%ecx),%eax
> readelf -SW libfoo.so | grep ".got " || true
> [ 7] .got PROGBITS 00001204 000204 000004 00 WA 0 0
> 4
> readelf -SW pie | grep ".got " || true
> [ 8] .got PROGBITS 000011a4 0001a4 000004 00 WA 0 0
> 4
> readelf -SW static | grep ".got " || true
> [ 2] .got PROGBITS 0804907c 00007c 000004 00 WA 0 0
> 4
> readelf -SW shared | grep ".got " || true
> [ 7] .got PROGBITS 00001180 000180 000004 00 WA 0 0
> 4
> address@hidden symbolic-6]$
>
> bfd linker gave
>
> address@hidden symbolic-6]$ make LD=./ld.bfd
> gcc -m32 -c -o foo.o foo.S
> ./ld.bfd -m elf_i386 -Bsymbolic -shared -o libfoo.so foo.o
> ./ld.bfd -m elf_i386 -pie -o pie foo.o
> ./ld.bfd -m elf_i386 -o static foo.o
> ./ld.bfd -m elf_i386 -shared -o shared foo.o --version-script foo.t
> objdump -dw libfoo.so
>
> libfoo.so: file format elf32-i386
>
>
> Disassembly of section .text:
>
> 00000140 <foo>:
> 140: c3 ret
>
> 00000141 <_start>:
> 141: 8d 81 98 ef ff ff lea -0x1068(%ecx),%eax
> objdump -dw pie
>
> pie: file format elf32-i386
>
>
> Disassembly of section .text:
>
> 00000168 <foo>:
> 168: c3 ret
>
> 00000169 <_start>:
> 169: 8d 81 98 ef ff ff lea -0x1068(%ecx),%eax
> objdump -dw static
>
> static: file format elf32-i386
>
>
> Disassembly of section .text:
>
> 08048074 <foo>:
> 8048074: c3 ret
>
> 08048075 <_start>:
> 8048075: 8d 81 f8 ef ff ff lea -0x1008(%ecx),%eax
> objdump -dw shared
>
> shared: file format elf32-i386
>
>
> Disassembly of section .text:
>
> 000000d0 <foo>:
> d0: c3 ret
>
> 000000d1 <_start>:
> d1: 8d 81 a0 ef ff ff lea -0x1060(%ecx),%eax
> readelf -SW libfoo.so | grep ".got " || true
> readelf -SW pie | grep ".got " || true
> readelf -SW static | grep ".got " || true
> readelf -SW shared | grep ".got " || true
> address@hidden symbolic-6]$
>
> The same goes for Linux/x86-64.
>
> --
> Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.