[PATCH] D103696: [XCOFF][AIX] Add support for XCOFF 64 bit Object files
Maryam via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 9 00:41:48 PDT 2021
MaryamBen added inline comments.
================
Comment at: llvm/include/llvm/Object/XCOFFObjectFile.h:263
+struct XCOFFRelocation64 {
+ // Masks for packing/unpacking the r_rsize field of relocations.
----------------
sfertile wrote:
> jhenderson wrote:
> > It would be preferable if we didn't duplicate nearly the entire contents of the 32-bit version of this struct. Could you have a single generic version which stores the virtual address in the larger field, and then just write it out to the right size at the appropriate time?
> As an alternate, why don't we take the same approach as the section headers. For Relocations we would have a base class that can implement everything, and simply have a template parameter for the type of the VirtualAddress field. That will simplify the llvm-readobj XCOFF dumper changes in this patch nicely, and keeps the relocation implementation consistent with the other parts of this class.
Yeah, it would be great if I were able to do it, especially that the only difference is the size of VirtualAddress (32-bit/64-bit).
I have done this because in function relocation32 they read relocations from memory and save them into an array of XCOFFRelocation32, so the structure must match the content of memory.
```
static_assert(
sizeof(XCOFFRelocation32) == XCOFF::RelocationSerializationSize32, "");
auto RelocationOrErr =
getObject<XCOFFRelocation32>(Data, reinterpret_cast<void *>(RelocAddr),
NumRelocEntries * sizeof(XCOFFRelocation32));
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103696/new/
https://reviews.llvm.org/D103696
More information about the llvm-commits
mailing list