[PATCH] D106179: [lld-macho] Disambiguate bitcode files with the same name by archive name/offset in archive
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 22 12:42:45 PDT 2021
thakis added inline comments.
================
Comment at: lld/MachO/InputFiles.cpp:1263
+ // ThinLTO assumes that all MemoryBufferRefs given to it have a unique
+ // name. If two archives (or a single thin archive) define two members with
+ // the same name, this causes a collision and ThinLTO can't proceed.
----------------
It doesn't have to be a thin archive, regular archives can contain several files with the same name:
```
% echo 'void a() {}' > a.cc
% echo 'void b() {}' > b.cc
% mkdir a
% mkdir b
% clang -flto=thin -c a.cc -o a/a.o
% clang -flto=thin -c b.cc -o b/a.o
% ar -t libfoo.a
__.SYMDEF
a.o
a.o
```
================
Comment at: lld/test/MachO/lto-archivecollision.ll:19
+; SAME-ARCHIVE-NEXT: -r={{.*}}/libbar.abar.obj[[#OFFSET:]],_foo,p
+;; FIXME: Find a way to assert OTHEROFFSET != OFFSET
+; SAME-ARCHIVE-NEXT: libbar.abar.obj[[#OTHEROFFSET:]]
----------------
lgrey wrote:
> thakis wrote:
> > Do you even need this? If the link succeeded, it means we pulled in both .o files
> Agree, but this applies to all the FileCheck stuff in here. Do you think it's worth keeping as documentation, or should I just run the links, add a comment re: how they would fail, and call it a day?
I'd keep comments as is and just remove the FIXME line, but /shruggie
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106179/new/
https://reviews.llvm.org/D106179
More information about the llvm-commits
mailing list