Commit graph

30708 commits

Author SHA1 Message Date
mlugg
3fb5cad07d Sema: don't delete reified enum type with error in field
An enum type is kind of like a struct or union type, in that field
errors are happening during type resolution. The only difference is that
type resolution happens at the time the type is created. So, errors in
fields should not cause the type to be deleted: we've already added a
reference entry, and incremenetal dependencies which must be invalidated
if the compile error is fixed. Once we call `WipEnumType.prepare`, we
should never call `WipEnumType.cancel`. This is analagous to logic for
enum declarations in `Sema.zirEnumDecl`.
2024-08-17 18:50:10 -04:00
mlugg
50960fac80 compiler: be more cautious about source locations
Two fixes here.

* Prevent a crash when sorting the list of analysis errors when some
  errors refer to lost source locations. These errors can be sorted
  anywhere in the list, because they are (in theory) guaranteed to never
  be emitted by the `resolveReferences` logic. This case occurs, for
  instance, when a declaration has compile errors in the initial update
  and is deleted in the second update.

* Prevent a crash when resolving the source location for `entire_file`
  errors for a non-existent file. This is the bug underlying #20954.

Resolves: #20954.
2024-08-17 18:50:10 -04:00
mlugg
4e5834a9f2 Compilation: don't queue std analysis twice when testing std 2024-08-17 18:50:10 -04:00
mlugg
8f8fe89276 Zcu: panic on usingnamespace with -fincremental 2024-08-17 18:50:10 -04:00
mlugg
93f2d9a77f Zcu: typo
We were accidentally over-reporting most `namespace_name` deps and *not*
reporting some actually outdated ones!
2024-08-17 18:50:10 -04:00
mlugg
434ad90610 Sema: disable comptime call memoization under -fincremental 2024-08-17 18:50:10 -04:00
mlugg
936a79f428 tools,test: improve incr-check and add new incremental tests 2024-08-17 18:50:10 -04:00
mlugg
aa6c1c40ec frontend: yet more incremental work 2024-08-17 18:50:10 -04:00
mlugg
6faa4cc7e6 Zcu: construct full reference graph
This commit updates `Zcu.resolveReferences` to traverse the graph of
`AnalUnit` references (starting from the 1-3 roots of analysis) in order
to determine which `AnalUnit`s are referenced in an update. Errors for
unreferenced entities are omitted from the error bundle. However, note
that unreferenced `Nav`s are not removed from the binary.
2024-08-17 18:50:10 -04:00
mlugg
b65865b027 tools: improve incr-check
And add a new incremental test to match!
2024-08-17 18:50:10 -04:00
mlugg
895267c916 frontend: incremental progress
This commit makes more progress towards incremental compilation, fixing
some crashes in the frontend. Notably, it fixes the regressions introduced
by #20964. It also cleans up the "outdated file root" mechanism, by
virtue of deleting it: we now detect outdated file roots just after
updating ZIR refs, and re-scan their namespaces.
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
Forest
cf939b096a cmake: CLANG_LIBRARIES: find libclang-cpp.so.18.1
This fixes the failure to find CLANG_LIBRARIES on debian, which packages
the relevant .so file at these paths:

libclang-cpp18: /usr/lib/llvm-18/lib/libclang-cpp.so.18.1
libclang-cpp18: /usr/lib/x86_64-linux-gnu/libclang-cpp.so.18.1
libclang-cpp18: /usr/lib/x86_64-linux-gnu/libclang-cpp.so.18

(The latter two paths are symlinks to the first.)
2024-08-17 13:15:32 -07:00
Jakub Konka
5d2bf96c02
Merge pull request #21098 from ziglang/macho-zig-got
macho: replace __got_zig with distributed jump table
2024-08-17 17:17:01 +02: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
df9ac485da codegen: fix rebase gone wrong 2024-08-17 08:31:16 +02:00
Jakub Konka
96441bd829 macho: update codegen and linker to distributed jump table approach 2024-08-17 08:14:38 +02:00
Jacob Young
bb70501060
Merge pull request #21078 from jacobly0/new-dwarf
Dwarf: rework self-hosted debug info from scratch
2024-08-17 01:15:04 -04:00
Jacob Young
ed19ecd115 Coff: fix missing error lazy symbols 2024-08-16 16:23:53 -04:00
Jacob Young
e9df5ab7f1 std: disable failing debug info test for self-hosted 2024-08-16 16:23:53 -04:00
Jacob Young
0ecf0cf867 x86_64: fix debug arg spills clobbering other args 2024-08-16 15:22:56 -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
ad634537ce x86_64: move end of prologue to after function arguments are spilled
This prevents the first step in to a function from displaying bogus
argument values.
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
David Rubin
f1eed99f3d
add an error for stack allocations in naked functions (#21082)
closes #72
2024-08-16 09:41:58 -07:00
Jakub Konka
73f385eec5
Update src/arch/x86_64/CodeGen.zig
Co-authored-by: Jacob Young <jacobly0@users.noreply.github.com>
2024-08-16 11:49:23 +02:00
Jacob Young
624016e8f3 riscv64: fix incorrect branch target 2024-08-16 05:44:55 -04:00
Andrew Kelley
11176d22f8
Merge pull request #21073 from alexrp/test-changes
`test`: QoL for port work, more mips re-enablement
2024-08-15 22:23:48 -07:00
Andrew Kelley
05c7968920
Merge pull request #21020 from alexrp/target-fixes
`std.Target`: Assorted corrections, plus cleanup around ELF/COFF machine types
2024-08-15 22:13:31 -07:00
Andrew Kelley
b917d778c6
Merge pull request #21056 from alexrp/start-fix-precedence
`start`: Avoid string concatenation in inline asm.
2024-08-15 22:10:59 -07:00
Igor Anić
72bcc3b7a5
std.tar: add writer (#19603)
Simplifies code in docs creation where we used `std.tar.output.Header`.
Writer uses that Header internally and provides higher level interface.
Updates checksum on write, handles long file names, allows setting mtime and file permission mode. Provides handy interface for passing `Dir.WalkerEntry`.
2024-08-15 22:05:53 -07:00
Linus Groh
708414aaf4 std.time.epoch: Fix comments referring to epoch as 1970-10-01 2024-08-15 17:54:27 -07:00
YANG Xudong
8e91c229e1
loongarch: fix asm to set thread pointer (#21086)
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2024-08-15 15:40:44 -07:00
Jakub Konka
9473d76449 test/elf: enhance testImportingDataDynamic 2024-08-15 21:47:34 +02:00
Jakub Konka
4d5bf0f09a x86_64: deref GOT pointer when requesting var value 2024-08-15 14:23:36 +02:00
Alex Rønne Petersen
7a8e86e46c
llvm: Don't emit extra debug instructions for dbg_var_val in naked functions. 2024-08-15 10:56:33 +02:00
Alex Rønne Petersen
acad2fae44
llvm: Remove the aarch64-windows @llvm.dbg.value() workaround.
https://github.com/llvm/llvm-project/issues/56484
2024-08-15 10:56:33 +02:00
Alex Rønne Petersen
2bf244c0e9
llvm: Always omit the frame pointer for naked functions. 2024-08-15 10:56:33 +02:00
Alex Rønne Petersen
ab9628dd2c
start: Avoid concatenating strings for inline asm.
For csky, we can just always do the gb initialization. For riscv, the gp code is
temporarily pulled above the main switch until the blocking issue is resolved.
2024-08-15 10:56:32 +02:00
Alex Rønne Petersen
6db9ad7798
std.Target: Return the correct value for 32-bit sparc v9 in toElfMachine(). 2024-08-15 10:55:46 +02:00
Alex Rønne Petersen
9b5c992d31
std.Target: Return the correct value for elfiamcu in toElfMachine(). 2024-08-15 10:55:46 +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
b01c595d4a
std.coff: Capitalize MachineType.{Unknown,Thumb} for consistency. 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
Alex Rønne Petersen
65affb1c22
std.Target: Don't match PowerPC in Arch.toCoffMachine().
It's entirely unclear whether this should map to POWERPC or POWERPCFP, and as I
can find no evidence of people producing PE files for PowerPC since Windows NT,
let's just not make a likely-wrong guess. We can revisit this if the need ever
actually arises.
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen
b24fc35eeb
std.Target: Don't match big endian architectures in Arch.toCoffMachine().
All of these were mapping to types that are little endian. In fact, I can find
no evidence that either Windows or UEFI have ever been used on big endian
systems.
2024-08-15 10:55:46 +02:00
Alex Rønne Petersen
8516a6ab57
std.Target: Clean up Arch.toCoffMachine(). 2024-08-15 10:55:46 +02:00