[lld] [LLD][COFF] Prevent merging .bss into shared sections (PR #202817)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 09:02:28 PDT 2026


================
@@ -1716,8 +1724,17 @@ void Writer::mergeSections() {
   // whatever section it is being merged into (usually .data) so that the image
   // need not actually contain all of the zeros.
   auto it = ctx.config.merge.find(".bss");
-  if (it != ctx.config.merge.end())
-    mergeSection(*it);
+  if (it != ctx.config.merge.end()) {
+    // Resolve the final merge target name following the chain.
+    StringRef toSection = getMergeDestination(it->first, it->second);
----------------
mstorsjo wrote:

Right, I see...

I guess this form of the code is fine then, thanks for explaining your reasoning!

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


More information about the llvm-commits mailing list