[PATCH] D77424: [XCOFF][AIX] Relocation support for SymB
Digger via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 8 05:55:35 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;
----------------
DiggerLin wrote:
> 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) ?
>
>
please ignore above question. I got it . the value in the address 0x58 is .text+imm64-.rodata.
So imm64 = value in the address 0x58 + .rodata -.text
when relocation.
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