Commit graph

16271 commits

Author SHA1 Message Date
Andrew Kelley
6d44a6222d Release 0.9.1 2022-02-14 13:03:19 -07:00
Andrew Kelley
be097cdba8 langref: correct info about type info of declarations 2022-02-14 12:57:57 -07:00
Al Hoang
9f6b9850ac haiku add missing cimport include for compilation 2022-02-14 12:57:46 -07:00
Tw
f9af406341 Fix preadv/pwritev bug on 64bit platform
Signed-off-by: Tw <wei.tan@intel.com>
2022-02-14 12:48:55 -07:00
Jakub Konka
8bf14231b2 macho: put linker symlink for cache invalidation in zig-cache
Due to differences in where the output gets emitted in stage1 and stage2,
we were putting the symlink next to the binary rather than in `zig-cache`
directory when building with stage2.
2022-02-14 12:48:13 -07:00
Andrew Kelley
d2398cf009 CLI: ignore -lgcc_s when it is redundant with compiler-rt
For some projects, they can't help themselves, -lgcc_s ends up on the
compiler command line even though it does not belong there. In Zig we
know what -lgcc_s does. It's an alternative to compiler-rt. With this
commit we emit a warning telling that it is unnecessary to put such
thing on the command line, and happily ignore it, since we will fulfill
the dependency with compiler-rt.
2022-02-11 12:14:42 -07:00
Andrew Kelley
0d006afb23 Merge pull request #10834 from ziglang/fix-x86-i128-c-abi
stage1: fix x86 i128 C ABI for extern structs
2022-02-11 12:14:32 -07:00
billzez
bf6af1963c update RwLock to use static initialization (#10838) 2022-02-11 12:13:51 -07:00
Andrew Kelley
45d4e2f816 cmake: fix -DZIG_SINGLE_THREADED option
It was still passing --single-threaded instead of -fsingle-threaded.
2022-02-11 12:13:22 -07:00
Andrew Kelley
46c3d9c571 stage2: fix crash_report segfault compile error
Regressed in 05cf69209e.
2022-02-11 12:13:03 -07:00
Andrew Kelley
c4458e1b45 Merge pull request #10813 from marler8997/windowsChildHang
child_process: collectOutputWindows handle broken_pipe from ReadFile
2022-02-11 12:12:49 -07:00
John Schmidt
fbde43524f debug: implement segfault handler for macOS aarch64
Tested on a M1 MacBook Pro, macOS Monterey 12.2.
2022-02-11 12:12:38 -07:00
Andrew Kelley
8e10c80c5f std: fix i386-openbsd failing to build from source
closes #9705
2022-02-07 12:24:19 -07:00
Evan Haas
a8bd36c3d2 std: Allow mem.zeroes to work at comptime with extern union
Fixes #10797
2022-02-07 12:23:56 -07:00
boofexxx
2e95bb0e29 std: fix doc comment typo in os.zig 2022-02-07 12:23:11 -07:00
Kirk Scheibelhut
3c40cf1693 Various documentation fixes
Co-authored-by: Kirk Scheibelhut <kjs@scheibo.com>
Co-authored-by: extrasharp <genericpb@gmail.com>
2022-02-07 12:22:06 -07:00
Kazuki Sakamoto
5cfc22bd36 stage1: Fix missing LLD library 2022-02-07 12:21:59 -07:00
Andrew Kelley
a418c59546 link.MachO: fix merge conflict artifact
This happened from cherry-picking bug fixes from master branch.
2022-02-02 22:13:45 -07:00
Andrew Kelley
a0cd4c0f32 CLI: link_libcpp implies link_libc
Improves a warning message for some cases of using `zig run -lc++`.
2022-02-02 22:11:08 -07:00
Jakub Konka
d107ef8697 Merge pull request #10769 from ziglang/link-lib-fixes
stage2: handle name-qualified imports in sema, add a zerofill sections workaround to incremental macho
2022-02-02 22:10:59 -07:00
Andrew Kelley
cee0f082df Merge pull request #10743 from m-radomski/master
std: correct rounding in parse_hex_float.zig
2022-02-02 22:07:56 -07:00
John Schmidt
23d148e5c7 debug: fix edge cases in macOS debug symbol lookup
This commit fixes two related things:

1. If the loop goes all the way through the slice without a match, on
   the last iteration `mid == symbols.len - 1` which causes
   `&symbols[mid + 1]` to be out of bounds. End one step before that
   instead.

2. If the address we're looking for is greater than the address of the
   last symbol in the slice, we now match it to that symbol. Previously,
   we would miss this case since we only matched if the address was _in
   between_ the address of two symbols.
2022-02-02 22:06:32 -07:00
Jonathan Marler
eace6906ce remove __muloti4 from libc++
fixes https://github.com/ziglang/zig/issues/10719

compiler_rt already provides __muloti4 but libc++ is also providing it and when linking libc++ it causes a crash on my windows x86_64 machine.
2022-02-02 22:04:42 -07:00
Jakub Konka
ac3ac255a2 Merge pull request #10404 from ominitay/iterator
std: Fix using `fs.Dir.Iterator` twice
2022-02-02 22:04:36 -07:00
Jean Dao
69f46cab55 fix argsAlloc buffer size
The buffer `buf` contains N (= `slice_sizes.len`) slices followed by the
N null-terminated arguments. The N null-terminated arguments are stored
in the `contents` array list. Thus, `buf` size should be:
    @sizeOf([]u8) * slice_sizes.len + contents_slice.len

Instead of:
    @sizeOf([]u8) * slice_sizes.len + contents_slice.len + slice_sizes.len

This bug was found thanks to the gpa allocator which checks if freed
size matches allocated sizes for large allocations.
2022-02-02 22:04:02 -07:00
Andrew Kelley
452c35656e ci: azure: update to newer msys2 release 2022-02-02 22:03:55 -07:00
Jonathan S
a24f4d8da4 Fix overflow in std.math.isNormal when applied to -Inf or a negative NaN 2022-02-02 22:03:47 -07:00
John Schmidt
5762b6d218 std.fmt: fix out-of-bounds array write in float printing
This commit fixes an out of bounds write that can occur when
formatting certain float values. The write messes up the stack and
causes incorrect results, segfaults, or nothing at all, depending on the
optimization mode used.

The `errol` function writes the digits of the float into `buffer`
starting from index 1, leaving index 0 untouched, and returns `buffer[1..]`
and the exponent. This is because `roundToPrecision` relies on index 0 being
unused in case the rounding adds a digit (e.g rounding 999.99
to 1000.00). When this happens, pointer arithmetic is used
[here](0e6d2184ca/lib/std/fmt/errol.zig (L61-L65))
to access index 0 and put the ones digit in the right place.

However, `errol3u` contains two special cases: `errolInt` and `errolFixed`,
which return from the function early. For these two special cases
index 0 was never reserved, and the return value contains `buffer`
instead of `buffer[1..]`. This causes the pointer arithmetic in
`roundToPrecision` to write out of bounds, which in the case of
`std.fmt.formatFloatDecimal` messes up the stack and causes undefined behavior.

The fix is to move the slicing of `buffer` to `buffer[1..]` from `errol3u`
to `errol` so that both the default and the special cases operate on the sliced
buffer.
2022-02-02 22:01:47 -07:00
John Schmidt
8b5e4af78e fmt: handle doc comments on struct members
Closes https://github.com/ziglang/zig/issues/10443.
2022-02-02 22:01:38 -07:00
Andrew Kelley
aad6ef1fc3 glibc: version-gate _DYNAMIC_STACK_SIZE_SOURCE
This is a patch to glibc features.h which makes
_DYNAMIC_STACK_SIZE_SOURCE undefined unless the version is >= 2.34.

This feature was introduced with glibc 2.34 and without this patch, code
built against these headers but then run on an older glibc will end up
making a call to sysconf() that returns -1 for the value of SIGSTKSZ
and MINSIGSTKSZ.

Closes #10713
2022-02-02 22:01:09 -07:00
Andrew Kelley
b54f6186ac build.zig: fix single-threaded option
Instead of defaulting to false, just keep the option as optional to
communicate default to the build system.

Fixes one problem with building the compiler for single-threaded
targets.
2022-02-02 22:01:04 -07:00
Andrew Kelley
e2f36c292e std: break up some long lines
This makes packaging Zig for Debian slightly easier since it will no
longer trigger a Lintian warning for long lines.
2022-02-02 22:00:55 -07:00
Andrew Kelley
e9d916571a link: ELF, COFF, WASM: honor the "must_link" flag of positionals
Previously only the MachO linker was honoring the flag.
2022-02-02 22:00:38 -07:00
Andrew Kelley
021c1190af stage2: .stub files are yet another c++ source file extension
however .cu files are a superset of c++.
2022-02-02 22:00:16 -07:00
Andrew Kelley
45cd1114f7 stage2: make cuda file extensions a separate enum tag than c++
follow-up to 2f41bd3be4.
2022-02-02 22:00:12 -07:00
Vesim
d7feeaaa2c fchown: use the 32-bit uid/gid variant of the syscall on 32-bit linux targets 2022-02-02 22:00:06 -07:00
praschke
2b29424efd docs: reorganize @truncate and @intCast for clarity 2022-02-02 22:00:00 -07:00
vnc5
8f89056dc2 fix startup procedure for async WinMain 2022-02-02 21:59:47 -07:00
Philipp Lühmann
e8c4fec1b2 fix precedence in langref or example 2022-02-02 21:59:40 -07:00
Exonorid
ac3d9759ed Added documentation for implicit struct pointer dereferencing 2022-02-02 21:53:00 -07:00
Daniel Saier
922d33e5b9 zig cc: Treat cu files as C++ source files
First step towards #10634.

Treating stub files as C++ allows to use zig c++ as a host
compiler for nvcc.

Treating cu files as C++ allow using zig c++ as a host compiler in
CMake. CMake calls the host compiler with -E on a cu file to identify
the compiler.

Using zig c++ to directly compile CUDA code is untested.
2022-02-02 21:52:52 -07:00
Andrew Kelley
936294e32a Merge pull request #10699 from motiejus/arm64
[linux headers] rename arm64 to aarch64
2022-02-02 21:51:58 -07:00
Andrew Kelley
7e61bdbaa4 zig cc: add --hash-style linker parameter
This is only relevant for ELF files.

I also fixed a bug where passing a zig source file to `zig cc` would
incorrectly punt to clang because it thought there were no positional
arguments.
2022-02-02 21:50:52 -07:00
Josh Hannaford
340bb8198f Update the documentation for std.mem.sliceTo for readability 2022-02-02 21:48:48 -07:00
Andrew Kelley
e37c55bae0 link: Elf, Wasm: forward strip flag when linking with LLD 2022-02-02 21:47:28 -07:00
Andrew Kelley
93545fe74f zig cc: detect more linker args
* --whole-archive, -whole-archive
 * --no-whole-archive, -no-whole-archive
 * -s, --strip-all
 * -S, --strip-debug
2022-02-02 21:46:28 -07:00
Meghan
8ed432fe3c std.crypto.random: Randoms are no longer passed by reference 2022-02-02 21:46:22 -07:00
Andrew Kelley
148b963a60 Merge pull request #10584 from ziglang/macho-rustc-fixes
zld: a couple of fixes which result in better rustc support
2022-02-02 21:45:44 -07:00
Sizhe Zhao
b713ce0249 Avoid duplicate TLS startup symbols 2022-02-02 21:25:40 -07:00
Pablo Santiago Blum de Aguiar
4d5a598599 readUntilDelimiter*: read only if buffer not full
Ref.: #9594
2022-02-02 21:25:03 -07:00