16969 Commits

Author SHA1 Message Date
Andrew Kelley
2f42a2617b CI: more stage2 test coverage
* Test everything on the Linux CI even if we can't run it, because it's
   our fastest machine.
 * Test stage2 using a build of stage2 (instead of using `-fno-stage1`)
   so that compiler-rt is also built with stage2.
 * Additionally test running x86_64-macos on the macOS CI, both the LLVM
   backend and x86_64 backend.
2022-02-17 23:41:58 -07:00
Andrew Kelley
9ea253b9c4 Sema: implement type info for structs 2022-02-17 20:48:09 -07:00
Andrew Kelley
23567cdd98 build.zig: fix test-stage2 regression with -Denable-llvm
Regressed in cc9eb9e90fec961a74e90e1ab3d66a7b8ec14f47 due to a merge
conflict.
2022-02-17 20:48:09 -07:00
Andrew Kelley
0bb22600bd Sema: fix typeinfo for enums with no declarations 2022-02-17 20:48:09 -07:00
Andrew Kelley
feb4b01b38 Sema: fix typeinfo for sentinels of array and pointer 2022-02-17 20:48:09 -07:00
J87
b837855317 Replace magic numbers with clearer representation
Replaces two magic numbers with the procedure used to generate them, in order to keep consistent with other implementations for f64 & f128.
2022-02-17 21:20:04 -05:00
Andrew Kelley
5aa35f62c3 Revert "reduce build error noise"
This reverts commit baead472d7641bdd96130354bafadc1fb1ed223b.

Let's go through the proposal process on this one. I want to push back
on this. My position is that, at the very least, a full trace of command
lines of sub-processes should be printed on failure, with the exception
of opt-in flags such as `--prominent-compile-errors`.
2022-02-17 14:30:12 -07:00
Veikka Tuominen
6235afc632 stage1: fix f80 negation 2022-02-17 23:06:46 +02:00
Andrew Kelley
f20929bd8b stage2: fix crash using -femit-bin 2022-02-17 13:12:31 -07:00
Andrew Kelley
63cbec1a96 stage2: add more functions to freestanding libc
The log functions are not passing behavior tests.
2022-02-17 13:11:58 -07:00
Luuk de Gram
ced958e8a8 wasm-linker: Simplify symbol names
No longer duplicate the symbol name and instead take the pointer from the decl itself.
Also fix 32bit build
2022-02-17 18:11:48 +01:00
Luuk de Gram
4ebe8a53ca wasm-linker: Fix symbol resolving and relocs
- Correctly get discard symbol by first checking if it was discarded or not.
- Remove imports if extern symbols were resolved by an object file.
- Correctly relocate data symbols by ensuring the atom is from the correct file.
- Fix the `Names` section by using the resolved symbols, rather than the ones defined in Zig code.
2022-02-17 18:11:48 +01:00
Luuk de Gram
a4622501bd wasm-linker: Allocate atoms and handle imports
We now correctly allocate and create atoms for symbols from other object files.
Imports are now also resolved and appended when required.
Besides those changes, we now duplicate all symbol names, so we can correctly
generate unique names for unnamed constants.
TODO: String interning
2022-02-17 18:11:48 +01:00
Luuk de Gram
f1cc5f33e8 wasm-linker: Implement section merging
This implements the merging of all sections, to generate a valid wasm binary where all symbols
have been resolved and their respective sections have been merged into the final binary.
2022-02-17 18:11:48 +01:00
Luuk de Gram
e7be0bef43 wasm-linker: Add Object file parsing
This upstreams the object file parsing from zwld, bringing us closer to being able
to link stage2 code with object files/C-code as well as replacing lld with the self-hosted
linker once feature complete.
2022-02-17 18:11:48 +01:00
Jakub Konka
d1c74ac42d
Merge pull request #10914 from ziglang/x64-more-codegen
stage2,x64: refactor stack mgmt mechanics, implement slice, fix ptr_add and ptr_sub
2022-02-17 18:05:30 +01:00
Jakub Konka
3193cc1c1e x64: fix ptr_add and ptr_sub
Add standalone implementation of operand reuse for ptr related
arithmetic operations of add and sub.
2022-02-17 15:07:42 +01:00
Jonathan Marler
baead472d7 reduce build error noise
Address https://github.com/ziglang/zig/issues/3477
This provides a mechanism for builds to fully report an error to the user and prevent zig from piling on extra noise.
2022-02-17 14:48:22 +02:00
John Schmidt
e2ad95c088 stage2: implement vector floatops 2022-02-17 14:47:21 +02:00
Koakuma
755d116ecf stage1: use u16 for __truncxfhf2/__extendhfxf2 on non-Arm CPUs
Non-Arm CPUs use u16 as the parameter to __extendhfxf2 and the return value of
__truncxfhf2, so insert appropriate bitcasts in gen_soft_f80_widen_or_shorten.
Otherwise, LLVM might crash because the functions are called in a different way
than its compiler-rt definition.

This fixes stage1 build on SPARCv9, and possibly other non-x86, non-Arm CPUs.
2022-02-17 14:46:04 +02:00
Hadrien Dorio
02902cc099
ci: azure: split build-and-test step (#10853)
replace the .bat script by a pwsh script
2022-02-16 22:33:08 -05:00
Andrew Kelley
df8c325012
Merge pull request #10907 from ziglang/ci-windows-zig-cc
CI: windows: depend on Zig instead of CMake and MSVC
2022-02-16 20:44:42 -05:00
Andrew Kelley
25a7025613 ci: use zig-bootstrap for windows 2022-02-16 18:43:45 -07:00
Jakub Konka
c1fb14c51e x64: handle storing non-pow2 values to stack from register
This actually requires storing and shifting mechanics so that we
don't accidentally clobber anything else on the stack.
2022-02-17 00:26:00 +01:00
Andrew Kelley
cc9eb9e90f build.zig: bootstrap stage1 with zig0
Instead of assuming that the zig version used with `zig build` is
appropriate for building the self-hosted compiler component, we follow
the same path as the cmake build script and build zig0, using that to
produce zig1.o, re-linking to produce stage1.

This allows an arbitrarily old Zig version and corresponding build.zig
script to build all future versions of Zig from source via the bootstrap
compiler. In other words, it allows us to use `zig build` as an
alternative to cmake when bootstrapping.
2022-02-16 14:12:15 -07:00
Andrew Kelley
2b3df5c81d link: avoid double close on openPath error 2022-02-16 14:12:15 -07:00
Jakub Konka
94474ec7c7 x64: refactor use of inline memcpy 2022-02-16 21:40:08 +01:00
Jakub Konka
09d468b237 x64: overhaul stack handling mechanics
Now, the abstracted stack offsets grow in the same direction as
the real stack values in hardware, and allocating stack memory is done
by the taking the last stack offset, adding required abi size
and aligning to the required abi align. Stack handling is now more
natural as it aligns itself with how it works in hardware; hence
stepping through the debugger and printing out different stack
values is intuitive. Finally, the stack pointers are now correctly
aligned to the required (and not necessarily natural) alignment.
2022-02-16 20:35:03 +01:00
joachimschmidt557
1a84c23d69 stage2 AArch64: Simplify and correct invocations of genInlineMemcpy
Previously, the invocations used movk instead of movz
2022-02-16 15:47:44 +01:00
Jakub Konka
d3edf298d1 x64: fix signed truncate 2022-02-16 15:24:04 +01:00
Jakub Konka
1b7ec44924 x64: separate ptr_add and ptr_sub from normal bin ops 2022-02-16 15:00:32 +01:00
Jakub Konka
3383064b27 x64: implement airSlice 2022-02-16 14:13:06 +01:00
Jakub Konka
78e6f9c44c x64: fix ptr_add
However, still missing is taking into account pointer alignment
when performing arithmetic.
2022-02-16 14:13:06 +01:00
Jakub Konka
c7775a9f62 x64: impl genBinMathOpMir for ptr_stack_off and PIE memory 2022-02-16 14:13:06 +01:00
iddev5
77e5b042a0 fmt: allow uppercase prefix to be parsed in std.fmt.parseInt()
std.fmt.parseHexFloat allow both 0x and 0X as prefix, so in order to
keep things consistent. This commit modifies std.fmt.parseWithSign to
check for the prefix case insensitively in order to allow both upper
case and lower case prefix.

This change now allows: 0O, 0B and 0X as prefixes for parsing.
2022-02-16 11:27:10 +01:00
Jakub Konka
5283a52af5 macho: handle binary updates in dSYM companion file
* move DWARF in file if LINKEDIT spilled in dSYM
* update VM addresses for all segments
* introduce copyFileRangeOverlappedAll instead of File.copyRangeAll
  since we make lots of overlapping writes in MachO linker
2022-02-16 08:38:28 +01:00
Andrew Kelley
0b22b6b70e ci: update x86_64-linux tarballs
The updated docker images has LLVM, LLD, Clang updated to 13.0.1 and Zig
updated to 0.9.1.
2022-02-15 20:12:10 -07:00
Andrew Kelley
65cb8a03ee CI: update macos and freebsd tarballs 2022-02-15 19:50:38 -07:00
Andrew Kelley
22f464a8c3 zig cc: handle -l :FILE syntax
This "feature" of gcc/clang means to treat this as a positional
link object, but using the library search directories as a prefix.

We solve this problem in the CLI layer, using a separate map for
the data since it is an uncommon case.

Closes #10851
2022-02-15 17:36:12 -07:00
Jakub Konka
092b019a2f
Merge pull request #10899 from ziglang/arm64-macos
aarch64,macos: handle GOT and direct loads in codegen
2022-02-16 00:18:42 +01:00
Jakub Konka
1c975607e1 aarch64: add lowerUnnamedConst glue to codegen 2022-02-15 21:04:40 +01:00
Jakub Konka
5bba041bae aarch64: introduce MCValue.got_load and MCValue.direct_load
This matches the current design in x86_64 backend and significantly
simplifies handling of PIE targets in aarch64 backend.
2022-02-15 21:04:40 +01:00
Jakub Konka
9c82f3ae6f stage2: disable failing aarch64-macos behavior tests 2022-02-15 21:04:36 +01:00
Veikka Tuominen
cf5009f9af
Merge pull request #10003 from viriuwu/nt-thread-name
std.Thread.getName/setName: rework windows implementation
2022-02-15 13:23:09 +02:00
Anthony Carrico
078aa5f7b2 Adds Linux support for POSIX file locking with fcntl
On Linux, locking fails with EAGAIN (vs. EACCES on other systems).
This commit also adds FcntlErrors for EDEADLK and ENOLCK.
2022-02-15 13:22:50 +02:00
Jan Philipp Hafer
c6cd919a18 stage1: fix comptime saturation subtraction
- also simplifies code
- adding a few more tests

closes #10870
2022-02-15 10:40:53 +02:00
viri
0bde55e881
std.Thread(windows): use NT internals for name fns 2022-02-15 01:20:54 -06:00
Jakub Konka
be98f30a2d
Merge pull request #10893 from joachimschmidt557/stage2-aarch64
stage2 AArch64: get zig test working; enable behavior tests
2022-02-15 07:05:24 +01:00
Andrew Kelley
dc6553d93e CI: update download page and langref for 0.9.1 2022-02-14 20:08:04 -07:00
John Schmidt
807edd2234
LLVM backend: refactor LLVM bitcount ops (#10882)
Use `llvm.getIntrinsic` instead of `llvm.getNamedFunction`
2022-02-14 21:52:12 -05:00