[PATCH] D129830: [lld-macho] Support folding of functions with identical LSDAs

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 18 07:41:47 PDT 2022


thakis accepted this revision.
thakis added a comment.
This revision is now accepted and ready to land.

lg, i think



================
Comment at: lld/MachO/InputFiles.cpp:1189
     ConcatInputSection *isec = cast<ConcatInputSection>(subsection.isec);
-    // Hack!! Since each CUE contains a different function address, if ICF
-    // operated naively and compared the entire contents of each CUE, entries
-    // with identical unwind info but belonging to different functions would
-    // never be considered equivalent. To work around this problem, we slice
-    // away the function address here. (Note that we do not adjust the offsets
-    // of the corresponding relocations.) We rely on `relocateCompactUnwind()`
-    // to correctly handle these truncated input sections.
-    isec->data = isec->data.slice(target->wordSize);
+    // Hack!! Each CUE has its UNSIGNED relocations embed their addends in its
+    // data. Thus if ICF operated naively and compared the entire contents of
----------------
nit: maybe spell out CUE once? afaict nothing in lld/MachO spells it out (I assume it's "compact unwind entry", but it's not totally obvious imho)


================
Comment at: lld/MachO/InputFiles.cpp:1195
+    // addends. In particular, we remove the function address and LSDA pointers.
+    // Since these locations at all at the start and end of the entry, we can
+    // do this using a simple, efficient slice rather than performing a copy.
----------------
s/at all/are all/


================
Comment at: lld/MachO/InputSection.cpp:349
+bool macho::isGccExceptTabSection(const InputSection *isec) {
+  return isec->getName() == section_names:: gccExceptTab &&
+         isec->getSegName() == segment_names::text;
----------------
clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129830



More information about the llvm-commits mailing list