2820 Commits

Author SHA1 Message Date
Jacob Young
cbaff43b2a Dwarf: add missing var args info on function decls 2024-08-22 19:53:04 -04:00
Jacob Young
31220b50b5 Dwarf: cleanup emitted debug info
* reduce iteration cost by not tracking unused entries
 * avoid emitting unused abbrevs to `.debug_abbrev`
 * get the compiler executable passing `llvm-dwarfdump --verify`
 * make it possible to skip `.debug_line` padding much more quickly
2024-08-22 08:44:08 +02:00
Jakub Konka
cbb8093455 macho: emit local symbols for thunks 2024-08-22 00:34:58 +02:00
Jakub Konka
e79ac14ef3 elf: refactor tracking debug section sizes 2024-08-21 10:28:31 +02:00
Jacob Young
db48a78963 Dwarf: ensure stale relocations are deleted 2024-08-21 01:43:22 -04:00
Jakub Konka
b17bbf9e6c elf: fixes after rebase 2024-08-21 01:43:21 -04:00
Jakub Konka
6c731be3a1 elf: allow for concatenating atoms to merge sections 2024-08-21 01:43:21 -04:00
Jakub Konka
6a86a1041c elf: remove obsolete call to Dwarf.resolveRelocs 2024-08-21 01:43:21 -04:00
Jakub Konka
fe6dfd5090 elf: fix emitting cross-section relocs for .debug* sections 2024-08-21 01:43:21 -04:00
Jakub Konka
c4d820b3f1 elf: emit DTPOFF32/DTPOFF64 relocation for .debug* sections 2024-08-21 01:43:21 -04:00
Jakub Konka
d388d555d5 elf: parse and emit Elf relocs for cross section refs for .debug* sections 2024-08-21 01:43:21 -04:00
Jakub Konka
d3d5ed992c elf: emit .rela.debug* sections for relocatable if required 2024-08-21 01:43:21 -04:00
Jakub Konka
517721bbcc elf: start unraveling Dwarf relocs into Elf relocs 2024-08-21 01:43:21 -04:00
Jakub Konka
56e1ae21e4 elf: populate debug atoms on the linker side after Dwarf.flushModule 2024-08-21 01:43:21 -04:00
Jakub Konka
41f2302865 elf: create section symbols and atoms per each ZigObject debug section 2024-08-21 01:43:21 -04:00
Jakub Konka
84105be4df elf: remove unused code 2024-08-21 01:43:21 -04:00
Jacob Young
eaa227449c Dwarf: fix issues with inline call sites 2024-08-20 15:08:23 -04:00
Jacob Young
62f7276501 Dwarf: emit info about inline call sites 2024-08-20 08:09:33 -04:00
Jacob Young
ef90eb0d4d Dwarf: delete incorrect logic that also has the possibility of crashing 2024-08-20 08:09:33 -04:00
Robin Voetter
b4343074d2
replace Compilation.Emit with std.Build.Cache.Path
This type is exactly the same as std.Build.Cache.Path, except for
one function which is not used anymore. Therefore we can replace
it without consequences.
2024-08-19 19:09:12 +02:00
mlugg
de49a9a173
Zir: add instructions to fetch std.builtin types
This replaces the constant `Zir.Inst.Ref` tags (and the analagous tags
in `Air.Inst.Ref`, `InternPool.Index`) referring to types in
`std.builtin` with a ZIR instruction `extended(builtin_type(...))` which
instructs Sema to fetch such a type, effectively as if it were a
shorthand for the ZIR for `@import("std").builtin.xyz`.

Previously, this was achieved through constant tags in `Ref`. The
analagous `InternPool` indices began as `simple_type` values, and were
later rewritten to the correct type information. This system was kind of
brittle, and more importantly, isn't compatible with incremental
compilation of std, since incremental compilation relies on the ability
to recreate types at different indices when they change. Replacing the
old system with this instruction slightly increases the size of ZIR, but
it simplifies logic and allows incremental compilation to work correctly
on the standard library.

This shouldn't have a significant impact on ZIR size or compiler
performance, but I will take measurements in the PR to confirm this.
2024-08-18 18:10:59 +01:00
mlugg
9c3324173d compiler: merge conflicts and typos 2024-08-17 18:50:10 -04:00
Jacob Young
2b05e85107
Merge pull request #21111 from jacobly0/self-dwarf
Dwarf: debug info progress
2024-08-17 18:47:27 -04:00
Jacob Young
d4e3d0e676 Dwarf: fix and test error unions 2024-08-17 09:27:15 -04:00
Jacob Young
f601aa780e Dwarf: fix and test allowzero pointers 2024-08-17 05:57:45 -04:00
Jakub Konka
96441bd829 macho: update codegen and linker to distributed jump table approach 2024-08-17 08:14:38 +02:00
Jacob Young
ed19ecd115 Coff: fix missing error lazy symbols 2024-08-16 16:23:53 -04:00
Jacob Young
00ca818805 Dwarf: incremental also needs end_sequence
The spec says that addresses can only increase within a sequence, so
every decl must be a separate sequence since they are not sorted.
2024-08-16 15:22:56 -04:00
Jacob Young
7a0acc8be6 Dwarf: fix cross-module inline function line info 2024-08-16 15:22:56 -04:00
Jacob Young
ef11bc9899 Dwarf: rework self-hosted debug info from scratch
This is in preparation for incremental and actually being able to debug
executables built by the x86_64 backend.
2024-08-16 15:22:55 -04:00
Jakub Konka
90989be0e3
Merge pull request #21065 from ziglang/elf-zig-got
elf: replace .got.zig with a zig jump table
2024-08-16 21:19:44 +02:00
Alex Rønne Petersen
550438653d
std.Target: Pull toCoffMachine()/toElfMachine() up from Arch to Target.
This enables them to give more correct results.

Contributes to #20771.
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen
ac9ca7d30c
std.coff: Remove MachineType.fromTargetCpuArch().
This does the same thing as std.Target.Cpu.Arch.toCoffMachine(). Just use that.
2024-08-15 10:55:46 +02:00
Jakub Konka
c79290467f elf: fix GOT32 reloc resolution logic 2024-08-15 10:36:37 +02:00
Jakub Konka
0fd0b11bc4 riscv: do not emit GOT relocations for special linker symbols 2024-08-15 10:21:20 +02:00
Jakub Konka
8a0cb7002e elf: introduce Symbol.flags.is_extern_ptr for refs potentially needing GOT 2024-08-15 10:05:41 +02:00
Jakub Konka
b8203fac1b elf: check for relocs before deciding on shndx in getNavShdrIndex 2024-08-15 08:37:13 +02:00
Jakub Konka
f26573fddf elf: re-use old atom slot for a trampoline to that atom
This is the initial implementation of Jacob Young's idea of
re-using old function slots as trampolines for new function's
location. This way the trampoline is guaranteed to be aligned
to the function's alignment.

The only edge case is if an incremental update further overaligns
the function in which case we skip/delete the trampoline and
re-evaluate all references.
2024-08-14 12:10:40 +02:00
Jakub Konka
1bd54a55fa fix compile errors in other codegen backends 2024-08-13 21:52:40 +02:00
Jakub Konka
97ab420dcf elf: do not emit zig jump table in relocatables 2024-08-13 13:30:24 +02:00
Jakub Konka
49d78cc793 elf: only apply zig jump table indirection to function calls (PLT32) 2024-08-13 13:30:24 +02:00
Jakub Konka
9daf5e81c4 elf: commit non-indirected symbol address to symtab 2024-08-13 13:30:24 +02:00
Jakub Konka
df80ccf760 elf: pretty print alingment when pretty printing atoms 2024-08-13 13:30:24 +02:00
Jakub Konka
39ee346681 elf: make .text.zig bigger now that jump table is part of it 2024-08-13 13:30:24 +02:00
Jakub Konka
edd72c75eb elf: fix circular dep loop in zig jump table 2024-08-13 13:30:24 +02:00
Jakub Konka
ce8886d57d elf: make zig jump table indirection implicit via Symbol.address 2024-08-13 13:30:24 +02:00
Jakub Konka
d25c93a868 x86_64: emit call rel32 for near calls with linker reloc 2024-08-13 13:30:24 +02:00
Jakub Konka
78b1c73602 elf: rename OffsetTable to JumpTable 2024-08-13 13:30:24 +02:00
Jakub Konka
e1ce9a7065 elf: add poorman's reporting tool for unallocated NAVs/UAVs 2024-08-13 13:30:24 +02:00
Jakub Konka
e3f6ebaea9 x86_64+elf: fix jump table indirection for functions 2024-08-13 13:30:24 +02:00