There was an instance of a third-party archive containing multiple
_llvm symbols from different files that clashed with each other
producing duplicate symbols. Symbols under the LLVM segment
don't seem to be producing any meaningful value, so just ignore them.
Details
- Reviewers
gkm int3 - Group Reviewers
Restricted Project - Commits
- rG15dc93e61c21: [lld-macho] Ignore LLVM segments to prevent duplicate syms
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lld/test/MachO/ignore-symbols.s | ||
---|---|---|
11–17 | How does ld64 deal with this, though? (quick glance at the code, I didn't see any special handling for _llvm segments) Just concerned that this change is hiding a bug somewhere else |
lld/MachO/InputFiles.cpp | ||
---|---|---|
294 | I would say that ld64 does not appear to emit contents from sections within the __LLVM segment, and that the symbols in those sections point to bitcode metadata rather than being actual symbols. In particular, global symbols within those sections can have the same name without causing duplicate symbol errors. maybe also add a TODO to figure out if we are supposed to do anything useful with said metadata... | |
lld/test/MachO/ignore-symbols.s | ||
6–8 | we need to test a few more things:
(test should be retitled too, something like discard-llvm-sections.s) | |
11–17 | see ld64's LLVMBitcode class :) |
lld/test/MachO/ignore-symbols.s | ||
---|---|---|
11–17 | Ah, I see. Thanks! |
lgtm
lld/test/MachO/discard-llvm-sections.s | ||
---|---|---|
6 ↗ | (On Diff #366663) | nit |
18 ↗ | (On Diff #366663) | looks like the windows test is failing as the address is slightly different there. We should probably figure out why at some point, but since it's not really important to this test we can just match any hex value |
lld/MachO/InputFiles.cpp | ||
---|---|---|
283–285 | I realized that we are now constructing isec here redundantly whenever we have an __LLVM section. Can you fix things so that we only construct the isec when it actually gets used? |
lld/test/MachO/discard-llvm-sections.s | ||
---|---|---|
26 ↗ | (On Diff #366716) | The convention is not to add a prefix before error: so I dropped it in f74b70ef57fd038e9e6a781ef5cc72bb9734abe4 |
I realized that we are now constructing isec here redundantly whenever we have an __LLVM section. Can you fix things so that we only construct the isec when it actually gets used?