[lld] [lld][ELF] Allow Arm PC-relative relocations in pic or shared library (PR #77304)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 10:08:38 PST 2024


https://github.com/smithp35 commented:

Mentioning this here in case this does not fix the BSD problem. LLD will still give an error message if the relocation is to a pre-emptible symbol (.global in a --shared link). Strictly speaking this is correct as the global can be preempted and the R_ARM_PCA won't generate a dynamic relocation, which could lead to problems if the symbol is preempted.

I'm hoping that if this is the case the BSD case can use hidden visibility for the symbol, which will make it non-pre-emptible.

Adding R_ARM_PCA to the expressions that always calculate static link time constants in https://github.com/llvm/llvm-project/blob/main/lld/ELF/Relocations.cpp#L972 would permit its use to globals in shared libraries, but would be at risk of bugs if the symbol were pre-empted.



https://github.com/llvm/llvm-project/pull/77304


More information about the llvm-commits mailing list