[ELF] Fix --thinlto-index-only regression after D79300
authorFangrui Song <maskray@google.com>
Wed, 10 Jun 2020 06:08:04 +0000 (23:08 -0700)
committerFangrui Song <maskray@google.com>
Wed, 10 Jun 2020 06:10:30 +0000 (23:10 -0700)
commitb114e134bdc89fc43aef2ab2d7ff19aca89e5b36
treed03f6b217fb037d8edf25a6a19fa91721217c9cd
parent4be1c116ad8602d96d6d212a661425fbf05eb58f
[ELF] Fix --thinlto-index-only regression after D79300

After D79300, we don't rewrite InputFile::mb to an empty buffer.
In thinLTOCreateEmptyIndexFiles(), we should check LazyObjFile::fetched
as well as checking whether mb is a bitcode, otherwise we would overwrite (path + .thinlto.bc) with an empty index.
lld/ELF/LTO.cpp
lld/test/ELF/lto/thinlto-index-only.ll