[PATCH] D87199: [lld-macho] Implement support for PIC

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 23:25:59 PDT 2020


gkm added inline comments.


================
Comment at: lld/MachO/Writer.cpp:350-352
+        assert(r.referent.is<InputSection *>());
+        if (!r.pcrel)
+          in.rebase->addEntry(isec, r.offset);
----------------
smeenai wrote:
> gkm wrote:
> > Without checking godbolt, I boldly assume that the computation for the string compare will be hoisted out of the inner loop. Please add a testcase for mixing `-pie` and compact unwind.
> There's gonna be lots of relocations, so it's probably worth confirming that the hoisting happens :)
> 
> The section comparison seems fine for now, but it also seems a bit janky. Is there any long-term redesign we could do here to make it cleaner? We should add a TODO somewhere if so to keep track of it.
> The section comparison seems fine for now, but it also seems a bit janky. Is there any long-term redesign we could do here to make it cleaner? We should add a TODO somewhere if so to keep track of it.

What springs to mind is a flag indicating that an `InputSection` (or its parent `MergedOutputSection`) will not be written to the output file. We can add `S_COMPACT_UNWIND` to `enum SectionType`, which is cheaper to check than string compare on the name. And/or we can add an attribute `S_ATTR_TEMPORARY` or `S_ATTR_INTERNAL` or some such, indicating an input section is for internal use and not destined for output. The attribute will not be set on compact unwind sections with `-r`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87199



More information about the llvm-commits mailing list