4494 Commits

Author SHA1 Message Date
Jakub Konka
68bb1e91aa Add testcase for serializing svc #0x80 2020-11-11 14:34:53 +01:00
Jakub Konka
d542e88706 Implement genAsm on aarch64
Add remaining PCS info: param and return registers in procedure calls.
2020-11-11 14:34:53 +01:00
joachimschmidt557
5ad501c00b stage2 aarch64: add codegen/aarch64.zig 2020-11-11 14:34:53 +01:00
LemonBoy
f0b1b74d21 stage1: Avoid resolving type entry in [0]T
The logic was already there but this rule was only applied in some
places, apply it in the remaining code paths.

Closes #7058
2020-11-11 13:53:24 +02:00
Andrew Kelley
6904cd828e add missing -m<os>-version-min CLI args to clang
This fixes some code generation issues when targeting macOS and
compiling C/C++ code.
2020-11-10 15:24:10 -07:00
LemonBoy
4d4ab1e69a stage1: Fix comparison of unions containing zero-sized types
The code tried to be too smart and skipped the equality (returning true)
if the payload type was zero-sized.
This optimization is completely wrong when the union payload is a
metatype!

Fixes #7047
2020-11-10 17:21:49 -05:00
Andrew Kelley
06a3a69e6f main: updateModule returns an error when there are any compile errors
closes #6976
2020-11-09 20:51:09 -07:00
LemonBoy
e00356d6b1 stage1: Print correct error message for vector @intCast 2020-11-09 18:24:48 -05:00
Andrew Kelley
e78e0f57be macos: avoid --export-dynamic when using system linker 2020-11-08 23:04:38 -08:00
Andrew Kelley
4d67c3d887 macOS: depend on bundled headers even for native
This is an alternate fix for #6773. Reverts
872bc787b56f71e53c80f4681523bc8356915b71.
2020-11-08 18:51:12 -07:00
joachimschmidt557
03ae77b8b0 stage2 ARM: miscellaneous improvements 2020-11-07 17:27:23 +01:00
Alexandros Naskos
5430642fa0
Merge pull request #7008 from xackus/minor-fixes
change debug.assert to testing.expect in tests
2020-11-07 11:34:51 +02:00
xackus
c9fa57541b remove outdated comment 2020-11-06 22:58:58 +01:00
Andrew Kelley
e5fab3ba68 update musl sources to 1.2.1 2020-11-06 14:13:57 -07:00
Andrew Kelley
a9e09a8be4
Merge pull request #6990 from kubkon/system-linker-hack
Re-enable system linker hack
2020-11-06 13:22:03 -05:00
Jakub Konka
ab69b89d52 Address review comments 2020-11-06 11:57:53 +01:00
Vexu
79549e0ac1
translate-c: fix macro functions with no arguments 2020-11-06 12:48:52 +02:00
Jakub Konka
b7c3ebcb9e Rely on ZIG_SYSTEM_LINKER_HACK instead of input flags 2020-11-06 11:34:51 +01:00
LemonBoy
78840c4ab2 stage1: Make sure union(enum(T)) is valid
The T type should be wide enough to fit values in the  0...num field
range.

Closes #6988
2020-11-05 17:24:04 -05:00
Alexandros Naskos
3e1639c53b
Fixed mingw-w64 8.0.0 compilation
Reaplied mingw-w64 header patch
2020-11-05 20:04:25 +02:00
Jakub Konka
e0e3ceac19 Re-enable system linker hack
It is now possible to force linking with system linker `ld` instead
of the LLVM `lld` linker when building natively on the target. This
can be done at each stage by specifying `--system-linker-hack` flag,
and can be useful on platforms where `lld` fails to operate properly
such as macOS 11 Big Sur on ARM64 where every binary/dylib is expected
to be codesigned.

Some example invocations for each stage of compilation of Zig
toolchain:

```
cmake .. -DCMAKE_PREFIX_PATH=/path/to/llvm -DSYSTEM_LINKER_HACK=1
```

```
build/zig build test --system-linker-hack
```

```
build/zig build --prefix $(pwd)/stage2 -Denable-llvm
--system-linker-hack
```

```
build/zig build-exe hello.zig --system-linker-hack
```
2020-11-05 18:35:51 +01:00
Alexandros Naskos
708962d51e
Updated mingw-w64 to version 8.0.0 2020-11-05 18:59:36 +02:00
Jakub Konka
5060497174
Merge pull request #6921 from xackus/gimmeMoreOfThoseSweetSweetFileDescriptors
stage2: ask for more file descriptors
2020-11-03 10:07:39 +01:00
xackus
e023a5fe5d force comptime on isDarwin 2020-11-03 00:58:35 +01:00
Jakub Konka
8dda64fa3e
Fix Darwin codepath
On Darwin, according to the man pages for setrlimit(), when adjusting
max number of open fds, the reported hard max by getrlimit() is only
theoretical, while the actual maximum, set in the kernel, is hardcoded
in the header file. Therefore, the reported max has to be adjusted
as `min(OPEN_MAX, lim.max)`.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-11-03 00:38:43 +01:00
xackus
06b4526a3e fix freebsd compilation 2020-11-02 23:18:55 +01:00
Andrew Kelley
00ceb592ef
Merge pull request #6932 from kubkon/fix-6318
macOS: fix linking issues on BigSur
2020-11-02 13:41:32 -05:00
LemonBoy
be26c3bf4e stage1: Fix *WithOverflow intrinsics with u0 values
Closes #5369
2020-11-02 13:40:00 -05:00
Jakub Konka
6ecefd5903 Add std.Target.current.isDarwin() to exclude non-macs in comptime 2020-11-02 19:31:07 +01:00
Jakub Konka
f42ebd1b0a
Update src/Compilation.zig
Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2020-11-02 18:56:08 +01:00
Jakub Konka
7f5c96378d Refactor the code according to Andrew's suggestions 2020-11-02 18:38:09 +01:00
Jakub Konka
317c555a5c Fix linking issues on BigSur
This commit fixes linking issue on macOS 11 BigSur by appending
a prefix path to all lib and framework search paths known as
`-syslibroot`.

The reason this is needed is that in macOS 11, the system libraries
and frameworks are no longer readily available in the filesystem.
Instead, the new macOS ships with a built-in dynamic linker cache
of all system-provided libraries, and hence, when linking with either
`lld.ld64` or `ld64`, it is required to pass in `-syslibroot [dir]`.
The latter can usually be obtained by invoking `xcrun --show-sdk-path`.
With this commit, Zig will do this automatically when compiling natively
on macOS. However, it also provides a flag `-syslibroot` which can be
used to overwrite the automtically populated value.

To summarise, with this change, the user of Zig is not required to
generate and append their own syslibroot path. Standard invocations
such as `zig build-exe hello.zig` or `zig build` for projects will
work out of the box. The only missing bit is `zig cc` and `zig c++`
since the addition of the `-syslibroot` option would be a mismatch
between the values provided by `clang` itself and Zig's wrapper.
2020-11-02 17:06:09 +01:00
Andrew Kelley
909aae8153
Merge pull request #6792 from koachan/sparc64-linux
Initial sparc64-linux bringup
2020-11-01 22:14:56 -05:00
xackus
7703f4c60a stage2: ask for more file descriptors 2020-11-01 23:32:25 +01:00
LemonBoy
0d6a7088dc stage1: Implement Add/Mul reduction operators 2020-11-01 14:30:31 -07:00
LemonBoy
2957433b25 stage1: Fix comptime comparison of NaNs 2020-11-01 14:30:31 -07:00
Veikka Tuominen
9ca9819488
Merge pull request #6883 from Vexu/translate-c
translate-c: correctly handle pointers to opaque demoted structs
2020-10-31 15:25:14 +02:00
Vexu
28a0583b84
run zig fmt on src/ and test/ 2020-10-31 12:21:49 +02:00
Veikka Tuominen
7c8d9cfa40
Merge pull request #6660 from Vexu/stage2
Stage2 switch and package imports
2020-10-31 09:39:28 +02:00
Vexu
3ff381385a
translate-c: correctly handle pointers to opaque demoted structs 2020-10-31 09:30:13 +02:00
Travis
bb6e39e274 remove extra space in .** error message 2020-10-30 21:26:05 +02:00
Veikka Tuominen
80dd432137
Merge pull request #6858 from travv0/no-star-after-dot-star
don't allow a token starting with an asterisk directly following .*
2020-10-30 16:08:04 +02:00
Vexu
22ec5e0859
stage2: fix typo in liveness; add comptime switch test 2020-10-30 15:58:13 +02:00
Vexu
4ed2c52fb7
stage2: switch put swap condbr and block
condbr is noreturn so having the other way around caused
subsequent cases to be eliminated as dead
2020-10-30 15:58:13 +02:00
Vexu
e2e0b6272b
stage2: return same hash for different representations of same value 2020-10-30 15:58:13 +02:00
Vexu
3cc68bd913
stage2: switch liveness analysis 2020-10-30 15:58:13 +02:00
Vexu
769d5a9c43
stage2: switch comptime execution 2020-10-30 15:58:13 +02:00
Vexu
12e4c648cc
stage2: implement switch validation for integers 2020-10-30 15:58:13 +02:00
Vexu
4155d2ae24
stage2: switch ranges and multi item prongs 2020-10-30 15:58:13 +02:00
Vexu
3c96d79953
stage2: disallow switching on floats 2020-10-30 15:58:13 +02:00