[all-commits] [llvm/llvm-project] d9b812: [lld/COFF] Fix -start-lib / -end-lib more after re...
Nico Weber via All-commits
all-commits at lists.llvm.org
Fri Jan 24 10:14:45 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d9b8120259a546ce7aa9f047566fef29479f59e8
https://github.com/llvm/llvm-project/commit/d9b8120259a546ce7aa9f047566fef29479f59e8
Author: Nico Weber <thakis at chromium.org>
Date: 2025-01-24 (Fri, 24 Jan 2025)
Changed paths:
M lld/COFF/InputFiles.cpp
M lld/COFF/SymbolTable.cpp
M lld/test/COFF/start-lib.ll
Log Message:
-----------
[lld/COFF] Fix -start-lib / -end-lib more after reviews.llvm.org/D116434 (#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.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list