[PATCH] D101703: [lld][WebAssembly] Do not merge comdat data segments

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 1 16:12:37 PDT 2021


sbc100 created this revision.
Herald added subscribers: wingo, ecnelises, sunfish, hiraditya, jgravelle-google, dschuff.
sbc100 requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

When running in relocatable mode any input data segments that are part
of a comdat group should not be merged with other segments of the same
name.  This is because the final linker needs to keep the separate so
they can be included/excluded individually.

Often this is not a problem since normally only one section with a given
name `foo` ends up in the output object file.  However, the problem
occurs when one input contains `foo` which part of a comdat and another
object contains a local symbol `foo` we were attempting to merge them.

This behaviour matches (I believe) that of the ELF linker.  See
`LinkerScript.cpp:addInputSec`.

Fixes: https://github.com/emscripten-core/emscripten/issues/9726


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101703

Files:
  lld/test/wasm/Inputs/comdat-data.s
  lld/test/wasm/relocatable-comdat.s
  lld/wasm/Writer.cpp
  llvm/lib/Object/WasmObjectFile.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101703.342184.patch
Type: text/x-patch
Size: 5299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210501/69f3795e/attachment.bin>


More information about the llvm-commits mailing list