11036 Commits

Author SHA1 Message Date
Jakub Konka
4b1a883d35 macho: ensure local syms buffer is nlist_64 aligned when re-reading from file 2023-02-07 03:14:26 +01:00
Jakub Konka
f63eda3f6a macho: parse and sort data-in-code entries ahead of time 2023-02-06 16:08:42 +01:00
Jakub Konka
b32f5ee932 macho: downgrade alignment requirements for symtab in object files
Parse and sort relocations by address descending.
2023-02-06 13:23:08 +01:00
Andrew Kelley
11cc1c16fa make @embedFile support module-mapped names the same way as @import
closes #14553
2023-02-05 03:25:43 -05:00
Luuk de Gram
c9b957c937 link: remove FnData and make it self-owned
This finishes the work started in #14502 where atoms are owned by the
linker themselves. This now makes debug atoms fully owned by dwarf,
and no information is left stored on the decl.
2023-02-03 22:55:46 +01:00
Andrew Kelley
60935decd3
Merge pull request #14523 from ziglang/zon
introduce Zig Object Notation and use it for the build manifest file (build.zig.zon)
2023-02-03 14:20:49 -05:00
Loris Cro
e59ef95a40
Merge pull request #14515 from der-teufel-programming/autodoc-quickfixes
autodoc: Added `@qualCast` builtin function handling
2023-02-03 17:55:31 +01:00
Loris Cro
93c56a70c4
Merge pull request #14489 from der-teufel-programming/autodoc-initempty
autodoc: Implemented struct_init_empty for walkInstruction
2023-02-03 17:52:23 +01:00
Andrew Kelley
81c27c74bc use build.zig.zon instead of build.zig.ini for the manifest file
* improve error message when build manifest file is missing
 * update std.zig.Ast to support ZON
 * Compilation.AllErrors.Message: make the notes field a const slice
 * move build manifest parsing logic into src/Manifest.zig and add more
   checks, and make the checks integrate into the standard error
   reporting code so that reported errors look sexy

closes #14290
2023-02-03 00:06:11 -07:00
Andrew Kelley
873bb29c98 introduce ZON: Zig Object Notation
* std.zig.parse is moved to std.zig.Ast.parse
 * the new function has an additional parameter that requires passing
   Mode.zig or Mode.zon
 * moved parser.zig code to Parse.zig
 * added parseZon function next to parseRoot function
2023-02-03 00:06:11 -07:00
Andrew Kelley
7505d19e93
Merge pull request #14511 from ziglang/zig-build-hashes
two package hash breaking enhancements
2023-02-02 14:03:41 -05:00
Krzysztof Wolicki Der Teufel
c3abb63fe9 autodoc: Added @qualCast builtin function handling 2023-02-02 14:47:16 +01:00
Andrew Kelley
6b7ad22981
Merge pull request #14477 from Vexu/fixes
Improve `@ptrCast` errors, fix some bugs
2023-02-01 23:31:52 -05:00
Andrew Kelley
24ff8a1a5f zig build: use multihash for the hash field
https://multiformats.io/multihash/

Still, only SHA2-256 is supported. This is only intended to future-proof
the hash field of the manifest.

closes #14284
2023-02-01 20:02:35 -07:00
Andrew Kelley
ea6e0e33a7 zig build: add executable bit and file path to package hash
Unfortunately, due to the Windows equivalent of executable permissions
being a bit tricky, there is follow-up work to be done.

What is done in this commit is the hash modifications. At the fetch
layer, executable bits inside packages are ignored. In the hash
computation layer, executable bit is implemented for POSIX but not yet
for Windows. This means that the hash will not break again in the future
for packages that do not have any executable files, but it will break
for packages that do.

This is a hash-breaking change.

Closes #14308
2023-02-01 18:42:29 -07:00
Jakub Konka
304420b99c
Merge pull request #14502 from ziglang/link-owned-atoms
link: move ownership of linker atom from frontend to the linkers
2023-02-02 01:39:01 +01:00
Veikka Tuominen
629c3108aa AstGen: fix orelse type coercion in call arguments
Closes #14506
2023-02-02 00:31:35 +02:00
Evan Typanski
86ec26b1f0 translate-c: Fix types on assign expression bool 2023-02-01 21:45:53 +02:00
Veikka Tuominen
490addde27 Sema: fix error location on comptime arg to typed generic param
Closes #14505
2023-02-01 20:50:43 +02:00
Jakub Konka
beb20d29db link: remove union types which are now internal to backends 2023-02-01 19:32:54 +01:00
Luuk de Gram
46f54b23ae
link: make Wasm atoms fully owned by the linker 2023-02-01 19:10:56 +01:00
Jakub Konka
1aa0f8aa2f link: fix pointer invalidation issues in Elf, MachO and Coff 2023-02-01 17:46:57 +01:00
Jakub Konka
e0f3975fc8 link: make SpirV atoms fully owned by the linker 2023-02-01 16:01:43 +01:00
Jakub Konka
5de2aae63c link: decouple DI atoms from linker atoms, and manage them in Dwarf linker 2023-02-01 15:03:55 +01:00
Jakub Konka
d98fc53b8f link: use strtab.StringTable in Dwarf 2023-02-01 11:49:07 +01:00
Jakub Konka
b3277c8936 link: make Plan9 atoms fully owned by the linker 2023-02-01 11:12:53 +01:00
Jakub Konka
9fdc32c96e link: clean up type resolution in Elf.Atom and MachO.Atom 2023-02-01 09:13:49 +01:00
praschke
2ccff51154 mingw: repair msvcrt-os build flags
__LIBMSVCRT__ is still used and is distinct from __LIBMSVCRT_OS__
2023-01-31 23:25:02 -05:00
Andrew Kelley
efa25e7d5b
Merge pull request #14498 from ziglang/zig-build-api
Several enhancements to the build system. Many breaking changes to the API.

 * combine `std.build` and `std.build.Builder` into `std.Build`
 * eliminate `setTarget` and `setBuildMode`; use an options struct for `b.addExecutable` and friends
 * implement passing options to dependency packages. closes #14285
 * rename `LibExeObjStep` to `CompileStep`
 * move src.type.CType to std lib, use it from std.Build, this helps with populating config.h files.
2023-01-31 23:15:59 -05:00
Luuk de Gram
6f13a725a3
Merge pull request #14494 from Techatrix/wasm-optional-slice
wasm: correctly handle optional slices
2023-01-31 23:11:58 +01:00
Andrew Kelley
2f5892671e move compiler's CType logic to std.Target
This API only depends on std.Target and is extremely useful in build
scripts when populating configure files.
2023-01-31 15:09:35 -07:00
Andrew Kelley
73cf7b6429 update build.zig API usage 2023-01-31 15:09:35 -07:00
Jakub Konka
c430e9afa7 link: make Coff atoms fully owned by the linker 2023-01-31 20:27:17 +01:00
Jakub Konka
4404c4d200 link: make Elf atoms fully owned by the linker 2023-01-31 17:54:12 +01:00
Techatrix
47ff57ed7d wasm: apply request change 2023-01-31 17:01:56 +01:00
r00ster91
17404f8e6e Sema: emit compile error for comptime or inline call of function pointer 2023-01-31 17:15:34 +02:00
Techatrix
1f64432196 wasm: correctly handle optional slices 2023-01-31 00:59:18 +01:00
Jakub Konka
d42a931051 link: make MachO atoms fully owned by the linker 2023-01-31 00:43:25 +01:00
Veikka Tuominen
f16c10a86b implement @qualCast 2023-01-30 18:55:57 +02:00
Veikka Tuominen
fe4ea31f7e Sema: replace backticks with single quotes
Most error messages already use single quotes for everything
so this makes the remaining ones consistent.
2023-01-30 15:20:16 +02:00
Veikka Tuominen
a9785fe8ee Sema: add helpful notes to invalid @ptrCast operations
Closes #14474
2023-01-30 15:20:16 +02:00
Veikka Tuominen
b129350cb5 AstGen: fix crash on invalid decltest
Closes  #14476
2023-01-30 15:20:16 +02:00
Veikka Tuominen
720d82721f Sema: ensure args to inline comptime args are comptime-known
Closes #14413
2023-01-30 15:20:16 +02:00
Veikka Tuominen
92dfc07489 TypedValue: fix crash when string-like aggregate has undefined element
Closes #6334
2023-01-29 23:16:45 +02:00
Isaac Freund
23b7d28896 std: restrict mem.span() and mem.len() to sentinel terminated pointers
These functions are currently footgunny when working with pointers to
arrays and slices. They just return the stated length of the array/slice
without iterating and looking for the first sentinel, even if the
array/slice is a sentinel terminated type.

From looking at the quite small list of places in the standard
library/compiler that this change breaks existing code, the new code
looks to be more readable in all cases.

The usage of std.mem.span/len was totally unneeded in most of the cases
affected by this breaking change.

We could remove these functions entirely in favor of other existing
functions in std.mem such as std.mem.sliceTo(), but that would be a
somewhat nasty breaking change as std.mem.span() is very widely used for
converting sentinel terminated pointers to slices. It is however not at
all widely used for anything else.

Therefore I think it is better to break these few non-standard and
potentially incorrect usages of these functions now and at some later
time, if deemed worthwhile, finally remove these functions.

If we wait for at least a full release cycle so that everyone adapts to
this change first, updating for the removal could be a simple find and
replace without needing to worry about the semantics.
2023-01-29 15:07:06 -05:00
kcbanner
a9b68308b9 cbe: fixes for tls, support for not linking libc, and enabling tests
- cbe: Implement linksection support, to support TLS when not linking libc
- cbe: Support under-aligned variables / struct fields
- cbe: Support packed structs (in the C definition of packed)
- windows: Fix regression with x86 _tls_array
- compiler_rt: Add 128-bit atomics to compiler_rt
- tests: Re-enable threadlocal tests on cbe+windows, and llvm+x86
- tests: Re-enable f80 tests that now pass
- ci: change windows ci to run the CBE behaviour tests with -lc, to match how the compiler is bootstrapped
- update zig1.wasm
2023-01-29 15:04:13 -05:00
kcbanner
fcb05ee2e7 cbe: don't emit unused undefined array literals 2023-01-29 15:02:04 -05:00
joachimschmidt557
090186a0c2 stage2 AArch64: move copy-register-arg-to-stack code to fn prologue
This enhances the debugging experience as upon encountering a
breakpoint in a function, all arguments passed as registers have
already been moved to the stack, ready to be inspected by the
debugger.
2023-01-29 20:00:53 +01:00
Krzysztof Wolicki Der Teufel
76fcb95bdf autodoc: Implemented struct_init_empty for walkInstruction, fixed variable type with has_init but no type before = 2023-01-29 14:42:18 +01:00
Jakub Konka
a898729139 self-hosted: remove allocateDeclIndexes from the public link.File API 2023-01-27 19:51:06 +01:00