[lld] [Coverage][WebAssembly] Discard InstrProf sections if object not live (PR #172023)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 13 10:39:17 PST 2025


================
@@ -153,6 +154,12 @@ void Writer::calculateCustomSections() {
       // Strip debug section in that option was specified.
       if (stripDebug && name.starts_with(".debug_"))
         continue;
+      // If the object is not live, discard `__llvm_covfun` and `__llvm_covmap`
+      // sections since `__llvm_prf_*` segments have already been discarded.
+      if (!file->isLive() &&
+          (name == getInstrProfSectionName(IPSK_covfun, Triple::Wasm) ||
+           name == getInstrProfSectionName(IPSK_covmap, Triple::Wasm)))
+        continue;
----------------
sbc100 wrote:

Hmm.. I wonder if we can just add `if (!file->isLive()) continue` to the outer loop here.   At least there are no failing tests when I do this locally.

It seem pretty odd to be including any custom sections form object files that are not live.

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


More information about the llvm-commits mailing list