[PATCH] D30544: [lld] - Ignore non-elf files in archives with --whole-archive

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 09:44:47 PST 2017


ruiu added a comment.

In https://reviews.llvm.org/D30544#693345, @gbreynoo wrote:

> The problem we see from a customer perspective is an inconsistency between including an archive with or without the --whole-archive argument.
>
> When --whole-archive is used the archive is parsed on a file by file basis. When --whole-archive is not used, the archive is parsed by looking at the symbol table and files not in the symbol table are ignored. This means from a user perspective adding the --whole-archive argument can make a formally legal archive unexpectedly cause an error.


I agree that in some cases that is true, but in general adding --whole-archive can change valid combinations of file into invalid combinations, no? For example, assume that there is a file foo.o which contains undefined symbols that cannot be resolved by any other file. As long as foo.o is in an archive file and you are not using that file, foo.o doesn't cause any rpoblem. But if you add --whole-archive, the file will cause an undefined symbol error. So, adding --whole-archive can cause an error even if all files in an archive are valid ELF files.


https://reviews.llvm.org/D30544





More information about the llvm-commits mailing list