Commit Graph

23615 Commits

Author SHA1 Message Date
Eric Rowley
a774f93344 Do not use -fPIC when compiling a UEFI application 2023-04-21 08:22:27 +03:00
Andrew Kelley
a86759984c
Merge pull request #15316 from xEgoist/fileDisposition
windows: use NtSetInformationFile in DeleteFile.
2023-04-20 16:30:27 -07:00
Jan Philipp Hafer
8674418454 compiler_rt: README stubs for arbitrary precision big integer library routines
Document current status of exports and intended design being inspired by
Integer Operations.
2023-04-20 16:04:10 -07:00
Andrew Kelley
a1f7c8d860
Merge pull request #14696 from r00ster91/thread
std.Thread: use dead code
2023-04-20 16:03:12 -07:00
Stevie Hryciw
e8fdb249b6 std.math.big.int: Initialize limbs in addWrap
When a big.Int.Mutable had more than two limbs, it was possible for
this function to change the `len` field without zeroing limbs in the
active range. These uninitialized limbs would then be used in
`truncate()` and could cause invalid results.

Closes #13571
2023-04-20 16:00:37 -07:00
zooster
7d90410b96
std.math: add lerp (#13002) 2023-04-20 18:52:44 -04:00
zooster
b7c00999be std.fs: add linking docs to makeDir*
Docs that link back to the other similar functions.
2023-04-20 15:47:39 -07:00
Andrew Kelley
304e4082a0
Merge pull request #15193 from davidgm94/dwarf-64-bit-format
Expose an option for producing 64-bit DWARF format
2023-04-20 15:20:12 -07:00
Andrew Kelley
ceff278202 fixes to the previous commit
* CompileStep: Avoid calling producesPdbFile() to determine whether the
   option should be respected. If the user asks for it, put it on the
   command line and let the Zig CLI deal with it appropriately.
 * Make the namespace of `std.dwarf.Format.dwarf32` no longer have a
   redundant "dwarf" in it.
 * Add `zig cc` integration for `-gdwarf32` and `-gdwarf64`.
 * Toss in a bonus bug fix for `-gdwarf-2`, `-gdwarf-3`, etc.
 * Avoid using default init values for struct fields unnecessarily.
 * Add missing cache hash addition for the new option.
2023-04-20 15:17:07 -07:00
David Gonzalez Martin
d026202a26 Expose an option for producing 64-bit DWARF format
This commit enables producing 64-bit DWARF format for Zig executables
that are produced through the LLVM backend. This is achieved by exposing
both command-line flags and CompileStep flags. The production of the
64-bit format only affects binaries that use the DWARF format and it is
disabled on MacOS due to it being problematic. This commit, despite
generating the interface for the Zig user to be able to tell the compile
which format is wanted, is just implemented for the LLVM backend, so
clang and the self-hosted backends will need this to be implemented in a
future commit.

This is an effort to work around #7962, since the emission of the 64-bit
format automatically produces 64-bit relocations. Further investigation
will be needed to make DWARF 32-bit format to emit bigger relocations
when needed and not make the linker angry.
2023-04-20 14:46:53 -07:00
mlugg
fac120bc3a Module: mark function body dependencies, don't re-analyze anonymous decls 2023-04-20 09:09:15 -07:00
mlugg
d5f1a8823e Sema: allow ptr field access on pointer-to-array
Also remove an incorrect piece of logic which allowed fetching the 'len'
property on non-single-ptrs (e.g. many-ptrs) and add a corresponding
compile error test case.

Resolves: #4765
2023-04-20 09:05:22 -07:00
Tw
31b6d14bf7
llvm: emit metadata for exported global variables (#15349)
* llvm: emit metadata for global variable

One use case is to genearte BTF information from global variable's metadata.

Signed-off-by: Tw <weii.tan>
2023-04-20 11:12:41 +00:00
Ryo Ota
d80e6ca5a6 std.http: add missing InvalidTrailers to ReadError 2023-04-20 12:35:26 +03:00
Andrew Kelley
e102adc863 work around an intermittent io_uring test failure
See #15362
2023-04-19 22:49:51 -07:00
kcbanner
a1aa55ebe5 compilation: fix generating coff debug info on -gnu
The issue with just passing `-gcodeview` is that it's not part of
the `OPT_g_Group` in `clang/Driver/Options.td`, so it doesn't trigger
debug info to be generated.

Passing only `-g` is sufficient on MSVC, as there is logic in `Clang.cpp`
which enables codeview if that is the default for the toolchain. Since
the default for -gnu is not codeview, we do pass `-gcodeview` in that case.
2023-04-18 21:29:20 -07:00
Andrew Kelley
0e394cf922
Merge pull request #15192 from motiejus/build-release
zig build: change "-Drelease" to "-Doptimize"
2023-04-18 20:36:56 -07:00
mlugg
07b7c3b31b doc: clarifications to comptime section in langref after #14819 2023-04-18 19:57:47 -07:00
Andrew Kelley
0eebc25880
Merge pull request #15299 from truemedian/std-http
std.http: curated error sets and custom Headers
2023-04-18 19:56:24 -07:00
mlugg
77fdd76c16 std: fix uses of comptime blocks in non-inline functions
ccf670c made using `return` from within a comptime block in a non-inline
function illegal, since it is a use of runtime control flow in a
comptime block. It is allowed if the function in question is `inline`,
since no actual control flow occurs in this case. A few functions from
std (notably `std.fmt.comptimePrint`) needed to be marked `inline` to
support this change.
2023-04-18 19:51:18 -07:00
Mateusz Radomski
1e207f1edd math.big.int: remove stale comments
This pull request removes the optional allocator argument from functions
`divFloor` and `divTrunc`. As a result, the comments related to accepting an
optional `allocator` are no longer applicable. The support for accepting
an optional allocator was removed in #10017.
2023-04-18 18:42:02 -07:00
hequn
e1cc70ba11
Assembly file add soft float option for mips (#15340) 2023-04-18 21:41:16 -04:00
Erik Arvstedt
1617138c72 std.Thread.Condition: optimize example
- Hold the lock for a shorter amount of time
- Previously, when holding the lock while signaling, the other, resumed
  thread could potentially get suspended again immediately because
  the mutex was still locked.
- Fix comment
2023-04-18 18:38:52 -07:00
serg
5bc35fa75b std.target.riscv: fix baseline_rv32 missing feature "32bit" 2023-04-18 18:37:15 -07:00
r00ster91
2b7334c3a9 zig fmt: omit extra whitespace after last comment before EOF 2023-04-18 18:33:05 -07:00
kcbanner
d2a799c65a coff: support allow_shlib_undefined 2023-04-18 18:23:05 -07:00
kcbanner
e82596950f debug: fix missing stack traces during crashes on windows
- walk the stack via the method that is aware of unwind info (fixes x86_64 / aarch64 traces)
- enhance the output for frames where the debug info isn't available by printing the module name
2023-04-18 18:20:15 -07:00
xEgoist
8c79559748 windows: Handle DELETE_PENDING in DeleteFile.
DELETE_PENDING can happen when the file is yet to be closed for deletion
or if it never get closed. In that case, DeleteFile should assume the
file deletion is succeeding (no CloseHandle is required as it's a "failure"). In case of `DELETE_PENDING` failure, the file
may still exist. In which case if it's part of `deleteTree`, it will
eventually fail on `error.DirNotEmpty`.
2023-04-18 19:59:33 -05:00
Andrew Kelley
34286530b7 Cache: fix multi-process race condition on macOS
This fixes `.INVAL => unreachable` being triggered by the cache system
on macOS when multiple processes race to create the same compilation.
The problem is that when two processes race to create a file, it
sometimes returns ENOENT even though that error code is nonsensical for
this situation.

Commit 2b0929929d purportedly solved this,
but it did not open the file with write permissions, leading to the
EINVAL panic later on. This commit remedies the situation by introducing
a loop and simply retrying when the ENOENT occurs.
2023-04-18 17:53:47 -07:00
Andrew Kelley
30fc160874
Merge pull request #15302 from jacobly0/x86_64-non-liveness
x86_64: liveness independent fixes
2023-04-18 17:28:19 -07:00
Nameless
a23c8662b4
std.http: pass Method to request directly, parse trailing headers 2023-04-18 10:28:53 -05:00
David CARLIER
2568da2f41
std: freebsd update proposal
adding getentropy and cpuset_(get/set)affinity calls.
2023-04-18 14:59:01 +03:00
xEgoist
55b2456c11 fs: add test for Windows ready-only file deletion.
Deleting a read-only file should result in `AccessDenied` (`CANNOT_DELETE`).

Note: This test was observed to fail when the file is closed then reopened
before the change in permission due to the absence of
`FILE_WRITE_ATTRIBUTES` when re-opened. (see #15316).
2023-04-18 05:27:28 -05:00
Jakub Konka
8ba937c787
Merge pull request #15339 from ziglang/link-and-x86_64-cleanups
Misc cleanups
2023-04-18 06:24:16 +02:00
xEgoist
89334fae20 windows: better error handling for DeleteFile. 2023-04-17 22:35:04 -05:00
Nameless
e65cbff94d
std.http: use 'Field' to describe an individual header 2023-04-17 19:16:06 -05:00
Nameless
85221b4e97
std.http: curate some Server errors, fix reading chunked bodies 2023-04-17 19:16:01 -05:00
Nameless
134294230a
std.http: add Headers 2023-04-17 19:15:55 -05:00
Nameless
96533b1289
std.http: very basic http client proxy 2023-04-17 19:14:48 -05:00
Nameless
2c492064fb
std.http: further curate error set, remove last_error 2023-04-17 19:14:48 -05:00
Nameless
038ed32cff
add explicit error union for Bundle.rescan and associated functions 2023-04-17 19:14:48 -05:00
kcbanner
40e1fca34b compilation: fix non-zig compilations not using CacheMode.whole
main: consume --debug-log argument even when logging is disabled
2023-04-17 13:46:14 -07:00
Loris Cro
3cd19dd897
Merge pull request #15304 from der-teufel-programming/autodoc-defaults
autodoc: Fix errors in main.js; add support for defaults in exprName
2023-04-17 20:14:57 +02:00
Loris Cro
3d33a09069 autodoc: more support for linking decls in docs & guides 2023-04-17 20:13:08 +02:00
Andrew Kelley
2d41dac57d CI: give x86_64-linux a maxrss parameter
to avoid getting OOM killed. It's been happening regularly recently. We
need to have a high number of GitHub Actions runners simultaneously
active, otherwise the hardware ends up underutilized. But with zig build
running in parallel now, this sometimes results in memory usage spikes
that have been causing the runner to get killed.

This number is the total physical memory (126G) divided by the number of
runners we have active (6).
2023-04-17 10:38:27 -07:00
Jakub Konka
13503b7cba x86_64: clean up formatting functions for Instruction and Operand 2023-04-17 13:43:01 +02:00
Jakub Konka
5bc4417d2a tapi: fix memory bugs in yaml parser 2023-04-17 13:35:39 +02:00
Ryo Ota
17af53554e
HTTP client and server send "0\r\n\r\n" when chunked encoding 2023-04-17 13:33:25 +03:00
Jakub Konka
1fb0b5a044
Merge pull request #15308 from kcbanner/dynlib_lookup_alignment
DynLib.lookup: cast the pointer to the correct alignment
2023-04-17 12:02:57 +02:00
Andrew Kelley
72dcad6f02 Revert "ci: let's not skip non native tests on macos!"
This reverts commit a34752c941.

With #15277 merged, the macOS CI will still run the self-hosted x86_64
tests even with -Dskip-non-native. This was the main motivation for the
commit.

It would be nice to keep this flag enabled, however, we don't have
enough CI computing power, and the macOS CI lags behind with these extra
tests enabled.
2023-04-16 23:48:42 -07:00