[PATCH 2/3] Revert "[AArch64][BZ #17711] Fix extern protected data handling"
maskray@google.com
maskray@google.com
Tue May 24 17:28:28 GMT 2022
On 2022-05-24, Wilco Dijkstra wrote:
>Hi,
Hi Wilco,
>>> * Clang code generation treats STV_PROTECTED the same way as STV_HIDDEN:
>>> no GOT-generating relocation in the first place.
>
>We should change GCC's behaviour to match this - is this something that
>applies to all targets?
I have a blog post on the topic about copy relocations and protected
symbols:
https://maskray.me/blog/2021-01-09-copy-relocations-canonical-plt-entries-and-protected
"The GCC pessimization applies to all ports with #define TARGET_BINDS_LOCAL_P default_binds_local_p_2."
The aarch64 pessimization was due to the side affect of a commit
attempting to fix another issue: commit
cbddf64c0243816b45e6680754a251c603245dbc (From-SVN: r222992)
>>> * gold and lld reject copy relocation on a STV_PROTECTED symbol.
>>> * Nowadays -fpie/-fpic modes are popular. GCC/Clang's codegen uses
>>> GOT-generating relocation when accessing an default visibility
>>> external symbol which avoids copy relocation.
>
>Would it be reasonable to add a way to override settings for binaries?
>For example if all imported symbols are marked with the correct visibility,
>PIE binaries could avoid using GOT for default visibility external symbols to
>get better performance. And non-PIE binaries could force GOT accesses for
>non-default visibility to avoid copy relocations and support protected visibility.
In Clang, -fno-direct-access-external-data is such an option:)
---
Regarding function symbols, there is a bit which should be fixed:
"Protected function symbols and canonical PLT entries"
More information about the Libc-alpha
mailing list