[PATCH] D84549: [XCOFF][AIX] Support relocation generation for large code model

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 08:29:06 PDT 2020


jasonliu added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:434
     // The FixedValue should be the TC entry offset from TOC-base.
     FixedValue = SectionMap[SymASec]->Address - TOCCsects.front().Address;
 
----------------
DiggerLin wrote:
> jasonliu wrote:
> > DiggerLin wrote:
> > > I am not sure whether I understand is correct or not ?
> > > FixedValue of intructions
> > > addis 3, L..C0 at u(2) . FixedValue should get the high 16bits of SectionMap[SymASec]->Address - TOCCsects.front().Address;
> > > 
> > > lwz 3, L..C0 at l(3) FixedValue should get the low 16bits of SectionMap[SymASec]->Address - TOCCsects.front().Address;
> > > 
> > > if I understand correct , the code need to change.
> > > 
> > > 
> > > 
> > Could you give an example that would generated non-0 FixedValue in TOCU position?
> > The example (the test case I have below) I tried before, TOCU position always have 0 as its FixedValue with system assembler generated object.
>   ```1ae98: 3c 62 00 01                   addis 3, 2, 1
>                         0001ae9a:  R_TOCU       (idx: 36364) a10995[TE]
>    1ae9c: 80 63 8d f8                   lwz 3, -29192(3)
>                         0001ae9e:  R_TOCL       (idx: 36364) a10995[TE]
>    1aea0: 90 83 00 00                   stw 4, 0(3)
>    1aea4: 3c 62 00 01                   addis 3, 2, 1
>                         0001aea6:  R_TOCU       (idx: 36366) a10996[TE]
>    1aea8: 80 63 8d fc                   lwz 3, -29188(3)
>                         0001aeaa:  R_TOCL       (idx: 36366) a10996[TE]
>    1aeac: 90 83 00 00                   stw 4, 0(3)
>    1aeb0: 3c 62 00 01                   addis 3, 2, 1
> ```
It seems the system as would generate a non-0 FixedValue for you when your TOC region is larger than 64KB.
But xlclang (which do not use system as to generate object) would always generate 0 for the TOCU region, and linker would know how to change the fix-up '0' to the proper value that points to the correct TOC entry.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84549/new/

https://reviews.llvm.org/D84549



More information about the llvm-commits mailing list