[PATCH] [PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIE

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

[PATCH] [PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIE

Szabolcs Nagy-2
With static PIE linking undefined weak symbols are resolved to 0, so no
dynamic relocation is needed for them. The UNDEFWEAK_NO_DYNAMIC_RELOC
macro was introduced so this case can be handled easily, but it was not
applied consistently in the first attempt to fix ld/22269 for arm:

  commit 95b03e4ad68e7a90f5096b47df595636344b783a
  arm: Check UNDEFWEAK_NO_DYNAMIC_RELOC

This patch fixes spurious relative relocs in static PIE binaries against
GOT entries created for undefined weak symbols on arm*-*, this fixes

FAIL: pr22269-1 (static pie undefined weak)

bfd/ChangeLog:

2020-01-10  Szabolcs Nagy  <[hidden email]>

        PR ld/22269
        * elf32-arm.c (elf32_arm_final_link_relocate): Use
        UNDEFWEAK_NO_DYNAMIC_RELOC.
        (allocate_dynrelocs_for_symbol): Likewise.

0001-PR-ld-22269-arm-Avoid-dynamic-relocs-for-undefweak-s.diff (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] [PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIE

Nick Clifton
Hi Szabolcs,

> bfd/ChangeLog:
> 2020-01-10  Szabolcs Nagy  <[hidden email]>
>
> PR ld/22269
> * elf32-arm.c (elf32_arm_final_link_relocate): Use
> UNDEFWEAK_NO_DYNAMIC_RELOC.
> (allocate_dynrelocs_for_symbol): Likewise.

Approved - please apply.

Cheers
  Nick


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] [PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIE

Szabolcs Nagy-2
On 10/01/2020 12:58, Nick Clifton wrote:

> Hi Szabolcs,
>
>> bfd/ChangeLog:
>> 2020-01-10  Szabolcs Nagy  <[hidden email]>
>>
>> PR ld/22269
>> * elf32-arm.c (elf32_arm_final_link_relocate): Use
>> UNDEFWEAK_NO_DYNAMIC_RELOC.
>> (allocate_dynrelocs_for_symbol): Likewise.
>
> Approved - please apply.

thanks,
can i backport it to 2.33 (after some testing on master),
is that branch still open?
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] [PR ld/22269] arm: Avoid dynamic relocs for undefweak symbols in static PIE

Nick Clifton
Hi Szabolcs,

> can i backport it to 2.33 (after some testing on master),
> is that branch still open?

Yes and yes.

Cheers
  Nick