-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[lld/mac] Crash with thinlto and --start-lib / --end-lib #59162
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
Comments
I'm not an LTO expert, but it looks surprising to me that shell_crash_reporter_client.o has
|
(On the third hand, this same link completes without problems when using thin archives instead of |
adding @MaskRay since he implemented |
@llvm/issue-subscribers-lld-macho |
From
From
As far as I know, So the vtable is an undef external in the actual bitcode, but it's defined in the index (?) That seems surprising, but maybe it's normal? (@pcc too because thinlto) Anyways, llvm-nm uses SymbolicFile and IRObjectFile just gets the symbols from all the file's modules, which explains why |
Other symbols in that file are also present twice, but for others the defined symbol comes before the undefined one (i.e. the definition is in the main bitcode file, instead of in the index.) |
Note to self: clang calls lld calls into |
Looks like it's normal that the vtable def goes in the index:
|
Here's a reduced repro:
|
This is almost certainly the right fix:
|
https://reviews.llvm.org/D139199 is that plus a test. The test asserts with out the fix but not with it, so that's good. However, porting bd448f0 instead of that fix also makes it pass, but as mentioned above, porting bd448f0 isn't enough to make my larger, unreduced repro work. So we should add a more involved test for that too at some point. |
Turns out the repro in #59162 (comment) also shows that bd448f0 isn't sufficient. Doing just that:
(and it works fine with the proposed patch) I'm hopeful that a minor tweak to https://reviews.llvm.org/D139199 will show this difference too – just need to find the right tweak. |
The patch LGTM. Commented there. |
Ports https://reviews.llvm.org/D106293 to bitcode, or llvm@bd448f01a6 from ELF to MachO. See also llvm#59162 for some vaguely related discussion.
…#67445) Ports https://reviews.llvm.org/D106293 to bitcode, or bd448f01a6 from ELF to MachO. See also #59162 for some vaguely related discussion.
…llvm#67445) Ports https://reviews.llvm.org/D106293 to bitcode, or llvm@bd448f01a6 from ELF to MachO. See also llvm#59162 for some vaguely related discussion.
…434 (#124294) This is a follow-up to #120452 in a way. Since lld/COFF does not yet insert all defined in an obj file before all undefineds (ELF and MachO do this, see #67445 and things linked from there), it's possible that: 1. We add an obj file a.obj 2. a.obj contains an undefined that's in b.obj, causing b.obj to be added 3. b.obj contains an undefined that's in a part of a.obj that's not yet in the symbol table, causing a recursive load of a.obj, which adds the symbols in there twice, leading to duplicate symbol errors. For normal archives, `ArchiveFile::addMember()` has a `seen` check to prevent this. For start-lib lazy objects, we can just check if the archive is still lazy at the recursive call. This bug is similar to issue #59162. (Eventually, we'll probably want to do what the MachO and ELF ports do.) Includes a test that caused duplicate symbol diagnostics before this code change.
Uh oh!
There was an error while loading. Please reload this page.
https://drive.google.com/file/d/1ju1O-uXLu4JGq_FbVb3wu4ugiZ_MAWPR/view?usp=sharing
If you link with
-t -why_load
, it printsSo the file forces a load of itself!
We should definitely do bd448f0 in the MachO port (see also D106293), but doing just that isn't enough: We hit some other assert later on then.
Need to understand what's going on first and make a reduced repro.
The text was updated successfully, but these errors were encountered: