AArch64 LLVM assembler emits add instruction without shift bit to calculate the higher 12-bit address of TLS variables in local exec model. This generates wrong code sequence to access TLS variables with thread offset larger than 0x1000.
Details
- Reviewers
rovka t.p.northover peter.smith - Commits
- rG361615cfd0ce: AArch64: Set shift bit of TLSLE HI12 add instruction
rG6c87f2352626: AArch64: Set shift bit of TLSLE HI12 add instruction
rL282661: AArch64: Set shift bit of TLSLE HI12 add instruction
rL282057: AArch64: Set shift bit of TLSLE HI12 add instruction
Diff Detail
Event Timeline
Could you please add a testcase for this? You can use llvm-objdump -r -d to make sure you got the right encoding and relocation.
The fix itself seems ok. Maybe we should consider doing the same thing for DTPREL? (I'm not sure gcc supports DTPREL atm, but we do, so we should be consistent).
Fix AArch64 test breakage.
FAIL: LLVM::frameindices.ll
FAIL: LLVM::arm64-tls-modifiers-darwin.s
FAIL: LLVM::darwin-reloc-addsubimm.s
Hi Lei,
Did you run "make check-all" with this patch? It seem to have broken on multiple buildbots, ARM, AArch64, PPC, etc.
cheers,
--renato
Hi Renato,
I have run "make check-all" with my latest change (Diff 72029).
Scanning dependencies of target check-all
[100%] Running all regression tests
Testing Time: 215.37s
Expected Passes : 17686 Expected Failures : 124 Unsupported Tests : 222
[100%] Built target check-all
I think it's good now.
lib/Target/AArch64/MCTargetDesc/AArch64MCCodeEmitter.cpp | ||
---|---|---|
268 | I think the intent would be clearer if you folded this check and the cast below into a dyn_cast (http://llvm.org/docs/ProgrammersManual.html#isa). |
Nit: you can move the declaration of A64E in if's condition.
I think this is ok to commit now if it passes check-all.
I think the intent would be clearer if you folded this check and the cast below into a dyn_cast (http://llvm.org/docs/ProgrammersManual.html#isa).