[lld] [LLD][COFF] Handle --start-lib/--end-lib group in the same way as other archives (PR #136496)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 23 00:59:06 PDT 2025
================
@@ -259,17 +244,24 @@ MemoryBufferRef LinkerDriver::takeBuffer(std::unique_ptr<MemoryBuffer> mb) {
}
void LinkerDriver::addBuffer(std::unique_ptr<MemoryBuffer> mb,
- bool wholeArchive, bool lazy) {
+ bool wholeArchive,
+ CmdLineArchive *inCmdLineArchive) {
StringRef filename = mb->getBufferIdentifier();
MemoryBufferRef mbref = takeBuffer(std::move(mb));
// File type is detected by contents, not by file extension.
switch (identify_magic(mbref.getBuffer())) {
case file_magic::windows_resource:
+ assert(!inCmdLineArchive &&
+ "Cannot specify a RES file inside a --start-lib/--end-lib group.");
resources.push_back(mbref);
break;
case file_magic::archive:
+ // FIXME: We could later support --start-lib/--end-lib groups, to allow for
+ // "extending" an existing archive/LIB.
+ assert(!inCmdLineArchive &&
----------------
mstorsjo wrote:
As this case, and the resource one above, is quite possible to hit this as an unsuspecting user, we shouldn't be using assert for it; if we hit this in a release build without asserts, we don't want to run into essentially UB territory here - we probably should have a proper error for it. (We don't necessarily need to test for the error though.)
https://github.com/llvm/llvm-project/pull/136496
More information about the llvm-commits
mailing list