diff options
author | Derek Schuff <dschuff@chromium.org> | 2020-12-04 13:45:42 -0800 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2020-12-07 12:12:44 -0800 |
commit | 0a391060f16dc3e10bcb0b02036073021c414006 (patch) | |
tree | e614e3665e5cda86cc772eaebc2cd5183a31584a /llvm/lib/Object/WasmObjectFile.cpp | |
parent | 5fe1a49f961d7e6a064addf6373288d5e3697e68 (diff) | |
download | llvm-0a391060f16dc3e10bcb0b02036073021c414006.zip llvm-0a391060f16dc3e10bcb0b02036073021c414006.tar.gz llvm-0a391060f16dc3e10bcb0b02036073021c414006.tar.bz2 |
[WebAssembly] Add Object and ObjectWriter support for wasm COMDAT sections
Allow sections to be placed into COMDAT groups, in addtion to functions and data
segments.
Also make section symbols unnamed, which allows sections with identical names
(section names are independent of their section symbols, but previously we
gave the symbols the same name as their sections, which results in collisions
when sections are identically-named).
Differential Revision: https://reviews.llvm.org/D92691
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index eb1f398..7c8abcb 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -745,6 +745,15 @@ Error WasmObjectFile::parseLinkingSectionComdat(ReadContext &Ctx) { object_error::parse_failed); getDefinedFunction(Index).Comdat = ComdatIndex; break; + case wasm::WASM_COMDAT_SECTION: + if (Index >= Sections.size()) + return make_error<GenericBinaryError>( + "COMDAT section index out of range", object_error::parse_failed); + if (Sections[Index].Type != wasm::WASM_SEC_CUSTOM) + return make_error<GenericBinaryError>( + "Non-custom section in a COMDAT", object_error::parse_failed); + Sections[Index].Comdat = ComdatIndex; + break; } } } |