[LLVMdev] [lld] Wrong references for C++ COMDAT groups
Adhemerval Zanella
adhemerval.zanella at linaro.org
Wed May 6 07:43:40 PDT 2015
Hi,
Checking the llvm test-suite SingleSource/Regression/C++/EH/class_hierarchy
testcase on aarch64 I noted something strange:
Dump of assembler code for function _Z4funcj:
0x0000000000400650 <+0>: stp x22, x21, [sp,#-48]!
0x0000000000400654 <+4>: stp x20, x19, [sp,#16]
0x0000000000400658 <+8>: stp x29, x30, [sp,#32]
0x000000000040065c <+12>: add x29, sp, #0x20
=> 0x0000000000400660 <+16>: .inst 0x2bfffff7 ; undefined
Where it should be:
0000000000000000 <_Z4funcj>:
0: a9bd57f6 stp x22, x21, [sp,#-48]!
4: a9014ff4 stp x20, x19, [sp,#16]
8: a9027bfd stp x29, x30, [sp,#32]
c: 910083fd add x29, sp, #0x20
10: 2a0003f3 mov w19, w0
And there is no relocation (static or dynamic) point to the faulty instruction.
It exist, however, a group section relocation with same offset, but for a
different text segments (the exception handler stub create by clang):
Relocation section '.rela.text' at offset 0xed8 contains 2 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000010 00480000011b R_AARCH64_CALL26 0000000000000000 _ZNSt9exceptionD2Ev + 0
000000000020 004d0000011a R_AARCH64_JUMP26 0000000000000000 _ZdlPv + 0
Relocation section '.rela.text' at offset 0xf08 contains 2 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000010 00480000011b R_AARCH64_CALL26 0000000000000000 _ZNSt9exceptionD2Ev + 0
000000000020 004d0000011a R_AARCH64_JUMP26 0000000000000000 _ZdlPv + 0
Relocation section '.rela.text' at offset 0xf38 contains 2 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000010 00480000011b R_AARCH64_CALL26 0000000000000000 _ZNSt9exceptionD2Ev + 0
000000000020 004d0000011a R_AARCH64_JUMP26 0000000000000000 _ZdlPv + 0
However seems that LLD is indeed condescending them, but create duplicated references
for the wrong segments:
Writing atom: _Z4funcj | 1520
Handle relocJump26 - S: 400460 A: 0 P: 400660 result: 3ffff98
Handle relocJump26 - S: 400470 A: 0 P: 400670 result: 3ffff98
The first relocJump26 shouldn't be applied to .text segment 0x400660, but solely on the
_ZN4BaseD0Ev section. I am trying to debug how lld exactly is generating this wrong
Reference, but I still can right figure out. Any idea of what is happening here?
More information about the llvm-dev
mailing list