Commit Graph

6 Commits

Author SHA1 Message Date
Thomas Lively
0fd5e7b2d8 [WebAssembly][lld] Fix segfault on .bss sections in mapfile
When memory is declared in the Wasm module, we rely on the implicit zero
initialization behavior and do not explicitly output .bss sections. The means
that they do not have associated `outputSec` entries, which was causing
segfaults in the mapfile support. Fix the issue by guarding against null
`outputSec` and falling back to using a zero offset.

Differential Revision: https://reviews.llvm.org/D102951
2021-07-07 23:31:48 -07:00
Sam Clegg
14ffbb84aa [lld][WebAssembly] Rename methods/members to match ELF backend. NFC.
Specifically:

- InputChunk::outputOffset -> outSecOffset
- Symbol::get/setVirtualAddress -> get/setVA
- add InputChunk::getOffset helper that takes an offset

These are mostly in preparation for adding support for
SHF_MERGE/SHF_STRINGS but its also good to align with ELF where
possible.

Differential Revision: https://reviews.llvm.org/D97595
2021-02-26 17:05:59 -08:00
Sam Clegg
70f3c6e9e6 [lld][WebAssembly] Delay the merging of data section when dynamic linking
With dynamic linking we have the current limitation that there can be
only a single active data segment (since we use __memory_base as the
load address and we can't do arithmetic in constant expresions).

This change delays the merging of active segments until a little later
in the linking process which means that the grouping of data by section,
and the magic __start/__end symbols work as expected under dynamic
linking.

Differential Revision: https://reviews.llvm.org/D96453
2021-02-11 10:54:15 -08:00
Andy Wingo
a56e57493b [lld][WebAssembly] Common superclass for input globals/events/tables
This commit regroups commonalities among InputGlobal, InputEvent, and
InputTable into the new InputElement.  The subclasses are defined
inline in the new InputElement.h.  NFC.

Reviewed By: sbc100

Differential Revision: https://reviews.llvm.org/D94677
2021-02-11 14:54:45 +01:00
Thomas Lively
067f005500 [lld][WebAssembly] Fix segfault in map file support
The code previously assumed that `getChunk` would return a non-null pointer for
every symbol, but in fact it only returns non-null pointers for DefinedFunction
and DefinedData symbols. This patch fixes the segfault by checking whether
`getChunk` returns a null for each symbol and skipping the mapping output for
any symbols for which it does.

Differential Revision: https://reviews.llvm.org/D88369
2021-02-09 14:42:43 -08:00
Sam Clegg
cc2da5554b [lld][WebAssembly] Add initial support for -Map/--print-map
Differential Revision: https://reviews.llvm.org/D77187
2020-09-12 16:10:51 -07:00