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

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 12:50:13 PDT 2020


int3 added inline comments.


================
Comment at: lld/MachO/OutputSection.cpp:20
+uint64_t OutputSection::getFileOffset() const {
+  return parent->fileOff + addr - parent->firstSection()->addr;
+}
----------------
smeenai wrote:
> Ktwu wrote:
> > 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.
> Okay, this makes sense.
The parent segment's start address is defined as the address of the first section it contains. So `addr - parent->firstSection()->addr` computes the section's offset within the segment. Maybe we don't need this any more if we have `outSecOff` (going to investigate)


================
Comment at: lld/MachO/OutputSection.cpp:34
+
+  this->hidden |= input->isHidden();
+  this->inputs.push_back(input);
----------------
smeenai wrote:
> Can you add a TODO for figuring out how we should handle input sections with conflicting hidden-ness?
Personally I don't think we should support hidden InputSections until we find a use case (I'm not aware of one so far)


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