Commit Graph

23639 Commits

Author SHA1 Message Date
Jakub Konka
711bc2cf39 macho: use generic TableSection for GOT mgmt 2023-04-21 22:44:27 +02:00
Jakub Konka
8e3100ae02 elf: make TableSection a generic construct 2023-04-21 22:44:27 +02:00
Jakub Konka
8a3ad3f620 elf: do not reserve a GOT slot for every Atom 2023-04-21 22:44:25 +02:00
Andrew Kelley
528b66f6ec
Merge pull request #15355 from mlugg/feat/liveness-control-flow
Liveness: control flow analysis and other goodies
2023-04-21 13:32:25 -07:00
Frank Denis
391663e497
AEGIS MAC: add support for 128-bit tags (#15379)
When used as a MAC, 256-bit tags are recommended.
But in interactive protocols, 128 bits may be acceptable.
2023-04-21 19:52:33 +00:00
David CARLIER
83970b6d91 std: adding freebsd's elf_aux_info api 2023-04-21 11:42:49 -07:00
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
b3f9fe6d04
Unify incremental test cases and disable many
The self-hosted aarch64 backend is not currently functional due to the
Liveness changes. A previous commit disabled aarch64 on the behavior
tests; this commit disables it and arm for the test cases. Moreover, all
incremental test cases have been unified into shared cross-platform
cases, which can be gradually enabled as the backends improve.
2023-04-20 20:49:36 +01:00
Jacob Young
52fe2ebee8
behavior: fix test disable condition 2023-04-20 20:49:35 +01:00
Jacob Young
06992e159b
x86_64: fix merge conflict 2023-04-20 20:49:35 +01:00
Jacob Young
9f1409cabc
x86_64: adapt to new isUnused liveness change 2023-04-20 20:49:35 +01:00
Jacob Young
d5879ad1d0
x86_64: enable advanced test runner on Linux 2023-04-20 20:49:35 +01:00
Jacob Young
641bfb939f
x86_64: use liveness block deaths 2023-04-20 20:49:35 +01:00
Jacob Young
7794186210
x86_64: disable some behavior tests
These backends doesn't support the new liveness yet.
2023-04-20 20:49:35 +01:00
Jacob Young
07d57623b3
x86_64: instruction tracking cleanup 2023-04-20 20:49:35 +01:00
Jacob Young
f18ee1e2a2
x86_64: add block death workaround 2023-04-20 20:49:35 +01:00
Jacob Young
488d804a1c
x86_64: rewrite inst tracking 2023-04-20 20:49:34 +01:00
mlugg
6f09a7041e
Begin integrating new liveness analysis into remaining backends 2023-04-20 20:49:34 +01:00
Luuk de Gram
e088650653
wasm: integrate new Liveness behaviour
Uses the new liveness behaviour. This also removes useless calls
to `processDeath` on branches that were just initialized. Branch
consolidation and processing deaths on branches inside `condbr`
is still a TODO, just like before.

This also skips var_args on other native backends as they do not
support this feature yet.
2023-04-20 20:49:34 +01:00
mlugg
6fc524de42
cbe: integrate new Liveness behaviour 2023-04-20 20:49:34 +01:00
mlugg
407dc6eee4
Liveness: avoid emitting unused instructions or marking their operands as used
Backends want to avoid emitting unused instructions which do not have
side effects: to that end, they all have `Liveness.isUnused` checks for
many instructions. However, checking this in the backends avoids a lot
of potential optimizations. For instance, if a nested field is loaded,
then the first field access would still be emitted, since its result is
used by the next access (which is then unreferenced).

To elide more instructions, Liveness can track this data instead. For
operands which do not have to be lowered (i.e. are not side effecting
and are not something special like `arg), Liveness can ignore their
operand usages, and push the unused information further up, potentially
marking many more instructions as unreferenced.

In doing this, I also uncovered a bug in the LLVM backend relating to
discarding the result of `@cVaArg`, which this change fixes. A behaviour
test has been added to cover it.
2023-04-20 20:28:48 +01:00
mlugg
4486f27126
print_air: print new Liveness data
`try`, `try_ptr`, and `block` now have extra payloads.
2023-04-20 20:28:48 +01:00
Jacob Young
02a8b66b00
Liveness: add a liveness verification pass
This code only runs in a debug zig compiler, similar to verifying llvm modules.
2023-04-20 20:28:47 +01:00
Jacob Young
6f210b74ee
print_air: allow dumping air without liveness
This is useful for debug printing air when liveness is broken.
2023-04-20 20:28:04 +01:00
mlugg
8258530c39
Liveness: control flow analysis
This is a partial rewrite of Liveness, so has some other notable changes:
- A proper multi-pass system to prevent code duplication
- Better logging
- Minor bugfixes
2023-04-20 20:28:04 +01: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