-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ELF COMDAT needed for templates to enable linker data culling #3589
Comments
ljmf00-wekaio
added a commit
to ljmf00-wekaio/ldc
that referenced
this issue
Sep 7, 2024
…inker data culling
I've quickly tested the testcase on Ubuntu 22, with the bfd/gold/lld linkers (default distro versions). Differences:
|
kinke
added a commit
to kinke/ldc
that referenced
this issue
Sep 7, 2024
kinke
added a commit
to kinke/ldc
that referenced
this issue
Sep 7, 2024
Fixed by #4748. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PR #3424 disabled COMDAT for ELF, which had an (obscure) side-effect that hurts a particular use case at Weka: it prevents unused data culling in a section when that section is accessed using the magic
__start_*
and__stop_*
linker symbols.The test case (4 files):
Build steps:
Objdump shows the problem. This is the output with and without COMDAT for the symbols in ELF (
objdump --section-headers --section test_section test
):Without COMDAT: the symbols are merged, the pointers
a
,b
, andc
are all the same, but the unused pre-merge data remains and the size of test_section is0xc
= 3 integers.With COMDAT: the symbols are merged, the pointers
a
,b
, andc
are all the same, and the unused data is removed and the size of test_section is0x4
= 1 integers.I don't know of another way to prevent the linker from stripping unreferenced symbols other than
__start_
/__stop_
.The text was updated successfully, but these errors were encountered: