[PATCH] D50475: ELF: Only add libcall symbols to the link if defined in bitcode.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 8 15:02:08 PDT 2018
ruiu added inline comments.
================
Comment at: lld/ELF/Driver.cpp:1221
+
+ MemoryBufferRef MB;
+ if (auto *LO = dyn_cast<LazyObject>(Sym))
----------------
ruiu wrote:
> pcc wrote:
> > ruiu wrote:
> > > Is it too expensive or is there any problem if we simply call `Sym->fetch()` and see if the returned value is of BitcodeFile (and if so, add to the symbol table)?
> > I don't think that would work because subsequent calls to `fetch` would return nullptr. That means that if the object file actually turns out to be required, we wouldn't end up adding it.
> Can you return right here if it is not isLazy?
I mean, I think something like this is a bit easier to grasp.
if (!Sym->isLazy())
return
if (auto *LO = dyn_cast<LazyObject>(Sym))
MB = LO->File->MB;
else
MB = cast<LazyArchive>(Sym)->getMemberBuffer();
Repository:
rL LLVM
https://reviews.llvm.org/D50475
More information about the llvm-commits
mailing list