1432 Commits

Author SHA1 Message Date
Luuk de Gram
476202eec0
wasm-linker: Fix archive symbols parsing
When parsing the table of contents containing the symbols and their
positions we initially used the index within the map to retrieve
the offset. However, during resizing of the underlaying array this
would invalidate those indexes which meant incorrect offsets were
being stored for symbols. We now use the current symbol index
to also get the index into the symbol position instead.
2022-12-16 18:31:24 +01:00
Luuk de Gram
ae106db889
wasm-linker: Fix debug info relocations 2022-12-15 20:28:30 +01:00
Luuk de Gram
f95549ddc7
wasm-linker: Export data symbols as global
When a data symbol is required to be exported, we instead generate
a global that will be exported. This global is immutable and contains
the address of the data symbol.
2022-12-14 16:55:23 +01:00
Luuk de Gram
41199bba4b
wasm-linker: Create separate path for one-shot
When invoking the self-hosted linker using `-fno-LLD` while using the
LLVM backend or invoking it as a linker, we create a seperate path.
This path will link the object file generated by LLVM and the
supplied object files just once, allowing to simplify the
implementation between incremental and regular linking.
2022-12-13 19:19:05 +01:00
Jakub Konka
f7fea080b2 macho+zld: skip atomless synthetic globals in dead_strip
They are implicitly marked live.
2022-12-09 21:12:38 +01:00
Jakub Konka
182751ba27 Revert "coff: specify default base path for relative source paths in pdb" 2022-12-09 14:16:44 +01:00
Jakub Konka
4d640f9bb9 dwarf: resolve all relative paths when generating include_dirs and file_names lists 2022-12-09 14:16:44 +01:00
Jakub Konka
9735953ae2 wasm: implement moving debug_line program when header too big 2022-12-09 09:24:25 +01:00
Jakub Konka
742aa94280 dsym: hint linker when file range copy is not necessary 2022-12-09 09:24:25 +01:00
Jakub Konka
9ade4f6d8c elf: hint linker when file range copy is not necessary 2022-12-09 09:24:25 +01:00
Jakub Konka
d7e42014ca elf: add growAllocSection and growNonAllocSection
Update `Dwarf.zig` to use `growNonAllocSection` for ELF and implement
routine to make space for `.debug_line` header.
2022-12-09 09:24:25 +01:00
Jakub Konka
aa2f48f013 dsym: reuse growSection where possible 2022-12-09 09:24:25 +01:00
Jakub Konka
fa44c73c1e dwarf: move any remaining section growth to dsym 2022-12-09 09:24:25 +01:00
Jakub Konka
b14e580ad8 dwarf: move growing debug_aranges section to dsym 2022-12-09 09:24:25 +01:00
Jakub Konka
136a508027 dsym: finish markDirty helper 2022-12-09 09:24:25 +01:00
Jakub Konka
ecb341a006 dwarf: move growing debug_abbrev section to dsym 2022-12-09 09:24:25 +01:00
Jakub Konka
381abcfb7a dwarf: move another sect growing routine to d_sym 2022-12-09 09:24:25 +01:00
Jakub Konka
4bb66b63ba macho: add helper for getting ptr to DebugSymbols 2022-12-09 09:24:25 +01:00
Jakub Konka
05e221796a dwarf+d_sym: move logic for growing section to d_sym 2022-12-09 09:24:25 +01:00
Jakub Konka
4c38ba7d1b dwarf: move SrcFns if debug_line header exceeded its padding 2022-12-09 09:24:25 +01:00
Jakub Konka
be2b85f670 dwarf: refactor object file format and ptr width switches in writeDbgLineHeader 2022-12-09 09:24:25 +01:00
Jakub Konka
8e71a79e4b dwarf: fix incorrect calc of dir index 2022-12-09 09:24:25 +01:00
Jakub Konka
62145a1b08 dwarf: refactor routine for precalculating size of dbg line header 2022-12-09 09:24:25 +01:00
Jakub Konka
6817219e27 dwarf: generate list of include dirs and file names like LLVM backend 2022-12-09 09:24:25 +01:00
Jakub Konka
6ec34edb9a dwarf: fully resolve each path to each file source 2022-12-09 09:24:25 +01:00
Jakub Konka
f5c764d892 dwarf: track source files via *const Module.File pointers 2022-12-09 09:24:25 +01:00
Jakub Konka
4c4821d993 dwarf: specify all referenced zig source files 2022-12-09 09:24:25 +01:00
Andrew Kelley
28514476ef remove -fstage1 option
After this commit, the self-hosted compiler does not offer the option to
use stage1 as a backend anymore.
2022-12-06 12:15:04 -07:00
Jakub Konka
12e34e7037 dwarf: pull out debug line program internals into DeclState helpers 2022-12-05 22:35:07 +01:00
Jakub Konka
8796da0283 dwarf: reuse getDbgInfoAtom helper in all of Dwarf.zig
We need to access it outside of `DeclState` too so why not reuse
the helper anyway.
2022-12-05 14:19:22 +01:00
Jakub Konka
3575048c0a
Merge pull request #13763 from ziglang/macho-dsym-incr
macho+dsym: refactor and reorganize file layout to support incremental DWARF updates
2022-12-05 13:48:12 +01:00
Andrew Kelley
db1819e8ed CBE: fix use-after-free of Type keys in free_locals map 2022-12-04 15:57:40 -07:00
Andrew Kelley
8d8b2c834d CBE: exploit Liveness analysis to reuse locals 2022-12-04 15:57:40 -07:00
Jakub Konka
899d7a771e dsym: dummy repush to check the linux CI 2022-12-04 18:15:14 +01:00
Jakub Konka
a84b67468c dsym: recalculate DWARF segment size when finalizing 2022-12-04 16:58:45 +01:00
Jakub Konka
280dad0283 dsym+dwarf: remove copyRangeAllOverlappingAlloc 2022-12-04 16:58:45 +01:00
Jakub Konka
aa8b26cf25 dsym: refactor API - do not store ptr to MachO 2022-12-04 16:58:45 +01:00
Jakub Konka
d67de87baa dsym: add helper for accessing dwarf seg pointer 2022-12-04 16:58:45 +01:00
Jakub Konka
73d76b26a2 dsym: rename updateLinkeditSegment to finalizeDwarfSegment
This is the checkpoint where we finalize the VM of the primary binary.
2022-12-04 16:58:45 +01:00
Jakub Konka
278426b851 dsym: make sure DWARF segment comes before LINKEDIT
This will greatly simplify incremental updates to DWARF sections
within the bundle.
2022-12-04 16:58:45 +01:00
Jacob Young
81c271cc62 cbe: don't emit extern decls that are already exported 2022-12-03 08:21:03 -05:00
Andrew Kelley
fdbb0fb7b9
Merge pull request #13744 from Vexu/stage2-fixes
Improve error messages, fix dependency loops
2022-12-03 00:42:11 -05:00
Veikka Tuominen
0e38cc16d5 Sema: fix comparisons between lazy and runtime values
Closes #12498
2022-12-03 00:09:23 +02:00
Jakub Konka
bfd36cbf97 dwarf: pass linker Tag and owner Decl.Index instead of *Atom 2022-12-02 13:17:52 +01:00
Jakub Konka
3ec0520bac dwarf: use common DI union object for arg and var gen 2022-12-02 12:22:17 +01:00
Jakub Konka
8fea84f77e dwarf: move Wasm specific dwarf gen out of codegen 2022-12-01 20:55:55 +01:00
Jakub Konka
4120332577 dwarf: fix typos after refactoring dbi gen 2022-12-01 17:23:28 +01:00
Jakub Konka
5bffc17c42 codegen: make LinkerLoad a common struct shared by backends 2022-12-01 16:32:09 +01:00
Jakub Konka
00016ab6a0 dwarf: extract common logic for generating func var dbg info 2022-12-01 15:28:22 +01:00
Jakub Konka
5ee99f862a dwarf: extract common logic for generating func arg dbg info 2022-12-01 14:06:24 +01:00