22107 Commits

Author SHA1 Message Date
Luuk de Gram
30f2bb8464
compiler-rt: Set the symbol visibility
When we're compiling compiler_rt for any WebAssembly target, we do
not want to expose all the compiler-rt functions to the host runtime.
By setting the visibility of all exports to `hidden`, we allow the
linker to resolve the symbols during linktime, while not expose the
functions to the host runtime. This also means the linker can
properly garbage collect any compiler-rt function that does not get
resolved. The symbol visibility for all target remains the same as
before: `default`.
2022-12-28 14:57:17 +01:00
Luuk de Gram
4aab8118a7
WebAssembly: don't append --export for functions
No longer automatically append the `--export` flag for each exported
function unconditionally. This was essentially a hack to prevent
binary bloat caused by compiler-rt symbols being always included in
the final binary as they were exported and therefore not garbage-
collected. This is no longer needed as we now support the ability to
set the visibility of exports.
This essentially reverts 6d951aff7e32b1b0252d341e66517a9a9ee98a2d
2022-12-28 14:41:27 +01:00
Andrew Kelley
e2e96eb13b CI: update x86_64 and aarch64 LLVM tarballs with assertions enabled 2022-12-27 23:13:34 -07:00
Andrew Kelley
a1d82352d2 disable failing C var arg behavior tests
See tracking issue #14096
2022-12-27 23:13:03 -07:00
Andrew Kelley
5ca1753ff1 Revert "aarch64: reenable tests that are no longer regressed"
This reverts commit 3370d58956ecc744a004dff47b0437473f0ef7da.

This commit was done with an LLVM build that did not have assertions
enabled. There are LLVM assertions being triggered due to this commit.

Reopens #10627
Reopens #12013
Reopens #12027
2022-12-27 20:54:27 -07:00
Andrew Kelley
3f1cfcbea8
Merge pull request #14091 from ziglang/stage1-test-coverage
add more behavior test coverage
2022-12-27 21:47:17 -05:00
Andrew Kelley
b1207b3293 Revert "cmake: check llvm-config in separate function"
This reverts commit 55c3efcb58cc153fc3109a61c6949e470b57b81e.

This caused a regression when building Zig with Homebrew.
Also I don't like that it prints a message on success. Only when there
is a problem should an error message be printed.

closes #14093
2022-12-27 19:21:33 -07:00
Andrew Kelley
357235d9de add behavior test for ptrcasted function pointers
See #2626. The runtime case is solved but comptime is not.
2022-12-27 15:19:00 -07:00
Andrew Kelley
6e9fbc83ca add behavior test for comptime pointer casting
comptime `@ptrCast` a subset of an array, then write through it

closes #2444
2022-12-27 14:44:04 -07:00
Andrew Kelley
f4b067743f add behavior test for optional error union return type
closes #1814
2022-12-27 13:46:57 -07:00
Jakub Konka
601ab9a251
Merge pull request #14086 from ziglang/issue-14082
macho: ensure LINKEDIT layout follows Apple strict validation rules
2022-12-27 21:39:05 +01:00
Andrew Kelley
19056cb682
Merge pull request #14024 from Vexu/overflow-arithmetic
Make overflow arithmetic builtins return tuples
2022-12-27 13:57:49 -05:00
Eric Joldasov
55c3efcb58 cmake: check llvm-config in separate function 2022-12-27 13:53:46 -05:00
Jeremy Volkman
50a8afd242 Handle -undefined error when passed as linker arg 2022-12-27 10:47:27 -08:00
Jakub Konka
aea3460cf5
Merge pull request #14084 from joachimschmidt557/stage2-aarch64
stage2 AArch64: small improvements
2022-12-27 18:59:59 +01:00
Jeremy Volkman
b0bfde917b Add support for -undefined error
`-undefined dynamic_lookup` was added in #13991. `-undefined error` is the
opposite, and can be used to revert an `-undefined dynamic_lookup` flag
specified previously on the command line.
2022-12-27 08:18:04 -08:00
Jakub Konka
c0c5acf074 macho+zld: fix 32bit build 2022-12-27 17:04:57 +01:00
Jakub Konka
8d29c84d00 link-tests: test uuid on x86_64-macos too 2022-12-27 16:43:35 +01:00
Jakub Konka
6925ef0f1a zld: exclude strtab padding from uuid calculation 2022-12-27 16:43:35 +01:00
Jakub Konka
8adcc2258f link-tests: redo macho strict validation test to match libstuff 2022-12-27 16:43:35 +01:00
Jakub Konka
2620146834 macho+zld: align to 8 and pad out strtab 2022-12-27 16:43:35 +01:00
Jakub Konka
d83d39297c macho+zld: align to 8 and pad out dysymtab 2022-12-27 16:43:35 +01:00
Jakub Konka
0409dda46b zld: align to 8 and pad out function starts and data in code sections 2022-12-27 16:43:35 +01:00
Jakub Konka
246e3e0c75 macho+zld: align to 8 and pad out dyld info sections 2022-12-27 16:43:35 +01:00
Jakub Konka
a70cbe779a macho: add Zig wrapper for compact unwind encoding on arm64 2022-12-27 15:36:28 +01:00
Veikka Tuominen
a777373bb8 enable test on more targets
This was fixed by 8a0a6b7387fcd0017db85de14793abfd6ec7f6e5 for targets
without avx512
2022-12-27 15:34:19 +02:00
Veikka Tuominen
9c0f3163a8 value: fix bitcasting packed structs with u0 fields
Closes #13942
2022-12-27 15:33:27 +02:00
joachimschmidt557
485082064a
stage2 AArch64: implement field_parent_ptr 2022-12-27 21:26:18 +08:00
joachimschmidt557
d6e6162081
stage2 AArch64: unify callee-preserved regs on all targets
also enables many passing behavior tests
2022-12-27 21:17:52 +08:00
Veikka Tuominen
b7730c7478 update zig1.wasm to overflow arithmetic builtin changes 2022-12-27 15:13:14 +02:00
Veikka Tuominen
622311fb9a update uses of overflow arithmetic builtins 2022-12-27 15:13:14 +02:00
Veikka Tuominen
54160e7f6a Sema: make overflow arithmetic builtins return tuples 2022-12-27 15:13:14 +02:00
Veikka Tuominen
af9a9a1374 zig fmt: improve handling of comptime tuple fields 2022-12-27 13:52:37 +02:00
zooster
547e3684be langref: more explicitly document how enum overriding works 2022-12-27 12:53:41 +02:00
Andrew Kelley
3a7a39cb91
Merge pull request #14078 from jacobly0/llvm-opaque-ptrs
llvm: remove unnecessary code for opaque pointers
2022-12-27 04:57:01 -05:00
Jacob Young
81318e8704 llvm: add asserts and behavior tests for #14063
Closes #14063
2022-12-27 00:12:56 -05:00
Jacob Young
46b49a0a76 llvm: cleanup code no longer needed with opaque pointers
When using llvm opaque pointers, typed pointers and pointer bitcasts are
no longer needed.  This also avoids needing packed struct layouts that
are nested inside pointers, letting us avoid computing struct layouts
in Sema that could cause unnecessary dependency loops.
2022-12-27 00:12:56 -05:00
Andrew Kelley
1b86a628ac
Merge pull request #14015 from Vexu/recursive-inline
Sema: add error for recursive inline call
2022-12-26 20:34:22 -05:00
Andrew Kelley
b0cd24f90e
Merge pull request #14070 from jacobly0/issue/14032
Fix #14032
2022-12-26 18:06:19 -05:00
zooster
728cc73819 std.Target.ObjectFormat: specify dxcontainer file ext 2022-12-26 18:03:27 -05:00
Veikka Tuominen
81443fcde8 Sema: add error for recursive inline call
Closes #12973
2022-12-26 16:36:30 +02:00
Veikka Tuominen
0b859831ad update grammar in langref
Closes #14072
2022-12-26 16:36:29 +02:00
Veikka Tuominen
3535c4b3b6 Sema: fix elem ptr type of vector in slice
Closes #14071
2022-12-26 15:26:27 +02:00
Jacob Young
64865679cf Sema: add missing resolveLazyValue cases
Closes #14032
2022-12-26 04:39:32 -05:00
Jacob Young
8dd844d96f Sema: fix typo 2022-12-26 04:18:08 -05:00
Matt Knight
cf822c6ddd
@export() with linksection option (#14035) 2022-12-25 20:19:50 -05:00
Jacob Young
f5b6019646 Sema: fix missing struct layout for llvm backend
Closes #14063
2022-12-25 20:18:15 -05:00
Frank Denis
7802c26449 WebAssembly: do not link with --allow-undefined unconditionally
In #1622, when targeting WebAsembly, the --allow-undefined flag
became unconditionally added to the linker.

This is not always desirable.

First, this is error prone. Code with references to unkown symbols
will link just fine, but then fail at run-time.

This behavior is inconsistent with all other targets.

For freestanding wasm applications, and applications that only use
WASI, undefined references are better reported at compile-time.

This behavior is also inconsistent with clang itself. Autoconf and
cmake scripts checking for function presence think that all tested
functions exist, but then resulting application cannot run.

For example, this is one of the reasons compilation of Ruby 3.2.0
to WASI fails with zig cc, while it works out of the box with clang.
But all applications checking for symbol existence before compilation
are affected.

This reverts the behavior to the one Zig had before #1622, and
introduces an `import_symbols` flag to ignore undefined symbols,
assuming that the webassembly runtime will define them.
2022-12-25 22:32:21 +01:00
zooster
0c30e006c9 delete empty.zig
This is no longer used anywhere.
2022-12-24 23:17:27 -05:00
Andrew Kelley
a193ec432d
Merge pull request #14058 from jacobly0/concat 2022-12-24 13:55:42 -05:00