Andrew Kelley
e44bafe5ff
wasm linker: mark symbol deps on intrinsics
2025-01-15 15:11:36 -08:00
Andrew Kelley
e18a397c85
wasm linker: fix corruption of string bytes
...
if any fixups are emitted in lowering data, keep the string bytes
allocated even if all zeroes because it is used as a fixup staging area.
2025-01-15 15:11:36 -08:00
Andrew Kelley
9c14645b58
wasm codegen: fix freeing of locals
2025-01-15 15:11:36 -08:00
Andrew Kelley
a327d238f1
wasm linker: handle function data references properly
2025-01-15 15:11:36 -08:00
Andrew Kelley
d999a8e33b
wasm-linker: fix splitSegmentName and add unit test
2025-01-15 15:11:36 -08:00
Andrew Kelley
788b7f8f11
wasm linker: don't call init functions unless object included
2025-01-15 15:11:36 -08:00
Andrew Kelley
1c4b4fb516
implement indirect function table for object functions
2025-01-15 15:11:36 -08:00
Andrew Kelley
d9d49ce995
wasm linker: handle weak globals in relocs
2025-01-15 15:11:36 -08:00
Andrew Kelley
7a4d4357e8
wasm linker: don't try to lower nav zcu data before updateNav is called
2025-01-15 15:11:36 -08:00
Andrew Kelley
21a2888561
wasm linker: don't assume nav callees are fully resolved
...
codegen can be called which contains calls to navs which have only their
type resolved. this means the indirect function table needs to track nav
indexes not ip indexes.
2025-01-15 15:11:36 -08:00
Andrew Kelley
5186c6c4ee
wasm linker: distinguish symbol name vs import name, and implement weak
2025-01-15 15:11:36 -08:00
Andrew Kelley
3474057e5e
wasm linker: fix not merging object memories
2025-01-15 15:11:36 -08:00
Andrew Kelley
e6a5fe7c55
wasm linker: apply object relocations to data segments
2025-01-15 15:11:36 -08:00
Andrew Kelley
290d97bd09
wasm linker: emit __heap_base and __heap_end globals and datas
2025-01-15 15:11:36 -08:00
Andrew Kelley
94648a0383
fix merge conflicts with updating line numbers
2025-01-15 15:11:36 -08:00
Andrew Kelley
b41b5fe529
wasm linker: implement __wasm_init_memory
2025-01-15 15:11:36 -08:00
Andrew Kelley
1fd708b1bc
wasm linker: implement data relocs
2025-01-15 15:11:36 -08:00
Andrew Kelley
abdbc38574
wasm linker: implement data symbols
2025-01-15 15:11:36 -08:00
Andrew Kelley
a4bee3009a
wasm linker: implement __wasm_call_ctors
2025-01-15 15:11:36 -08:00
Andrew Kelley
9ccf500508
implement function relocations
...
not all relocation types are implemented yet
2025-01-15 15:11:36 -08:00
Andrew Kelley
5b18af85cb
type checking for synthetic functions
2025-01-15 15:11:36 -08:00
Andrew Kelley
a4895f3c42
wasm object parsing: fix handling of weak functions and globals
2025-01-15 15:11:36 -08:00
Andrew Kelley
4fccb5ae7a
wasm linker: improve error messages by making source locations more lazy
2025-01-15 15:11:36 -08:00
Andrew Kelley
7d224516c4
wasm linker: chase relocations for references
2025-01-15 15:11:36 -08:00
Andrew Kelley
c5822879a1
fix bad archive name calculation
2025-01-15 15:11:36 -08:00
Andrew Kelley
b7a95911ab
wasm linker: fix table imports in objects
...
they need to reference a local index until the object parsing is
complete and also need to check reftype matching
2025-01-15 15:11:36 -08:00
Andrew Kelley
78987081ce
can't use source location until return from this function
2025-01-15 15:11:36 -08:00
Andrew Kelley
a72e7384aa
wasm linker: fix global imports in objects
...
they need to reference a local index until the object parsing is
complete and also need to check mutability and type matching
2025-01-15 15:11:36 -08:00
Andrew Kelley
eb943890d9
resolve merge conflicts
...
with 497592c9b45a94fb7b6028bf45b80f183e395a9b
2025-01-15 15:11:36 -08:00
Andrew Kelley
aebccb06e7
fix missing missing entry symbol error when no zcu
2025-01-15 15:11:36 -08:00
Andrew Kelley
1a4c5837fe
wasm linker: fix crashes when parsing compiler_rt
2025-01-15 15:11:36 -08:00
Andrew Kelley
4b9dc2922f
wasm linker: fix relocation parsing
2025-01-15 15:11:36 -08:00
Andrew Kelley
9cd7cad42e
Compilation: account for C objects and resources in prelink
2025-01-15 15:11:36 -08:00
Andrew Kelley
0d028e4407
wasm linker: fix active data segment offset value
2025-01-15 15:11:36 -08:00
Andrew Kelley
50626565ba
wasm linker: fix missing function type entry for import
2025-01-15 15:11:36 -08:00
Andrew Kelley
f1e167c1d8
use fixed writer in more places
2025-01-15 15:11:36 -08:00
Andrew Kelley
2174d20540
fix stack pointer initialized to wrong vaddr
2025-01-15 15:11:36 -08:00
Andrew Kelley
728103467e
wasm linker: implement indirect function calls
2025-01-15 15:11:36 -08:00
Andrew Kelley
fbbb54bab2
std.io: remove the "temporary workaround" for stage2_aarch64
2025-01-15 15:11:36 -08:00
Andrew Kelley
2dbf66dd69
wasm linker: implement stack pointer global
2025-01-15 15:11:36 -08:00
Andrew Kelley
d1cde847a3
implement the prelink phase in the frontend
...
this strategy uses a "postponed" queue to handle codegen tasks that
spawn too early. there's probably a better way.
2025-01-15 15:11:36 -08:00
Andrew Kelley
694b129d89
wasm linker: fix data section in flush
2025-01-15 15:11:36 -08:00
Andrew Kelley
ee999d5a14
implement error table and error names data segments
2025-01-15 15:11:36 -08:00
Andrew Kelley
7bf53d236d
wasm linker: zcu data fixups are already applied
2025-01-15 15:11:36 -08:00
Andrew Kelley
13eef2f8ab
wasm linker: initialize the data segments table in flush
...
it cannot be done earlier since ids are not stable yet
2025-01-15 15:11:36 -08:00
Andrew Kelley
5e0d33f00f
wasm linker: also call lowerZcuData in updateFunc
...
codegen can generate zcu data dependencies that need to be populated
2025-01-15 15:11:36 -08:00
Andrew Kelley
389b29fd8c
wasm linker: avoid recursion in lowerZcuData
...
instead of recursion, callers of the function are responsible for
checking the respective tables that might have new entries in them and
then calling lowerZcuData again.
2025-01-15 15:11:36 -08:00
Andrew Kelley
4f8a6b0888
wasm linker: implement data fixups
...
one hash table lookup per fixup
2025-01-15 15:11:36 -08:00
Andrew Kelley
5fac6f380e
wasm linker: fix eliding empty data segments
2025-01-15 15:11:36 -08:00
Andrew Kelley
568d9936ab
wasm codegen: fix call_indirect
2025-01-15 15:11:36 -08:00