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

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 02:19:59 PST 2022


shchenz added a comment.

Looks great! I also did some functionality test related to -g/-ffunction-sections, all look good.



================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:1064
+    SecEntry.Index = ++SectionCount;
+    OverflowSections.push_back(SecEntry);
+
----------------
Can we use `push_back(std::move(SecEntry))`?


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:1085
+    for (auto &OverflowSec : OverflowSections) {
+      if (OverflowSec.RelocationCount == static_cast<uint32_t>(Sec->Index)) {
+        RelocationSizeInSec =
----------------
Can we add a field in `SectionEntry` struct to indicate the related overflow section index, so that we don't need the loop here? For example a new field about index to vector `OverflowSec`?


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:1155
+    RawPointer +=
+        alignTo(CurrAddress,
+                (*DwarfSections.begin()).DwarfSect->MCSec->getAlign()) -
----------------
We don't need the `CurrAddress` here, we can just use the `Sections.back()->Address + Sections.back()->Size`.


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