This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] [lld] Exclude COMDAT sections
ClosedPublic

Authored by dschuff on Dec 9 2020, 10:59 AM.

Details

Summary

Allow exclusion/discarding of custom sections with COMDAT groups.
It piggybacks on the existing COMDAT-handling code, but applies to custom sections as well.

Diff Detail

Event Timeline

dschuff created this revision.Dec 9 2020, 10:59 AM
dschuff updated this revision to Diff 310973.Dec 10 2020, 11:57 AM
  • add tests
dschuff updated this revision to Diff 310981.Dec 10 2020, 12:23 PM
  • update. sections seem to work, functions fishy

lgtm... Aside from the broken test.

lld/wasm/InputFiles.cpp
438

Remove debugging?

494

But the assert above shows that all section symbols are by definition local binding. You can't ever reference section symbol from another object file.. they are always internal to given object.

dschuff updated this revision to Diff 311033.Dec 10 2020, 2:51 PM
  • rebase, remove debug print and don't test functions
dschuff retitled this revision from [WIP] WebAssembly Linker change for COMDAT sections to WebAssembly Linker change for COMDAT sections.Dec 10 2020, 2:52 PM
dschuff edited the summary of this revision. (Show Details)
dschuff retitled this revision from WebAssembly Linker change for COMDAT sections to [WebAssembly] [lld] Exclude COMDAT sections.
dschuff edited the summary of this revision. (Show Details)
dschuff published this revision for review.Dec 10 2020, 2:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 10 2020, 2:53 PM

I found that comdat functions seem to be getting double-included (i.e. not properly excluded) when using --no-gc-sections (independently of whether the object originates from llc or from assembly). I removed the checks that test functions and made them only test the section behavior. We can fix functions in a follow-up.

sbc100 accepted this revision.Dec 10 2020, 3:01 PM
This revision is now accepted and ready to land.Dec 10 2020, 3:01 PM
This revision was landed with ongoing or failed builds.Dec 10 2020, 5:49 PM
This revision was automatically updated to reflect the committed changes.