llvm-project
c675a9be - Object: Don't error out on malformed bitcode files.

Commit
1 year ago
Object: Don't error out on malformed bitcode files. An error reading a bitcode file most likely indicates that the file was created by a compiler from the future. Normally we don't try to implement forwards compatibility for bitcode files, but when creating an archive we can implement best-effort forwards compatibility by treating the file as a blob and not creating symbol index entries for it. lld and mold ignore the archive symbol index, so provided that you use one of these linkers, LTO will work as long as lld or the gold plugin is newer than the compiler. We only ignore errors if the archive format is one that is supported by a linker that is known to ignore the index, otherwise there's no chance of this working so we may as well error out. We print a warning on read failure so that users of linkers that rely on the symbol index can diagnose the issue. This is the same behavior as GNU ar when the linker plugin returns an error when reading the input file. If the bitcode file is actually malformed, it will be diagnosed at link time. Reviewers: MaskRay, dwblaikie, jh7370 Reviewed By: MaskRay, dwblaikie, jh7370 Pull Request: https://github.com/llvm/llvm-project/pull/96848
Author
pcc pcc
Parents
Loading