Commit Graph

2844 Commits

Author SHA1 Message Date
mlugg aaa7e73983 link.Dwarf: skip tests in updateComptimeNav
These won't live in the parent namespace as decls which causes problems
later in this function, and tests are guaranteed not to be referenced at
comptime anyway, so there's actually no need to run this logic.
2024-08-28 08:39:59 +01:00
mlugg 0fe3fd01dd std: update std.builtin.Type fields to follow naming conventions
The compiler actually doesn't need any functional changes for this: Sema
does reification based on the tag indices of `std.builtin.Type` already!
So, no zig1.wasm update is necessary.

This change is necessary to disallow name clashes between fields and
decls on a type, which is a prerequisite of #9938.
2024-08-28 08:39:59 +01:00
Jacob Young f289b82d0e Dwarf: implement .eh_frame 2024-08-27 03:55:56 -04:00
Jacob Young 8c3f6c72c0 Dwarf: fix and test string format 2024-08-27 02:09:59 -04:00
Andrew Kelley d9147b91a6 Merge pull request #21212 from ziglang/elf-incr
elf: cleanups, cleanups, cleanups
2024-08-26 19:25:23 -07:00
Jakub Konka 1254509d78 elf: make Atom.allocate and related ZigObject-independent 2024-08-26 22:19:51 +02:00
David Rubin f777b29832 fix up merge conflicts with master 2024-08-25 22:43:57 -07:00
David Rubin 1c1feba08e remove mod aliases for Zcus 2024-08-25 15:17:40 -07:00
David Rubin 9868ed44b3 macho: remove deprecated Module usages 2024-08-25 15:17:23 -07:00
David Rubin 863f74dcd2 comp: rename module to zcu 2024-08-25 15:17:21 -07:00
David Rubin bb531759bc coff: remove deprecated Module usages 2024-08-25 15:16:46 -07:00
David Rubin b4bb64ce78 sema: rework type resolution to use Zcu when possible 2024-08-25 15:16:42 -07:00
Jakub Konka 20240e9cd5 elf: store atom refs for rela sections until we can do better 2024-08-25 10:20:15 +02:00
Jakub Konka 1af0f4cd00 elf: fix setting sh_info and sh_link for manually managed rela sections 2024-08-25 10:20:15 +02:00
Jakub Konka 7173ea1a15 elf: simplify output section symbol tracking 2024-08-25 10:20:15 +02:00
Jakub Konka 95c30fb486 elf: fix shdr-to-phdr links 2024-08-25 10:20:15 +02:00
Jakub Konka a9d3885ac7 elf: streamline sections container 2024-08-25 10:20:14 +02:00
Jakub Konka a6bf762a8b elf: finally move initMetadata into ZigObject.init 2024-08-25 10:20:14 +02:00
Alex Rønne Petersen fb6f5a30b2 link: Rename InvalidCpuArch error to InvalidMachineType. 2024-08-23 19:56:29 +02:00
Alex Rønne Petersen a69f55a7cc std.{coff,elf}: Remove the {MachineType,EM}.toTargetCpuArch() functions.
These are fundamentally incapable of producing accurate information for reasons
I've laid out in #20771. Since our only use of these functions is to check that
object files have the correct machine type, and since #21020 made
`std.Target.to{Coff,Elf}Machine()` more accurate, just switch these checks over
to that and compare the machine type tags instead.

Closes #20771.
2024-08-23 19:56:24 +02:00
Jacob Young 0a52914355 Elf: all dwarf relocs need to become linker relocs 2024-08-22 20:08:05 -04:00
Jacob Young 17171cdb07 Dwarf: fix big and zero enum values 2024-08-22 20:08:05 -04:00
Jacob Young f47e1e148e Dwarf: add more childless special cases 2024-08-22 20:08:05 -04:00
Jacob Young 874ad98f7a Dwarf: fix treating big int limbs as signed 2024-08-22 20:08:04 -04:00
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