Commit Graph

23615 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
31738de281
Merge pull request #15184 from jacobly0/x86_64
x86_64: fix various miscompilations
2023-04-13 13:53:01 +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
Luuk de Gram
abc1e52e08
wasm: enable @tagName behavior tests 2023-04-12 22:23:36 +02:00
Luuk de Gram
5c451b6e63
wasm: make tagName null-terminated 2023-04-12 22:23:36 +02:00
Luuk de Gram
370401cf60
wasm: generate unnamed constant for tag 2023-04-12 22:23:36 +02:00
Luuk de Gram
3c27df6b13
wasm: generate function to get tag name
When we lower the instruction for `@tagName` we generate a new
function if it doesn't exist yet for that decl. This function creates
an if-else chain to determine which value was provided. Each tag
generates a constant that contains its name as the value. For each
tag we generate a case where the pointer of the string is stored in
the result slice. The length of the tagname is comptime-known, therefore
will be stored in the slice directly without having it being part of
the tagname symbol. In the future this can use a jump table instead
of an if-else chain, similar to the `switch` instruction.
2023-04-12 22:23:32 +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