This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR gold/21430 Fix misplacement of a relaxed section on AArch64
- From: "Han Shen via binutils" <binutils at sourceware dot org>
- To: Igor Kudrin <ikudrin at accesssoftek dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>, Cary Coutant <ccoutant at gmail dot com>
- Date: Sun, 30 Apr 2017 08:39:27 -0700
- Subject: Re: [PATCH] PR gold/21430 Fix misplacement of a relaxed section on AArch64
- Authentication-results: sourceware.org; auth=none
- References: <1493226123912.87542@accesssoftek.com>
- Reply-to: Han Shen <shenhan at google dot com>
Hi Igor, thanks for quick fixing this. This looks good to me. Waiting
for Cary's review & approval.
Thanks,
Han
On Wed, Apr 26, 2017 at 10:01 AM, Igor Kudrin <ikudrin@accesssoftek.com> wrote:
> Hi,
>
> When linking a large executable file for AArch64, gold might put a relaxed
> section to a wrong position.
>
> Here is a simplified reproducer:
>
> $ cat > test.s << EOF
> .globl _start, foo, bar
>
> .section ".text.start", "ax"
> _start:
> bl foo
> .space 0x7000000
>
> .section ".text.bar", "ax"
> bar:
> .space 0x1000000
> .size bar, .-bar
>
> .section ".text.foo", "ax"
> foo:
> b _start
> EOF
> $ aarch64-linux-gnu-as test.s -o test.o
> $ ./gold-master test.o -o test.out
> $ nm -S test.out | grep "foo\|bar"
> 00000000074000c4 0000000001000000 T bar
> 00000000084000b4 T foo
>
> As you can see, the address for 'foo' lays inside 'bar', and so does
> the content of its section.
>
> See also https://sourceware.org/bugzilla/show_bug.cgi?id=21430.
>
> Best regards,
> Igor Kudrin
>
> ---
> gold/ChangeLog
>
> * aarch64.cc
> (AArch64_relobj::convert_input_section_to_relaxed_section):
> Set the section offset to -1ULL.
> (Target_aarch64::relocate_section): Adjust the view in case
> of a relaxed input section.
> * testsuite/Makefile.am (pr21430): New test.
> * testsuite/Makefile.in: Regenerate
> * testsuite/pr21430.s: New test source file.
> * testsuite/pr21430.sh: New test script.
--
Han Shen | Software Engineer | shenhan@google.com | +1-650-440-3330