From: Andrew Pinski <pinskia@gmail.com>
To: Jethro Beekman <binutils@jbeekman.nl>
Cc: binutils <binutils@sourceware.org>
Subject: Re: [gold] 2.27 generates GOT where 2.26 did not
Date: Fri, 12 Aug 2016 03:10:00 -0000 [thread overview]
Message-ID: <CA+=Sn1nwNN0D2pAcv4ABEsp4qcvSAR1Z5umszFhz2sTj5F80-Q@mail.gmail.com> (raw)
In-Reply-To: <dd6f4d4b-5f5f-459c-8c3b-955f6c329233@jbeekman.nl>
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
next prev parent reply other threads:[~2016-08-12 3:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-12 0:31 Jethro Beekman
2016-08-12 3:10 ` Andrew Pinski [this message]
2016-08-12 3:19 ` Jethro Beekman
2016-08-12 3:32 ` Jethro Beekman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+=Sn1nwNN0D2pAcv4ABEsp4qcvSAR1Z5umszFhz2sTj5F80-Q@mail.gmail.com' \
--to=pinskia@gmail.com \
--cc=binutils@jbeekman.nl \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).