[PATCH] D77893: WIP [lld] Merge Mach-O input sections

Kellie Medlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 16:52:39 PDT 2020


Ktwu marked 3 inline comments as done.
Ktwu added inline comments.


================
Comment at: lld/MachO/InputSection.h:49
 
-  ArrayRef<uint8_t> data;
-
-  // TODO these properties ought to live in an OutputSection class.
-  // Move them once available.
   uint64_t addr = 0;
   uint32_t align = 1;
----------------
smeenai wrote:
> LLD ELF has an `outSecOff` in its InputSections, which tracks the offset of this particular section within its output section. I think that'd be better than storing the absolute address in the InputSection.
Interesting, I'll look into that.


================
Comment at: lld/MachO/OutputSection.cpp:20
+uint64_t OutputSection::getFileOffset() const {
+  return parent->fileOff + addr - parent->firstSection()->addr;
+}
----------------
smeenai wrote:
> What's this computation doing?
It's copying what InputSection did to calculate its file offset. I didn't entirely comprehend this math tbh.


================
Comment at: lld/MachO/OutputSegment.cpp:51-52
+    // While creating the output section
+  if (os->isHidden()) {
+    this->numNonHiddenSections++;
+  }
----------------
smeenai wrote:
> Is the check flipped?
Oops, yes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77893





More information about the llvm-commits mailing list