[PATCH] D137819: [XCOFF] support the overflow section (only relocation overflow is handled).

Esme Yi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 19:05:58 PST 2022


Esme added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:1080
+  Sec->FileOffsetToRelocations = RawPointer;
+  uint64_t RelocationSizeInSec = 0;
+  if (!is64Bit() &&
----------------
DiggerLin wrote:
> we do not need introduce a new variable RelocationSizeInSec 
> 
> We can update 
> 
> 
> ```
> RawPointer += OverflowSec.Address * XCOFF::RelocationSerializationSize32;
> ```
> 
> and 
> 
> 
> ```
> RawPointer += Sec->RelocationCount *
>                           (is64Bit() ? XCOFF::RelocationSerializationSize64: XCOFF::RelocationSerializationSize32);
> ```
> directly.
> 
Nice point, but this variable is also used to check whether the primary section has a corresponding overflow section, so I think it is useful to introduce this variable.
`assert(RelocationSizeInSec && "Overflow section header doesn't exist.");`



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137819



More information about the llvm-commits mailing list