* [gold] 2.27 generates GOT where 2.26 did not
@ 2016-08-12 0:31 Jethro Beekman
2016-08-12 3:10 ` Andrew Pinski
2016-08-12 3:32 ` Jethro Beekman
0 siblings, 2 replies; 4+ messages in thread
From: Jethro Beekman @ 2016-08-12 0:31 UTC (permalink / raw)
To: binutils
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?
Jethro Beekman
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gold] 2.27 generates GOT where 2.26 did not
2016-08-12 0:31 [gold] 2.27 generates GOT where 2.26 did not Jethro Beekman
@ 2016-08-12 3:10 ` Andrew Pinski
2016-08-12 3:19 ` Jethro Beekman
2016-08-12 3:32 ` Jethro Beekman
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2016-08-12 3:10 UTC (permalink / raw)
To: Jethro Beekman; +Cc: binutils
On Thu, Aug 11, 2016 at 5:31 PM, Jethro Beekman <binutils@jbeekman.nl> 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?
IIRC this is correct behavior for x86_64 due to copy relocs.
Thanks,
Andrew
>
> Jethro Beekman
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gold] 2.27 generates GOT where 2.26 did not
2016-08-12 3:10 ` Andrew Pinski
@ 2016-08-12 3:19 ` Jethro Beekman
0 siblings, 0 replies; 4+ messages in thread
From: Jethro Beekman @ 2016-08-12 3:19 UTC (permalink / raw)
To: Andrew Pinski; +Cc: binutils
On 11-08-16 20:10, Andrew Pinski wrote:
> On Thu, Aug 11, 2016 at 5:31 PM, Jethro Beekman <binutils@jbeekman.nl> wrote:
>> 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?
>
> IIRC this is correct behavior for x86_64 due to copy relocs.
I get the same thing if I pass -Wl,-z,nocopyreloc
Jethro
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gold] 2.27 generates GOT where 2.26 did not
2016-08-12 0:31 [gold] 2.27 generates GOT where 2.26 did not Jethro Beekman
2016-08-12 3:10 ` Andrew Pinski
@ 2016-08-12 3:32 ` Jethro Beekman
1 sibling, 0 replies; 4+ messages in thread
From: Jethro Beekman @ 2016-08-12 3:32 UTC (permalink / raw)
To: binutils
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-12 3:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-12 0:31 [gold] 2.27 generates GOT where 2.26 did not Jethro Beekman
2016-08-12 3:10 ` Andrew Pinski
2016-08-12 3:19 ` Jethro Beekman
2016-08-12 3:32 ` Jethro Beekman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).