mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 14:48:27 +08:00
[WebAssembly][lld] Fix crash when applying relocations to debug sections
Debug sections are special in that they can contain relocations against symbols that are not present in the final output (i.e. not live). However it is also possible to have R_WASM_TABLE_INDEX relocations against symbols that don't have a table index assigned (since they are not address taken by actual code. Fixes: https://github.com/emscripten-core/emscripten/issues/9023 Differential Revision: https://reviews.llvm.org/D66435 llvm-svn: 369423
This commit is contained in:
@@ -166,7 +166,7 @@ uint32_t ObjFile::calcNewValue(const WasmRelocation &reloc) const {
|
||||
case R_WASM_TABLE_INDEX_I32:
|
||||
case R_WASM_TABLE_INDEX_SLEB:
|
||||
case R_WASM_TABLE_INDEX_REL_SLEB:
|
||||
if (config->isPic && !getFunctionSymbol(reloc.Index)->hasTableIndex())
|
||||
if (!getFunctionSymbol(reloc.Index)->hasTableIndex())
|
||||
return 0;
|
||||
return getFunctionSymbol(reloc.Index)->getTableIndex();
|
||||
case R_WASM_MEMORY_ADDR_SLEB:
|
||||
|
||||
Reference in New Issue
Block a user