[PATCH] D102964: [lld-macho] Implement cstring merging / deduplication

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 21 21:00:19 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/Writer.cpp:936
     auto it = mergedOutputSections.find({ssec->segname, ssec->name});
-    if (it == mergedOutputSections.end()) {
-      if (ssec->isNeeded())
+    if (ssec->isNeeded()) {
+      if (it == mergedOutputSections.end()) {
----------------
An earlier implementation of this diff always created the CStringLiteralSection, even if literal merging was disabled. I therefore hoisted out this check to avoid having a conflict between the unneeded CStringLiteralSection and the actual ConcatOutputSection when literal merging was not being done.

We now only create the CStringLiteralSection as-needed, so this is likely unnecessary. However, I think it still makes sense to avoid unnecessary section name conflicts, so I've left it in.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102964



More information about the llvm-commits mailing list