[all-commits] [llvm/llvm-project] c675a9: Object: Don't error out on malformed bitcode files.
pcc via All-commits
all-commits at lists.llvm.org
Thu Jul 18 16:06:15 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c675a9be63b67682477e5cbdc01c450f66bbc59a
https://github.com/llvm/llvm-project/commit/c675a9be63b67682477e5cbdc01c450f66bbc59a
Author: pcc <peter at pcc.me.uk>
Date: 2024-07-18 (Thu, 18 Jul 2024)
Changed paths:
M llvm/include/llvm/Object/ArchiveWriter.h
M llvm/lib/Object/ArchiveWriter.cpp
M llvm/test/Object/archive-malformed-object.test
Log Message:
-----------
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
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list