mirror of
https://github.com/siemens-mobile-hacks/llvm-c166.git
synced 2026-11-28 20:05:56 +00:00
Reading a global or static variable on a Wasm target produced a wrong value (or none at all). Two Wasm-only bugs combined to break it, both of which need to be fixed to support `target variable` / `frame var`. 1. DWARFExpression::Evaluate special-cased DW_OP_addr and DW_OP_addrx/DW_OP_GNU_addr_index on Wasm to push a LoadAddress, based on the theory that "Wasm file sections aren't mapped into memory". But a DW_OP_addr operand denotes a location in the module's address space, i.e. a file address like on every other target. Forcing a load address breaks the static (no-process) read path, since a file section cannot be read as a load address. 2. ObjectFileWasm::SetLoadAddress mapped every section with `load_address | GetFileOffset()`. For an active data segment that Object-tags the address (top bit = code space) and uses the file offset instead of the segment's linear-memory address, so a live read of a data global resolved to a garbage address in the wrong space. Address (1) by dropping the incorrect special casing. Address (2) by mapping data sections into the Memory space at their linear VM address while preserving the module id. Code and other sections keep their Object-space module-offset addressing. |
||
|---|---|---|
| .. | ||
| Breakpad | ||
| COFF | ||
| ELF | ||
| MachO | ||
| PDB | ||
| PECOFF | ||
| wasm | ||
| XCOFF | ||
| invalid.test | ||
| lit.local.cfg | ||