4620 Commits

Author SHA1 Message Date
Jakub Konka
a56749b654 macos: rewrite logic for generating stack traces on macOS
In order to be linker-independent, when parsing debug info in each
linked OSO, we also create a quick lookup table for symbols defined
within the OSO. We then use this lookup to map symbol from the EXE
to its defined address within the original OSO which we can then
use to extract its associated DWARF info (if any).
2021-11-30 16:13:01 +01:00
Jakub Konka
86fe47235e macho: move nlist_64 type/flags helpers to std.macho 2021-11-30 13:59:33 +01:00
Andrew Kelley
902df103c6 std lib API deprecations for the upcoming 0.9.0 release
See #3811
2021-11-30 00:13:07 -07:00
Andrew Kelley
ec10e63f49 std: add workaround for failing io_uring test
See #10247
2021-11-29 18:04:28 -07:00
Jan Philipp Hafer
1ea650bb75 compiler_rt: add __popcountsi2, __popcountdi2 and __popcountti2
- apply simpler approach than LLVM for __popcountdi2
  taken from The Art of Computer Programming and generalized
- rename popcountdi2.zig to popcount.zig
- test cases derived from popcountdi2_test.zig
- tests: compare naive approach 10_000 times with
  random numbers created from naive seed 42

    See #1290
2021-11-29 12:50:25 -08:00
Stephen Gutekanst
b613210140
compiler_rt: implement __isPlatformVersionAtLeast (Objective-C @available expressions) for Darwin (#10232) 2021-11-29 14:54:23 -05:00
Luuk de Gram
adf059f272
wasm: Update wasm stage2 test backend to use 'main' 2021-11-29 08:05:51 +01:00
Luuk de Gram
dd49eca342
wasm: Implement 'zig test'
- This implements the required codegen for decl types such as pointers, arrays, structs and more.
- Wasm's start function can now use both a 'u8' and 'void' as return type. This will help us with writing tests
using the stage2 testing backend. (Until all tests of behavioural tests pass).
- Now correctly generates relocations for function pointers.
- Also implements unwrapping error union error, as well as return pointers.
2021-11-28 20:25:33 +01:00
Luuk de Gram
90d8544d40
wasm: Add temporary stage2 entrypoint for wasm 2021-11-27 21:34:48 +01:00
Luuk de Gram
f56ae69edd
wasm-linker: Upstream zwld into stage2
- Converts previous `DeclBlock` into `Atom`'s to also make them compatible when
the rest of zlwd gets upstreamed and we can link with other object files.
- Resolves function signatures and removes any duplicates, saving us a lot of
potential bytes for larger projects.
- We now create symbols for each decl of the respective type
- We can now (but not implemented yet) perform proper relocations.
- Having symbols and segment_info allows us to create an object file
for wasm.
2021-11-27 15:02:01 +01:00
Andrew Kelley
d43ebf562d zig build: add each_lib_rpath property
Maps to `-feach-lib-rpath` and `-fno-each-lib-rpath`.

Closes #8800
2021-11-26 21:22:33 -07:00
chwayne
755eeb7be0
zig fmt: Fix performance issue with nested arrays (#10224)
* Remove double recursive call in renderArrayInit
* Preserve an empty line before a comment line

Fixes #10194
2021-11-26 23:02:09 -05:00
Andrew Kelley
b097545a5f zig cc: honor all -m and -mno- CPU feature flags
closes #9196
2021-11-26 19:59:33 -07:00
Isaac Freund
b196dd1d79 std.system: fix slice bounds in preadMin()
If a partial read occurs past the halfway point, buf.len - i will be
less than i, which is illegal. The end bound is also entirely unecessary
in this case, so just remove it.
2021-11-26 14:35:46 -08:00
Jakub Konka
e2b6dfa608 macos: do not trigger CLT installation popup when using zig cc
On a bare macOS, when there is no CLT/Xcode installed, do not
trigger the CLT installation popup when building with zig cc.
2021-11-26 18:09:14 +01:00
Jakub Konka
8317dbd1cb macos: detect SDK path and version, then pass to the linker
Since we are already detecting the path to the native SDK,
if available, also fetch SDK's version and route that to the linker.
The linker can then use it to correctly populate LC_BUILD_VERSION
load command.
2021-11-26 16:26:44 +01:00
Jakub Konka
d6f43a1eac bpf: do not invoke lld when linking eBPF relocatables
Due to a deficiency in LLD, we need to special-case BPF to a simple
file copy when generating relocatables. Normally, we would expect
`lld -r` to work. However, because LLD wants to resolve BPF relocations
which it shouldn't, it fails before even generating the relocatable.

Co-authored-by: Matthew Knight <mattnite@protonmail.com>
2021-11-26 10:53:30 +01:00
Fabio Arnold
da7baf7dae
std.mem.indexOfPos should return start_index when needle length is zero (#10220)
Closes #10216
2021-11-25 20:56:38 -05:00
Jakub Konka
a041401256 libstd: fix bug in std.Thread.Futex selecting incorrect default macOS version 2021-11-25 22:20:32 +01:00
Jakub Konka
c42439dff9 Pass inferred cpu_arch to defaultVersionRange
This is mainly because arm64 macOS doesn't support all
versions supported by x86_64 macOS. This is just a temporary
thing until both architectures support the same set of OSes.
2021-11-25 12:19:16 +01:00
Jakub Konka
42a351e099 infer and match macos sdk version for libc headers 2021-11-25 12:19:16 +01:00
Andrew Kelley
6b87f0dc56 build system: add --debug-log advanced option to build runner 2021-11-24 23:08:16 -07:00
tjohnes
a130eac785 zig fmt: fix formatting for single-line containers with comments
* Fixes #8810.
* Prevent a single-line container declaration if it contains a comment
  or multiline string.
* If a container declaration cannot be single-line, ensure container
  fields are rendered with a trailing comma.
* If `Space.comma` is passed to `renderExpressionComma` or
  `renderTokenComma`, and there already exists a comma in the source,
  then render one comma instead of two.
2021-11-24 18:45:09 -08:00
Andrew Kelley
36c8adf589
Merge pull request #10073 from hoanga/haiku-support-build2
more haiku support
2021-11-24 18:42:30 -08:00
Andrew Kelley
c42763f8cc AstGen: use reachableExpr for return operand
Related: #9630
2021-11-24 14:47:33 -07:00
Marc Tiehuis
8f1e417757 std/math: add ldexp and make scalbn an alias
We assume we are compiled on a base-2 radix floating point system. This
is a reasonable assumption. musl libc as an example also assumes this.

We implement scalbn as an alias for ldexp, since ldexp is defined as 2
regardless of the float radix. This is opposite to musl which defines
scalbn in terms of ldexp.

Closes #9799.
2021-11-23 14:47:01 -05:00
Hiroaki Nakamura
f5c0c0803f
Merge pull request #10151 from hnakamur/zig
io_uring: adds link_timeout
2021-11-23 12:32:25 -06:00
Stephen von Takach
ed70f9981c
feat(uefi): add virtual addressing helpers (#10195)
based off definitions in https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_6.pdf
2021-11-22 21:32:16 -05:00
Lewis Gaul
bc3e86c4b7 Add std.meta.Float, alongside std.meta.Int 2021-11-22 21:30:20 -05:00
Trioct
b644d49365 Fix type error for u8 in writeIntSlice 2021-11-21 16:47:39 -05:00
J.C. Moyer
939f51aebb compiler_rt: export floorf, floor, and floorl
This fixes a stage1 linker error when compiling with VS2022 on Windows.
2021-11-21 16:44:21 -05:00
Dante Catalfamo
12140ead43 Change darwin c.VMIN -> c.V.MIN to match Linux 2021-11-21 16:43:16 -05:00
Ali Chraghi
a699d678b2
add NotLink error (#9877)
Closes #9872

Co-authored-by: Ryan Liptak <squeek502@hotmail.com>
2021-11-20 15:49:22 -05:00
Evan Haas
3fefdc1a0b translate-c: Allow negative denominator in remainder (%) operator
Fixes #10176
2021-11-20 13:52:07 -05:00
joachimschmidt557
e8112f7744 stage2 RISCV64: implement basic function prologue and epilogue 2021-11-20 19:25:59 +01:00
Meghan
c84147f90d
std: add writer methods on all crypto.hash types (#10168) 2021-11-20 01:37:17 -08:00
Dante Catalfamo
54bcd1cd51
Add OpenBSD termios constants to std.c.openbsd (#10178) 2021-11-20 01:34:53 -08:00
Rohlem
a83fb9289f std.bounded_array: fix self parameter type in constSlice
Because `.buffer` is an inline array field, we actually require `self` to be passed as a pointer.
If the compiler decided to pass the object by copying, we would return a pointer to to-be-destroyed stack memory.
2021-11-20 02:35:36 -05:00
Al Hoang
be541ca5e1 haiku follow up cleanup of constants 2021-11-19 22:04:09 -06:00
Andrew Kelley
e24dcd2707 std.builtin.StackTrace: format() workaround on freestanding
This whole thing needs to be reworked but for now at least don't cause a
compile error when building for a target that doesn't have stderr or
detectTTYConfig.
2021-11-19 19:15:14 -07:00
Kenta Iwasaki
00966b7258 compiler_rt: disable spinlocks for atomic instrinsics for bpf
The BPF target does not support mutable global variables. Mark the BPF
target as a target that does not support atomic variables in order to
avoid including the global spinlock table provided in compiler_rt.
2021-11-18 13:16:35 -05:00
Felix "xq" Queißner
2fefd4ea8e Fixes invalid errno definition for ***-linux-android 2021-11-18 12:58:28 -05:00
Vincent Rischmann
3d528161c8 io_uring: implement register_files_update 2021-11-16 19:54:19 -05:00
Jonathan Marler
9c1c1d478d add print field to RunStep
A new print field is added to RunStep that will control whether it prints the cmd before running it.  By default it will be set to builder.verbose which means it will print only if builder.verbose is true.
2021-11-16 16:35:12 -05:00
Marc Tiehuis
dcd88ae568 std/json: use bit-stack for nesting instead of large LLVM integer type
The stack has been adjusted so that instead of pushing to index 0 in the
integer we push to the current end/index of the underlying integer. This
means we don't require a shift for every limb after each push/pop and
instead only require a mask/or and add/sub on a single element of the array.

Fixes #5959.
2021-11-16 16:33:56 -05:00
Andrew Kelley
c587be78d7
Merge pull request #10016 from courajs/array-build-options
Various build options (OptionsStep) fixes
2021-11-16 16:31:46 -05:00
Ominitay
796687f156 Add chmod and chown 2021-11-15 20:04:55 -05:00
Lewis Gaul
dfd604834b Fix copy-paste error that results in incorrect results from exp64() 2021-11-15 19:40:03 -05:00
Chris Heyes
5d2a77cd9a
Json Stringify option to not write out null optional fields (#8979) 2021-11-15 18:56:51 -05:00
lucky
590880158a
update docs (#10150)
add fast kdf test
fix inconsistent kdf error
refactor

Co-authored-by: lucky <>
2021-11-15 20:48:24 +01:00