[lld] [llvm] [Coverage][WebAssembly] Keep InstrProf segments during gc (PR #172023)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 18:13:38 PST 2025


================
@@ -181,7 +192,7 @@ void markLive() {
         if (!c->live)
           message("removing unused section " + toString(c));
       for (InputChunk *c : obj->segments)
-        if (!c->live)
+        if (!c->live && !c->isInstrProfSegment)
----------------
Spxg wrote:

`__llvm_covfun` stores the mapping from <fn name hash> to profile, while `__llvm_prf_names` stores the actual fn names. When `llvm-cov` processes `__llvm_covfun`, it looks up function names from `__llvm_prf_names`.

I found that `wasm-ld` retains the `__llvm_covfun` section from a "not live" object, but discards `__llvm_prf_names`, causing the failure:
 
```sh
` __llvm_prf_names` -> `hash(name) to name` map, PrfMap eg.
 `__llvm_covfun` -> iterate -> PrfMap.looksUp(hashValue) -> malformed if not found
```





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


More information about the llvm-commits mailing list