[PATCH] D46204: [PPC64] V2 abi: Emit plt call stubs to the text section rather then the plt section.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 30 21:30:55 PDT 2018
MaskRay added inline comments.
================
Comment at: lld/trunk/ELF/InputSection.cpp:746
+ if (Rel.Sym->NeedsTocRestore) {
+ if (BufLoc + 8 > BufEnd || read32(BufLoc + 4) != 0x60000000) {
+ error(getErrorLocation(BufLoc) + "call lacks nop, can't restore toc");
----------------
sfertile wrote:
> MaskRay wrote:
> > If the file was compiled with `gcc -Bsymbolic -fPIC`, there may not be a `nop` after `bl`.
> > If the symbol also requires a PLT (its `NeedsTocRestore` will be true), this check will fail.
> Hi @MaskRay are you using `-Bsymbolic` in the linker options as well?
I get a better example.
1. Download https://packages.debian.org/jessie/ppc64el/libstdc++-4.9-dev/download
2. Unpack with 7z then `tar xf data.tar`
3. ar x ./usr/lib/gcc/powerpc64le-linux-gnu/4.9/libstdc++.a locale.o
llvm-objdump -d -r locale.o
```
_ZNKSt6locale2id5_M_idEv:
......
b8: 01 00 00 48 bl .+0
00000000000000b8: R_PPC64_REL24 _ZNKSt6locale2id5_M_idEv
bc: 01 00 23 39 addi 9, 3, 1 //////////// there is no nop here
```
If the symbol `_ZNKSt6locale2id5_M_idEv` has `NeedsTocRestore` set, this will fail to link, right?
I have checked newer versions, e.g. 5.5 6.4 6.8 they don't have such weird `bl` instruction. I don't know if this was a bug when producing locale.o
Repository:
rL LLVM
https://reviews.llvm.org/D46204
More information about the llvm-commits
mailing list