llvm-project
48c6c7f4 - [lld][WebAssembly] Fix symbol type for __memory_base/__table_base. (#178773)

Commit
87 days ago
[lld][WebAssembly] Fix symbol type for __memory_base/__table_base. (#178773) When linking PIC code as non-PIC we internally define `__memory_base` and `__table_base`. However we were defining these incorrectly as data symbols and not global symbols (as in Wasm globals). This happened to work incidentally as long as there was a live reference to the symbol. This is because the live reference would cause a GOT entry to be created for these symbol and then they could be referenced via via `R_WASM_GLOBAL_INDEX_LEB` or `R_WASM_GLOBAL_INDEX_I32`. However, when no live reference existed there could still be references from debug sections, and in that case the relocation code was crashing. Fixes: #174676
Author
Parents
Loading