[PR20402][LD][AARCH64]Don't emit RELATIVE relocation for absolute symbols which are resolved at static linking time.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PR20402][LD][AARCH64]Don't emit RELATIVE relocation for absolute symbols which are resolved at static linking time.

Renlin Li-2
Hi all,

For absolute symbols which are forced local or not dynamic, the ABS relocation
should be resolved at static linking time.

Originally, an RELATIVE/ABS relocation will be generated even for absolution symbols
for the dynamic linker to resolve.

For the testcase with the patch, before the change, two R_AARCH64_RELATIV relocations
will be generated.

The relocation will be changed into R_AARCH64_NONE.  It is not possible to
remove the relocations totally.
At the time of allocating dynamic relocs space, the symbol information is not
finalized. It is not safe to not allocating space for the relocation with the
information available at that time.

For example, symbol agasint '.' will be initially defined in ABS section, but
later updated as section relative symbol. A relocation is needed for this case.

For _GLOBAL_OFFSET_TABLE_ and _DYNAMIC symbols, they are initially created as section relative
and forced local. So for those two symbol, a RELATIVE relocation will be generated.
They are later marked as absolute. This behavior is not changed with the patch here.

aarch64 binutils cross/native regression test Okay. Linux kernel link Okay.
Okay to commit?

Regards,
Renlin

bfd/ChangeLog:

2018-02-06  Renlin Li  <[hidden email]>

         PR ld/20402
        * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Check absolute symbol,
         and don't emit relocation in specific case.

ld/ChangeLog:

2018-02-06  Renlin Li  <[hidden email]>

         PR ld/20402
        * testsuite/ld-aarch64/aarch64-elf.exp: Run new test.
        * testsuite/ld-aarch64/pr20402.s: New.
        * testsuite/ld-aarch64/pr20402.d: New.

rb.patch (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PR20402][LD][AARCH64]Don't emit RELATIVE relocation for absolute symbols which are resolved at static linking time.

Nick Clifton
Hi Renlin,

> bfd/ChangeLog:
>
> 2018-02-06  Renlin Li  <[hidden email]>
>
>         PR ld/20402
>     * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Check absolute symbol,
>         and don't emit relocation in specific case.
>
> ld/ChangeLog:
>
> 2018-02-06  Renlin Li  <[hidden email]>
>
>         PR ld/20402
>     * testsuite/ld-aarch64/aarch64-elf.exp: Run new test.
>     * testsuite/ld-aarch64/pr20402.s: New.
>     * testsuite/ld-aarch64/pr20402.d: New.

Approved - please apply.

Cheers
  Nick