This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Do not merge comdat data segments
ClosedPublic

Authored by sbc100 on May 1 2021, 4:12 PM.

Details

Summary

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

Diff Detail

Event Timeline

sbc100 created this revision.May 1 2021, 4:12 PM
sbc100 requested review of this revision.May 1 2021, 4:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2021, 4:12 PM
dschuff accepted this revision.May 3 2021, 1:59 PM
dschuff added inline comments.
lld/test/wasm/relocatable-comdat.s
21
This revision is now accepted and ready to land.May 3 2021, 1:59 PM
sbc100 updated this revision to Diff 342591.May 3 2021, 4:41 PM
  • feedback
This revision was landed with ongoing or failed builds.May 3 2021, 4:44 PM
This revision was automatically updated to reflect the committed changes.