[PATCH] D78199: Enable finding bitcode in wasm objects
Alex Crichton via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 06:32:34 PDT 2020
alexcrichton created this revision.
alexcrichton added a reviewer: sbc100.
Herald added subscribers: llvm-commits, sunfish, aheejin, hiraditya.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78199
Files:
llvm/include/llvm/Object/Wasm.h
llvm/lib/Object/IRObjectFile.cpp
llvm/lib/Object/WasmObjectFile.cpp
Index: llvm/lib/Object/WasmObjectFile.cpp
===================================================================
--- llvm/lib/Object/WasmObjectFile.cpp
+++ llvm/lib/Object/WasmObjectFile.cpp
@@ -1469,8 +1469,6 @@
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;
Index: llvm/lib/Object/IRObjectFile.cpp
===================================================================
--- llvm/lib/Object/IRObjectFile.cpp
+++ llvm/lib/Object/IRObjectFile.cpp
@@ -94,6 +94,7 @@
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);
Index: llvm/include/llvm/Object/Wasm.h
===================================================================
--- llvm/include/llvm/Object/Wasm.h
+++ llvm/include/llvm/Object/Wasm.h
@@ -185,7 +185,6 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78199.257695.patch
Type: text/x-patch
Size: 1545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/f62ad541/attachment.bin>
More information about the llvm-commits
mailing list