Commit Graph

30315 Commits

Author SHA1 Message Date
YANG Xudong
ea847535fc Add loongarch 64 to gen_stubs.zig. 2024-08-04 12:04:39 -07:00
Linus Groh
a18293214d std.Target: Specify dynamic linker and C type sizes for serenity 2024-08-04 12:03:43 -07:00
Andrew Kelley
a931bfada5
Merge pull request #20908 from ziglang/reorg-std.debug-again
std.debug: reorg and clarify API goals
2024-08-02 17:10:41 -07:00
Andrew Kelley
9e2668cd2e
Merge pull request #20906 from alexrp/repro-windows
`ci`: Add stage3/4 diff to Linux (aarch64) and windows (aarch64, x86_64) release scripts.
2024-08-02 15:37:23 -07:00
Andrew Kelley
6d606cc38b reintroduce std.Dwarf.abi.supportsUnwinding
There are two concepts here: one for whether dwarf supports unwinding on
that target, and another for whether the Zig standard library
implements it yet.
2024-08-02 14:15:03 -07:00
Andrew Kelley
975c185b92 fix compilation on powerpc GNU systems
...which have a ucontext_t but not a PC register. The current stack
unwinding implementation does not yet support this architecture.

Also fix name of `std.debug.SelfInfo.openSelf` to remove redundancy.

Also removed this hook into root providing an "openSelfDebugInfo"
function. Sorry, this debugging code is not of sufficient quality to
offer a plugin API right now.
2024-08-02 14:14:59 -07:00
Alex Rønne Petersen
76ebae2ee0
ci: Add stage3/4 diff to aarch64-linux-release script. 2024-08-02 09:56:54 +02:00
Alex Rønne Petersen
6def9cee00
ci: Add stage3/4 diff to (aarch64,x86_64)-windows-release scripts. 2024-08-02 09:56:37 +02:00
Andrew Kelley
48d584e3a3 std.debug: reorg and clarify API goals
After this commit:

`std.debug.SelfInfo` is a cross-platform abstraction for the current
executable's own debug information, with a goal of minimal code bloat
and compilation speed penalty.

`std.debug.Dwarf` does not assume the current executable is itself the
thing being debugged, however, it does assume the debug info has the
same CPU architecture and OS as the current executable. It is planned to
remove this limitation.
2024-08-01 23:11:59 -07:00
Andrew Kelley
290966c249 std.debug: rename Info to SelfInfo
This code has the hard-coded goal of supporting the executable's own
debug information and makes design choices along that goal, such as
memory-mapping the inputs, using dl_iterate_phdr, and doing conditional
compilation on the host target.

A more general-purpose implementation of debug information may be able
to share code with this, but there are some fundamental
incompatibilities. For example, the "SelfInfo" implementation wants to
avoid bloating the binary with PDB on POSIX systems, and likewise DWARF
on Windows systems, while a general-purpose implementation needs to
support both PDB and DWARF from the same binary. It might, for example,
inspect the debug information from a cross-compiled binary.

`SourceLocation` now lives at `std.debug.SourceLocation` and is
documented.

Deprecate `std.debug.runtime_safety` because it returns the optimization
mode of the standard library, when the caller probably wants to use the
optimization mode of their own module.

`std.pdb.Pdb` is moved to `std.debug.Pdb`, mirroring the recent
extraction of `std.debug.Dwarf` from `std.dwarf`.

I have no idea why we have both Module (with a Windows-specific
definition) and WindowsModule. I left some passive aggressive doc
comments to express my frustration.
2024-08-01 22:11:35 -07:00
Andrew Kelley
ab0253f662 std.debug.Info: rename ModuleDebugInfo to Module 2024-08-01 22:11:29 -07:00
Andrew Kelley
1ba6b56c81 std.debug.Info: extract to separate file 2024-08-01 22:11:23 -07:00
Andrew Kelley
2e26cf83cf
Merge pull request #20903 from ziglang/dwarf-reorg
std: dwarf namespace reorg + bonus commits
2024-08-01 21:25:40 -07:00
Andrew Kelley
e5b46eab3b std: dwarf namespace reorg
std.debug.Dwarf is the parsing/decoding logic. std.dwarf remains the
unopinionated types and bits alone.

If you look at this diff you can see a lot less redundancy in
namespaces.
2024-08-01 13:56:12 -07:00
Andrew Kelley
377274ee9a std.debug.DebugInfo: rename to std.debug.Info
avoiding redundancy in the fully qualified namespace
2024-08-01 13:47:42 -07:00
Andrew Kelley
9c84b5cc18 build.zig: fix -Dskip-non-native
now it actually does what it says on the tin
2024-08-01 13:47:29 -07:00
Andrew Kelley
12d0c9a2fc add std.fs.Dir.Handle
mirrors std.fs.File.Handle
2024-08-01 13:47:23 -07:00
Andrew Kelley
5c6f5e6cf2 test runner: avoid spawning progress thread when instrumented
because it causes unwanted concurrent accesses to pc tracking
2024-08-01 13:47:09 -07:00
Alex Rønne Petersen
624fa8523a std.os.linux: Unbreak the build
Happened because I wrote #20869 before #20870.
2024-08-01 13:05:26 +02:00
Andrew Kelley
7a0da805a8
Merge pull request #20797 from alexrp/start-more-arches
`start`: Add POSIX arc, csky, and hexagon support
2024-08-01 01:34:33 -07:00
Andrew Kelley
8f7cbaa4c0
Merge pull request #20870 from alexrp/target-cleanup-3
`std.Target`: Remove more dead OS/architecture tags
2024-08-01 01:32:32 -07:00
Andrew Kelley
f17f73b4fa
Merge pull request #20869 from alexrp/linux-syscalls
`std.os.linux`: Add syscall enums for all remaining architectures
2024-08-01 01:21:10 -07:00
Andrew Kelley
91163b44dd
Merge pull request #20857 from alexrp/tls-porting
`std.os.linux.tls`: Refactor, improve documentation, fix a bug, and port to more architectures
2024-08-01 01:15:17 -07:00
Andrew Kelley
16dde6d260
Merge pull request #20772 from alexrp/linux-audit
`std.os.linux.AUDIT`: Rewrite ARCH in terms of std.elf.EM.
2024-08-01 01:09:22 -07:00
Alex Rønne Petersen
8d5eaadb05 std.Target: Handle loongarch in Os.Tag.archName(). 2024-08-01 01:08:20 -07:00
Alex Rønne Petersen
f03d54f069 std.atomic: Don't lie to the compiler about memory clobbers in spinLoopHint(). 2024-08-01 01:07:56 -07:00
Alex Rønne Petersen
604e87a958 std.Target: Use hexagonv60 as the baseline CPU model for hexagon. 2024-08-01 01:01:24 -07:00
Andrew Kelley
9c22a6b3ad
Merge pull request #20823 from alexrp/start-pie-mips-ppc
`std.os.linux.start_pie`: Add mips and powerpc support
2024-08-01 00:57:10 -07:00
Andrew Kelley
63aa85e7af
Merge pull request #20872 from alexrp/riscv-gp
start: Initialize `gp` to `__global_pointer$` on riscv.
2024-08-01 00:47:05 -07:00
Jakub Konka
8ea323822b
Merge pull request #20884 from Rexicon226/riscv 2024-08-01 07:17:40 +02:00
Andrew Kelley
eb1a199dff
Merge pull request #20885 from ziglang/simplify-tokenizer
std.zig.tokenizer: simplification and spec conformance
2024-07-31 19:52:34 -07:00
Andrew Kelley
059856acfc
Merge pull request #20878 from tiehuis/std-math-complex-fixes
std.math.complex fixes
2024-07-31 19:19:27 -07:00
Andrew Kelley
7c5ee3efde
Merge pull request #20883 from ehaas/aro-translate-c-no-panic
aro-translate-c improvements
2024-07-31 18:53:05 -07:00
Andrew Kelley
c2b8afcac9 tokenizer: tabs and carriage returns spec conformance 2024-07-31 16:57:42 -07:00
Andrew Kelley
a7029496d1 remove hard tabs from source code
these are illegal according to the spec
2024-07-31 16:57:42 -07:00
Andrew Kelley
377e8579f9 std.zig.tokenizer: simplify
I pointed a fuzzer at the tokenizer and it crashed immediately. Upon
inspection, I was dissatisfied with the implementation. This commit
removes several mechanisms:
* Removes the "invalid byte" compile error note.
* Dramatically simplifies tokenizer recovery by making recovery always
  occur at newlines, and never otherwise.
* Removes UTF-8 validation.
* Moves some character validation logic to `std.zig.parseCharLiteral`.

Removing UTF-8 validation is a regression of #663, however, the existing
implementation was already buggy. When adding this functionality back,
it must be fuzz-tested while checking the property that it matches an
independent Unicode validation implementation on the same file. While
we're at it, fuzzing should check the other properties of that proposal,
such as no ASCII control characters existing inside the source code.

Other changes included in this commit:

* Deprecate `std.unicode.utf8Decode` and its WTF-8 counterpart. This
  function has an awkward API that is too easy to misuse.
* Make `utf8Decode2` and friends use arrays as parameters, eliminating a
  runtime assertion in favor of using the type system.

After this commit, the crash found by fuzzing, which was
"\x07\xd5\x80\xc3=o\xda|a\xfc{\x9a\xec\x91\xdf\x0f\\\x1a^\xbe;\x8c\xbf\xee\xea"
no longer causes a crash. However, I did not feel the need to add this
test case because the simplified logic eradicates most crashes of this
nature.
2024-07-31 16:57:42 -07:00
David Rubin
c08effc20a riscv: implement non-pow2 indirect loads 2024-07-31 16:57:30 -07:00
David Rubin
2b8a71489a
start: remove riscv condition 2024-07-31 13:40:00 -07:00
David Rubin
9c7aade488
riscv: fix .got symbol loading 2024-07-31 13:39:57 -07:00
David Rubin
0008934745
riscv: implement @divExact 2024-07-31 11:44:16 -07:00
Evan Haas
1cc74f3cae
aro_translate_c: fix formatting 2024-07-31 10:33:44 -07:00
Evan Haas
aa5a1105e8
aro_translate_c: do not translate atomic types 2024-07-31 10:04:21 -07:00
Evan Haas
6c632d52f9
aro_translate_c: move noreturn test to manifest 2024-07-31 09:35:07 -07:00
Evan Haas
b3f5769930
aro_translate_c: handle opaque struct defs in prototypes 2024-07-31 09:35:07 -07:00
Evan Haas
93a502cb2f
aro_translate_c: move simple function prototype test to manifest 2024-07-31 09:35:07 -07:00
Evan Haas
6a103d87f6
aro_translate_c: basic typedef support 2024-07-31 09:35:07 -07:00
Evan Haas
055077f9dd
aro_translate_c: improve record translation
Move field record decl translation into `transType` instead of `transDecl`
2024-07-31 09:35:07 -07:00
Evan Haas
c57fcd1db5
aro_translate_c: demote functions with bodies to extern
Translating statements is currently not supported; demoting to extern is
better than crashing.
2024-07-31 09:35:07 -07:00
Evan Haas
6997f82e02
translate_c: move empty declaration test to test manifest 2024-07-31 09:35:07 -07:00
Evan Haas
4300a9c417
aro_translate_c: Make function decls public 2024-07-31 09:35:07 -07:00