[PATCH] D77424: [XCOFF][AIX] Relocation support for SymB
Digger via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 7 14:43:38 PDT 2020
DiggerLin added inline comments.
================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:462
+ // SymB must be R_NEG here, given the general form of Target(MCValue) is
+ // "SymbolA - SymbolB + imm64".
+ const uint8_t TypeB = XCOFF::RelocationType::R_NEG;
----------------
I have question on the "SymbolA - SymbolB + imm64"
for example: in the assembly of the test case
```
.csect .text[PR]
.foo:
# %bb.0: # %entry
li 4, 0
cmplwi 3, 3
stw 3, -8(1)
stw 4, -12(1)
bgt 0, LBB0_5
# %bb.1: # %entry
lwz 4, LC0(2)
slwi 3, 3, 2
lwzx 3, 3, 4
add 3, 3, 4
mtctr 3
bctr
LBB0_2: # %sw.bb1
li 3, 1
b LBB0_6
.......
........
.csect .rodata[RO]
.align 2
.LJTI0_0: (symb)
.long LBB0_2-.LJTI0_0
```
the address of LBB0_2 is 44 (0x2C) .
the value in the
00000058 <.rodata>:
58: ff ff ff d4 .long 0xffffffd4 (-0x2C)
58: R_POS .text
58: R_NEG .rodata-0x58
the jump address
.text+imm64 (-0x2C) - (0x58) =0x84 + LC0(R2). it not correct
I think the content of in the address of the first bytes .csect .rodata[RO] after link in should be
.text - imm64(-0X2C)-(0X58) = -0X2C + LC0(R2) ?
================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:463
+ // "SymbolA - SymbolB + imm64".
+ const uint8_t TypeB = XCOFF::RelocationType::R_NEG;
+ XCOFFRelocation RelocB = {IndexB, FixupOffsetInCsect, SignAndSize, TypeB};
----------------
what about use XCOFF::RelocationType type instead of uint8_t ?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77424/new/
https://reviews.llvm.org/D77424
More information about the llvm-commits
mailing list