[gold] 2.27 generates GOT where 2.26 did not
Jethro Beekman
binutils@jbeekman.nl
Fri Aug 12 03:32:00 GMT 2016
On 11-08-16 17:31, Jethro Beekman wrote:
> I have these two files:
>
> // asm_var.S
> .section .rodata
> .global asm_var
> .protected asm_var
> .size asm_var, 8
> asm_var:
> .org .+8
>
> // get_addr.c
> extern unsigned long asm_var;
>
> void* get_addr() {
> return &asm_var;
> }
>
> That I compile with:
> gcc -O3 -fuse-ld=gold -fPIC -shared -nostdlib -Wl,-Bsymbolic asm_var.S get_addr.c
>
> With gold 2.26.1 (and most likely older versions as well), this results in:
>
> 00000000000002f0 <get_addr>:
> 2f0: 48 8d 05 01 00 00 00 lea 0x1(%rip),%rax # 2f8 <asm_var>
> 2f7: c3 retq
>
> Yet with 2.27 this results in:
>
> 0000000000000340 <get_addr>:
> 340: 48 8b 05 99 1c 00 00 mov 0x1c99(%rip),%rax # 1fe0 <_DYNAMIC+0x110>
> 347: c3 retq
>
> What's at 1fe0?
>
> 000000001fe0 000500000006 R_X86_64_GLOB_DAT 0000000000000348 asm_var + 0
>
> Is this a regression in 2.27? I really don't want to use the GOT. Is there a
> flag I can pass to get the old behavior?
I think I found another, possibly related, regression. If I add another file "map":
{
local:
*;
};
And compile with -Wl,--version-script,map on 2.26 I get:
DYNAMIC SYMBOL TABLE:
no symbols
But on 2.27 I get:
DYNAMIC SYMBOL TABLE:
00000000000002a8 l D .rodata 0000000000000008 .protected asm_var
Jethro Beekman
More information about the Binutils
mailing list