Skip to content

Commit e319eda

Browse files
sbc100alexcrichton
authored andcommitted
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
1 parent 4e40544 commit e319eda

File tree

3 files changed

+1
-3
lines changed

3 files changed

+1
-3
lines changed

llvm/include/llvm/Object/Wasm.h

-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ class WasmObjectFile : public ObjectFile {
183183
bool isSectionData(DataRefImpl Sec) const override;
184184
bool isSectionBSS(DataRefImpl Sec) const override;
185185
bool isSectionVirtual(DataRefImpl Sec) const override;
186-
bool isSectionBitcode(DataRefImpl Sec) const override;
187186
relocation_iterator section_rel_begin(DataRefImpl Sec) const override;
188187
relocation_iterator section_rel_end(DataRefImpl Sec) const override;
189188

llvm/lib/Object/IRObjectFile.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ IRObjectFile::findBitcodeInMemBuffer(MemoryBufferRef Object) {
9494
return Object;
9595
case file_magic::elf_relocatable:
9696
case file_magic::macho_object:
97+
case file_magic::wasm_object:
9798
case file_magic::coff_object: {
9899
Expected<std::unique_ptr<ObjectFile>> ObjFile =
99100
ObjectFile::createObjectFile(Object, Type);

llvm/lib/Object/WasmObjectFile.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -1455,8 +1455,6 @@ bool WasmObjectFile::isSectionBSS(DataRefImpl Sec) const { return false; }
14551455

14561456
bool WasmObjectFile::isSectionVirtual(DataRefImpl Sec) const { return false; }
14571457

1458-
bool WasmObjectFile::isSectionBitcode(DataRefImpl Sec) const { return false; }
1459-
14601458
relocation_iterator WasmObjectFile::section_rel_begin(DataRefImpl Ref) const {
14611459
DataRefImpl RelocRef;
14621460
RelocRef.d.a = Ref.d.a;

0 commit comments

Comments
 (0)