[llvm] 2a68573 - Enable finding bitcode in wasm objects
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 12:33:44 PDT 2020
Author: Sam Clegg
Date: 2020-04-15T12:33:33-07:00
New Revision: 2a68573a3550faaad91c852c11a68c5f480a0aa6
URL: https://github.com/llvm/llvm-project/commit/2a68573a3550faaad91c852c11a68c5f480a0aa6
DIFF: https://github.com/llvm/llvm-project/commit/2a68573a3550faaad91c852c11a68c5f480a0aa6.diff
LOG: Enable finding bitcode in wasm objects
This commit fixes using functions in `IRObjectFile` to load bitcode from
wasm objects by recognizing the file magic for wasm and also inheriting
the default implementation of classifying sections as bitcode.
Patch By: alexcrichton
Differential Revision: https://reviews.llvm.org/D78199
Added:
Modified:
llvm/include/llvm/Object/Wasm.h
llvm/lib/Object/IRObjectFile.cpp
llvm/lib/Object/WasmObjectFile.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Object/Wasm.h b/llvm/include/llvm/Object/Wasm.h
index e5b21d02744d..0ba83550bd7d 100644
--- a/llvm/include/llvm/Object/Wasm.h
+++ b/llvm/include/llvm/Object/Wasm.h
@@ -185,7 +185,6 @@ class WasmObjectFile : public ObjectFile {
bool isSectionData(DataRefImpl Sec) const override;
bool isSectionBSS(DataRefImpl Sec) const override;
bool isSectionVirtual(DataRefImpl Sec) const override;
- bool isSectionBitcode(DataRefImpl Sec) const override;
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
relocation_iterator section_rel_end(DataRefImpl Sec) const override;
diff --git a/llvm/lib/Object/IRObjectFile.cpp b/llvm/lib/Object/IRObjectFile.cpp
index 636f1521262f..931e842edb44 100644
--- a/llvm/lib/Object/IRObjectFile.cpp
+++ b/llvm/lib/Object/IRObjectFile.cpp
@@ -94,6 +94,7 @@ IRObjectFile::findBitcodeInMemBuffer(MemoryBufferRef Object) {
return Object;
case file_magic::elf_relocatable:
case file_magic::macho_object:
+ case file_magic::wasm_object:
case file_magic::coff_object: {
Expected<std::unique_ptr<ObjectFile>> ObjFile =
ObjectFile::createObjectFile(Object, Type);
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index e9a8e0814472..362834cee899 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -1469,8 +1469,6 @@ bool WasmObjectFile::isSectionBSS(DataRefImpl Sec) const { return false; }
bool WasmObjectFile::isSectionVirtual(DataRefImpl Sec) const { return false; }
-bool WasmObjectFile::isSectionBitcode(DataRefImpl Sec) const { return false; }
-
relocation_iterator WasmObjectFile::section_rel_begin(DataRefImpl Ref) const {
DataRefImpl RelocRef;
RelocRef.d.a = Ref.d.a;
More information about the llvm-commits
mailing list