Commit Graph
28584 Commits
Author SHA1 Message Date
Andrew Kelley 0b1b3f0225 upstream new autodocs implementation 2024-03-10 17:51:06 -07:00
Andrew Kelley 356e653f9b better to use AST than ZIR for doc generation 2024-03-10 17:51:05 -07:00
Andrew Kelley 94daf87335 no 2024-03-10 17:50:54 -07:00
Techatrix 40e64245fc std: expose Config struct of GeneralPurposeAllocator 2024-03-10 14:08:02 -07:00
Jakub Konka c1bda06c14 Merge pull request #19225 from ziglang/elf-aarch64
elf: port aarch64 support from zld
2024-03-10 15:32:58 +01:00
Jakub Konka 1a6b2e84ac test/link/elf: remove pie hack due to QEMU bug that is now fixed 2024-03-10 10:39:31 +01:00
Minsoo Choo 4ba4f94c93 CI: update actions/checkout to v4 (#19228) 2024-03-09 16:37:57 -05:00
Jakub Konka 2cdbad6f10 elf+aarch64: handle PREL64 reloc 2024-03-09 19:34:34 +01:00
Jakub Konka b7b63855d0 test/link/elf: enable tests for aarch64 cpu arch 2024-03-09 19:26:26 +01:00
Jakub Konka 229468b7a9 elf+aarch64: fix 32bit build 2024-03-09 18:55:52 +01:00
mlugg e2cbbd0c26 Sema: perform codegen for anon decl created by @extern
This fixes a bug where, at least with the LLVM backend, `@extern` calls
which had the same name as a normal `extern` in the same Zcu would
result in the `@extern` incorrectly suffixing the identifier `.2`.
Usually, the LLVM backend has a system to change the generated globals
to "collapse" them all together, but it only works if `updateDecl` is
called!
2024-03-09 04:52:06 +00:00
Matthew Lugg 9cf28d1e9b Merge pull request #19214 from mlugg/fuck-usingnamespace
std: fuck usingnamespace
2024-03-08 21:59:07 +00:00
Jakub Konka 859f9a22c4 elf+aarch64: implement basic thunk support 2024-03-08 22:46:18 +01:00
Jakub Konka 7c5ddb6ae4 elf+aarch64: handle PREL32 reloc 2024-03-08 22:46:18 +01:00
Jakub Konka 47100bd40a elf+aarch64: handle TLS GD model 2024-03-08 22:46:18 +01:00
Jakub Konka b343103567 elf+aarch64: handle gottp and .tls_common 2024-03-08 22:46:18 +01:00
Jakub Konka 7258d143e3 elf+aarch64: fix incorrectly emitted TLSDESC relocs 2024-03-08 22:46:17 +01:00
Jakub Konka b5642b4f85 elf+aarch64: set _GLOBAL_OFFSET_TABLE_ to .got section 2024-03-08 22:46:17 +01:00
Jakub Konka d9069cbe2c elf+aarch64: relax TLSDESC for executables 2024-03-08 22:46:17 +01:00
Jakub Konka 310cef0972 elf+aarch64: handle TLSDESC non-relaxed 2024-03-08 22:46:17 +01:00
Jakub Konka 109d2321b0 link: refactor common aarch64 helpers 2024-03-08 22:46:17 +01:00
Jakub Konka c1dbf01aa3 elf+aarch64: resolve TLS LE model 2024-03-08 22:46:17 +01:00
Jakub Konka 69f9f359dd elf+aarch64: use correctly offset tp address 2024-03-08 22:46:17 +01:00
Jakub Konka 0af5d2e9b6 elf+aarch64: implement .plt.got 2024-03-08 22:46:17 +01:00
Jakub Konka 1cf45fb209 elf+aarch64: implement enough to link dynamically with gcc as the driver 2024-03-08 22:46:17 +01:00
mlugg f3227598eb Sema: reset block error return trace index between cases
Resolves: #19210
2024-03-08 07:30:32 -08:00
february cozzocrea b2427ea7d8 test manifest key checking and other fixes
This commit adds several fixes and improvements for the Zig compiler
test harness.

1. -Dskip-translate-c option added for skipping the translate-c tests.
2. translate-c/run-translated-c tests in test/cases/* have been added to
   the steps test-translate-c and test-run-translated-c. Closes #18224.
3. Custom name added to the CheckFile step for the translate-c step to
   better communicate which test failed.
4. Test manifest key validation added to return an error if a manifest
   contains an invalid key.
2024-03-08 02:59:45 -08:00
mlugg 265f42d472 std.os.linux: rework io_uring support
* `linux.IO_Uring` -> `linux.IoUring` to align with naming conventions.
* All functions `io_uring_prep_foo` are now methods `prep_foo` on `io_uring_sqe`, which is in a file of its own.
* `SubmissionQueue` and `CompletionQueue` are namespaced under `IoUring`.

This is a breaking change.

The new file and namespace layouts are more idiomatic, and allow us to
eliminate one more usage of `usingnamespace` from the standard library.
2 remain.
2024-03-08 08:02:45 +00:00
mlugg a7f6e73812 std.os.windows: eliminate usage of usingnamespace
Some of the structs I shuffled around might be better namespaced under
CONTEXT, I'm not sure. However, for now, this approach preserves
backwards compatibility.

Eliminates one more usage of `usingnamespace` from the standard library.
3 remain.
2024-03-08 08:02:45 +00:00
mlugg f4bf061d8a std.c: remove unnecessary use of usingnamespace
Thanks to Zig's lazy analysis, it's fine for these symbols to be
declared on platform they won't exist on. This is already done in
several places in this file; e.g. `pthread` functions are declared
unconditionally.

Eliminates one more usage of `usingnamespace` from the standard library.
4 remain.
2024-03-08 08:02:45 +00:00
mlugg 508a8739e2 std.c.openbsd: remove nop usingnamespace
I have no idea why this was even here...

Eliminates one more usage of `usingnamespace` from the standard library.
5 remain.
2024-03-08 08:02:45 +00:00
mlugg 474d17c13a std.c: do not use usingnamespace to define getcontext
Eliminates one more usage of `usingnamespace` from the standard library.
2024-03-08 08:02:44 +00:00
mlugg 17f83ace03 std.enums: remove IndexedMap, IndexedArray, IndexedSet
Searching GitHub indicated that the only use of these types in the wild is
support in getty-zig, and testing for that support. This eliminates 3 more uses
of usingnamespace from the standard library, and removes some unnecessarily
complex generic code.
2024-03-08 08:02:44 +00:00
mlugg 229800482d std.os.linux: do not use usingnamespace to define getauxval
This usage of `usingnamespace` was removed fairly trivially - the
resulting code is, IMO, more clear.

Eliminates one more usage of `usingnamespace` from the standard library.
2024-03-08 08:02:44 +00:00
mlugg 14ab9fb154 std.os.linux: remove unnecessary use of usingnamespace
This is a trivial change - this code did `usingnamespace` into an
otherwise empty namespace, so the outer namespace was just unnecessary.

Eliminates one more usage of `usingnamespace` from the standard library.
2024-03-08 08:02:44 +00:00
Andrew Kelley 83e578a181 Merge pull request #19163 from ianic/zlib_no_lookahead
compress.zlib: don't overshoot underlying reader
2024-03-07 18:46:47 -08:00
Andrew Kelley 97aa5f7b8a Merge pull request #19190 from mlugg/struct-equivalence
compiler: namespace type equivalence based on AST node + captures
2024-03-07 18:41:45 -08:00
mlugg 38331b1cab Package.Module: actually set File.path_digest for builtin modules 2024-03-07 06:26:25 +00:00
Dillen Meijboom 377ecc6afb feat: add support for --enable-new-dtags and --disable-new-dtags 2024-03-06 17:52:05 -08:00
Jacob Young aa7d16aba1 grammar: remove gratuitous ambiguity
Previously, the following matched both ContainerField alternatives:
 * [IDENTIFIER]
 * [IDENTIFIER][COLON][TypeExpr]
2024-03-06 13:59:46 -08:00
mlugg b41a0b4768 Package.Module: deduplicate identical builtin modules
Previously, when multiple modules had builtin modules with identical
sources, two distinct `Module`s and `File`s were created pointing at the
same file path. This led to a bug later in the frontend. These modules
are now deduplicated with a simple hashmap on the builtin source.
2024-03-06 21:26:39 +00:00
mlugg 4c05a9a892 Sema: do not destroy enum type if field analysis fails 2024-03-06 21:26:38 +00:00
mlugg e1d8187028 cases: correct after #18816
I changed an error messages and fixed a minor bug while implementing
this proposal, which led to a few compile error cases failing.
2024-03-06 21:26:38 +00:00
mlugg e043fe474f Fix incorrectly resolved merge conflicts
To be honest, I can't be bothered to figure out which commits these
changes should be in.
2024-03-06 21:26:38 +00:00
mlugg 20403ee41d behavior: add tests for #18816 2024-03-06 21:26:38 +00:00
mlugg a7cac5fc8e behavior: correct tests after #18816 2024-03-06 21:26:38 +00:00
mlugg 2c4ac44f25 compiler: treat decl_val/decl_ref of potentially generic decls as captures
This fixes an issue with the implementation of #18816. Consider the
following code:

```zig
pub fn Wrap(comptime T: type) type {
    return struct {
        pub const T1 = T;
        inner: struct { x: T1 },
    };
}
```

Previously, the type of `inner` was not considered to be "capturing" any
value, as `T1` is a decl. However, since it is declared within a generic
function, this decl reference depends on the context, and thus should be
treated as a capture.

AstGen has been augmented to tunnel references to decls through closure
when the decl was declared in a potentially-generic context (i.e. within
a function).
2024-03-06 21:26:38 +00:00
mlugg d0c022f734 compiler: namespace type equivalence based on AST node + captures
This implements the accepted proposal #18816. Namespace-owning types
(struct, enum, union, opaque) are no longer unique whenever analysed;
instead, their identity is determined based on their AST node and the
set of values they capture.

Reified types (`@Type`) are deduplicated based on the structure of the
type created. For instance, if two structs are created by the same
reification with identical fields, layout, etc, they will be the same
type.

This commit does not produce a working compiler; the next commit, adding
captures for decl references, is necessary. It felt appropriate to split
this up.

Resolves: #18816
2024-03-06 21:26:37 +00:00
mlugg 8ec6f730ef compiler: represent captures directly in InternPool
These were previously associated with the type's namespace, but we need
to store them directly in the InternPool for #18816.
2024-03-06 21:26:37 +00:00
mlugg 975b859377 InternPool: create specialized functions for loading namespace types
Namespace types (`struct`, `enum`, `union`, `opaque`) do not use
structural equality - equivalence is based on their Decl index (and soon
will change to AST node + captures). However, we previously stored all
other information in the corresponding `InternPool.Key` anyway. For
logical consistency, it makes sense to have the key only be the true key
(that is, the Decl index) and to load all other data through another
function. This introduces those functions, by the name of
`loadStructType` etc. It's a big diff, but most of it is no-brainer
changes.

In future, it might be nice to eliminate a bunch of the loaded state in
favour of accessor functions on the `LoadedXyzType` types (like how we
have `LoadedUnionType.size()`), but that can be explored at a later
date.
2024-03-06 21:26:37 +00:00