This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR gold/21430 Fix misplacement of a relaxed section on AArch64


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]