[lld] [lld-macho] Fix bug in makeSyntheticInputSection when -dead_strip flag is specified (PR #86878)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 15:55:53 PDT 2024


================
@@ -281,6 +281,7 @@ ConcatInputSection *macho::makeSyntheticInputSection(StringRef segName,
   Section &section =
       *make<Section>(/*file=*/nullptr, segName, sectName, flags, /*addr=*/0);
   auto isec = make<ConcatInputSection>(section, data, align);
+  isec->live = true;
----------------
kyulee-com wrote:

Looking at the call-sites of `makeSyntheticInputSection`, there appear 3 cases so far where one of them (`SyntheticSection` constructor) didn't set this value, which this patch would fix. But the other two cases would become redundant as the liveness is set here.
I think setting this liveness here for a synthetic section case makes sense, which is meant to be synthesized as needed.  Would you add a comment explicitly on the definition of  `makeSyntheticInputSection`? Also would you delete setting the liveness in the other two cases?

https://github.com/llvm/llvm-project/pull/86878


More information about the llvm-commits mailing list