23507 Commits

Author SHA1 Message Date
Jakub Konka
3f35d6984f x86_64: make TLV a separate MCValue 2023-04-13 16:35:45 +02:00
Jakub Konka
887da399eb x86_64: fix load() and store() to accommodate TLV 2023-04-13 11:47:51 +02:00
Jakub Konka
fd52d4537a x86_64: emit pointer to TLV for macho 2023-04-13 11:47:51 +02:00
Jakub Konka
1f6165f621 macho: reference TLV thunks via GOT table 2023-04-13 11:47:51 +02:00
Jakub Konka
094ff60252 macho: emit TLV pointers and variables 2023-04-13 11:47:51 +02:00
Jakub Konka
09b6bd86de macho: cleanup dirtying and writing GOT atoms 2023-04-13 11:47:51 +02:00
Jakub Konka
57f9304275 macho: improve reporting of missing symbols
Fix a typo in TLV bootstrap symbol: __tlv_bootstrap.
2023-04-13 11:47:51 +02:00
Jakub Konka
ef645ab175 macho: refactor common logic between synthetic tables 2023-04-13 11:47:51 +02:00
Jakub Konka
38ecaf3ab6 macho: add machinery for emitting TLV refs 2023-04-13 11:47:51 +02:00
Jakub Konka
eba280ce20 macho: refactor relocation type in incremental linker 2023-04-13 11:47:51 +02:00
Jakub Konka
1795b8eb4e macho: emit TLS sections 2023-04-13 11:47:51 +02:00
Jakub Konka
cf9ba2965e x86_64: remove loadMemPtrIntoRegister() now redundant 2023-04-13 11:47:51 +02:00
Jakub Konka
e07120d704 x86_64: simplify genInlineMemset() when setting value in memory 2023-04-13 11:47:51 +02:00
Jakub Konka
4e3573955f x86_64: simplify genInlineMemcpy() when copying from memory 2023-04-13 11:47:51 +02:00
Jakub Konka
aab0039b42 x86_64: simplify genSetStack() when storing value from memory 2023-04-13 11:47:51 +02:00
Jakub Konka
0abaf5f88a x86_64: simplify genSetStackArg() when storing value from memory 2023-04-13 11:47:51 +02:00
Jakub Konka
059ed062bc x86_64: simplify isNull() when loading optional from memory 2023-04-13 11:47:51 +02:00
Jakub Konka
e05a51cb62 x86_64: simplify airArrayElemVal() when pulling array from memory 2023-04-13 11:47:51 +02:00
Jakub Konka
c8c5951e23 x86_64: simplify genBinOp() and genBinOpMir() when modifying value in memory 2023-04-13 11:47:51 +02:00
Jakub Konka
38d46a6764 x86_64: simplify genUnOpMir() when modifying value in memory 2023-04-13 11:47:51 +02:00
Jakub Konka
dbdf8086bd x86_64: simplify store() logic when ptr is in memory 2023-04-13 11:47:51 +02:00
Jakub Konka
397dd77697 x86_64: simplify store() logic when value is in memory 2023-04-13 11:47:51 +02:00
Jakub Konka
ee6b4fad47 x86_64: remove loadMemPtrIntoRegister in genSetReg
Add two emit helpers for linker reloc based `lea` and `mov`
instructions: `asmMovLinker` and `asmLeaLinker`.
2023-04-13 11:47:51 +02:00
Jakub Konka
382de7bf1d codegen: use non-debug Type/Value formatting 2023-04-13 11:47:51 +02:00
Jakub Konka
5154ece8b9 macho: fix incorrect DWARF subprogram generation 2023-04-13 11:47:50 +02:00
Jacob Young
e72c41a32a x86_64: fix clz miscompile 2023-04-13 04:17:54 -04:00
Jacob Young
caa3d6a4f4 x86_64: fix constant pointers to zero-bit types
These non-dereferencable pointers still need to have the correct
alignment and non-null-ness.
2023-04-13 04:17:47 -04:00
Jacob Young
3b22ce8264 x86_64: fix atomic loop implementation 2023-04-13 04:17:47 -04:00
Jacob Young
0165187cd0 x86_64: fix some of the mass confusion about the meaning of MCValue 2023-04-13 04:17:47 -04:00
Andrew Kelley
e2fe1907ec add c_char type
closes #875
2023-04-13 02:47:16 -04:00
Jan200101
856a9c2e31 build: add option to not build langref on install 2023-04-12 18:58:47 -04:00
Andrew Kelley
60bd13bdf2 never use C pointers!!
you maniacs, you absolute monsters. degenerates. hooligans. criminals.

issue #2984 is coming for you.
2023-04-12 15:21:03 -07:00
Jakub Konka
35f9c84449 macos: add missing getopt.h header 2023-04-13 00:19:33 +02:00
Michael Dusan
490a411fd4 openbsd: fix thread name buffer size
OpenBSD 7.3 changed its implementation of
pthread_get_name_np/pthread_set_name_np to wrap new libc functions
getthrname/setthrname and lowered the max buffer size from 32 to 24.

This is not a backwards-compatible change because if we were to put in
comptime version logic to use size 32 when target < 7.3 the binaries
would be undefined when running on >= 7.3. It also could simply be that
OpenBSD has a policy to not support older binaries running on newer
releases? Regardless, the safest course is to simply use the smallest
known buffer size.

As an aside, this bug manifested as a "hung" std.Thread test because 7.3
pthread API never checks for error result when wrapping getthrname/setthrname.
This is not a problem in std.Thread when we use the correct max buffer
size because ERANGE/EINVAL become unreachable.
2023-04-12 15:36:03 -04:00
mlugg
ccf670c2b0 Zir: implement explicit block_comptime instruction
Resolves: #7056
2023-04-12 12:06:19 -04:00
Loris Cro
602029bb2f
Autodoc usingnamespace (#15216)
* autodoc: init support for usingnamespace decls

* autodoc: don't build autodoc when building zig2.c

* autodoc: usingnamespace decls support in frontend (#15203)

* autodoc: init support for usingnamespace decls

* autodoc: usingnamespace decls support in frontend

---------

Co-authored-by: Krzysztof Wolicki <46651553+der-teufel-programming@users.noreply.github.com>
2023-04-12 01:14:02 +00:00
Krzysztof Wolicki
52d552f118
Add omit_pkg_fetching_code option to test_cases (#15244)
* Add `omit_pkg_fetching_code` option to test_cases

* Change `omit_pkg_fetching_code` to always `true` for test_cases

Co-authored-by: Andrew Kelley <andrew@ziglang.org>

---------

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2023-04-11 19:47:53 +02:00
Andrew Kelley
d3a237a98c
Merge pull request #15234 from ziglang/remove-legacy-build-api
remove --enable-cache option; std.Build.CompileStep: remove output_dir
2023-04-11 11:54:43 -04:00
Andrew Kelley
3c3cee2cfa fix build logic due to state mutations and break the API accordingly
* remove setName, setFilter, and setTestRunner. Please set these
   options directly when creating the CompileStep.
 * removed unused field
 * remove computeOutFileNames and inline the logic, making clear the
   goal of avoiding state mutations after the build step is created.
2023-04-11 08:42:14 -07:00
Andrew Kelley
d5eab33fd2 docgen: avoid use of --enable-cache 2023-04-11 08:41:52 -07:00
Andrew Kelley
5a8b1bde5b std.Build.CompileStep: remove output_dir
Build scripts must instead use the FileSource abstraction rather than
telling the compiler directly where to output files.

closes #14951
2023-04-11 08:41:51 -07:00
Andrew Kelley
c96cb98ad1 CLI: remove --enable-cache option
This use case is now handled instead by the --listen option.

closes #15025
closes #15072
2023-04-11 08:41:24 -07:00
Andrew Kelley
1728d92f60
Merge pull request #15245 from ziglang/zig-build-install-artifact
fix broken and confusing artifact installation logic
2023-04-11 11:40:53 -04:00
Andrew Kelley
406706fe6b init-exe/init-lib template: fix use of install() and run()
And while we're at it, make the unit tests be actually executed.
2023-04-10 18:35:14 -07:00
Andrew Kelley
7221e9560e std.Build.RunStep: don't close stdin
Instead, ignore stdin. Otherwise this interfers with a sub-process which
expects to have a stdin file descriptor open.
2023-04-10 18:35:14 -07:00
Andrew Kelley
60eabc0eca std.Build.CompileStep: remove run() and install()
These functions are problematic in light of dependencies because they
run and install, respectively, for the *owner* package rather than for
the *user* package. By removing these functions, the build script is
forced to provide the *Build object to associate the new step with,
making everything less surprising.

Unfortunately, this is a widely breaking change.

see #15079
2023-04-10 18:35:14 -07:00
Andrew Kelley
38698f4f6a std.Build.CompileStep: delete install_step field
This was used to ensure that an artifact would only be installed once,
but this is not only unnecessary, but actively harmful, in the face of
dependencies.

see #15079
2023-04-10 18:35:14 -07:00
Andrew Kelley
d2ad3f5074 std.Build.CompileStep: remove redundant dest_builder field
The destination *Build object is already known to be step.owner, while
the source object is artifact.step.owner.
2023-04-10 18:35:14 -07:00
Jacob Young
23d7921758 Sema: avoid emitting loops that can't loop
If a `loop` ends with a `noreturn` instruction, then it cannot loop and
will be emitted as a `block` instead.
2023-04-10 20:57:49 -04:00
Piotr Sikora
cb54e9a3c2 glibc: allow linking against external libcrypt.
Support for the built-in libcrypt was removed in commit 6b7ddfba,
but the -lcrypt flag remained ignored, preventing linking against
external libcrypt.

Fixes #5990.

Signed-off-by: Piotr Sikora <piotr@aviatrix.com>
2023-04-10 20:04:29 -04:00