11472 Commits

Author SHA1 Message Date
Miles Alan
cdde9d8885 std/event: Fix import path for WaitGroup 2020-12-03 13:44:25 -07:00
Andrew Kelley
ff802cc996 stage2: don't pass -l arguments when building .a or .o files
See #7094
2020-12-02 20:25:03 -07:00
LemonBoy
0ac43154eb std: Add nosuspend around stderr.print calls 2020-12-02 17:54:34 -07:00
Vexu
401d091fb4 std.build: addBuildOption special handling for SemanticVersion 2020-12-02 17:54:29 -07:00
Andrew Kelley
b1f52ca7f2 stage2: linkAsArchive: respect disable_lld_caching
Closes #7274
Closes #6943
2020-12-02 16:40:00 -07:00
LemonBoy
02cb3841a6 ci: Retry apt-get install at most three times
Try harder instead of failing after the first invocation fails.
2020-12-02 16:16:36 -07:00
LemonBoy
7c13bec7cb std: make the use of pthread_join POSIX-compliant
Applications supplying their own custom stack to pthread_create are not
allowed to free the allocated memory after pthread_join returns as,
according to the specification, the thread is not guaranteed to be dead
after the join call returns.

Avoid this class of problems by avoiding the use of a custom stack
altogether, let pthread handle its own resources.

Allocations made on the child stack are now done on the C heap.

Thanks @semarie for noticing the problem on OpenBSD and suggesting a
fix.

Closes #7275
2020-12-02 16:16:31 -07:00
Mathieu Guay-Paquet
7add370371 fix the tinyest typo 2020-12-02 16:16:02 -07:00
daurnimator
d15a0ec7b2 Localhost is special (#6955)
* std: always return loopback address when looking up localhost

* std: also return Ipv6 loopback

* std: remove commented out obsolete code
2020-12-01 17:14:43 -07:00
LemonBoy
0858d7b0df stage2: Create cache manifest before calling final
If we enter the `if` because `comp.disable_c_depfile` is false the `man`
object has no manifest and calling .final on it will trip an assertion.

Closes #7096
2020-12-01 16:52:52 -07:00
Andrew Kelley
a4c8bd8fd4 stage2: add -femit-foo=bar args to the cache hash
Closes #6979
Closes #7036
2020-12-01 16:36:37 -07:00
Alexandros Naskos
7099dff7ea Add package names and paths to the zig root module cache hash.
Add package names to the stage1 cache hash and package files to the
stage1 manifest file.
2020-12-01 14:57:27 -07:00
Timon Kruiper
6bf19e32e7 Make sure to include the root_name in the cache.
This fixes a bug where the caching system did not notice when the
--name flag changed.
2020-12-01 11:39:15 -07:00
Andrew Kelley
c8b8f0ea13 COFF linking: fix incorrectly passing .dll instead of .lib
commit 9d1816111d1d30e18b8cb43a4aa31c194fb204c4 used the "output path"
as the path for passing shared library artifact paths to the Zig CLI.
For Windows, this was incorrect because it would pass the .dll instead
of the .lib file. This commit passes the "output lib path" instead,
which makes it pass the .lib path in case of a .dll on Windows.

This way the linker does not complain and say, "bad file type. Did you
specify a DLL instead of an import library?"
2020-12-01 11:31:48 -07:00
Andrew Kelley
d2445764a9 restore -target wasm32-freestanding-musl for C headers
See #5854

Some tiny tweaks too:
 * Use `wasm-freestanding-musl` instead of `wasm32-freestanding-musl`,
   making it pointer-size-agnostic.
 * Fix trying to build non-existent wasm musl start files.
2020-11-30 20:58:31 -07:00
Andrew Kelley
a9b7d8fa07 stage2: fix not detecting all dynamic libraries
Positional shared library arguments were not being detected as causing
dynamic linking, resulting in invalid linker lines. LLD did not have an
error message for this when targeting x86_64-linux but it did emit an
error message when targeting aarch64-linux, which is how I noticed the
problem.

This surfaced an error having to do with fifo.pipe() in the cat example
which I did not diagnose but solved the issue by doing the revamp that
was already overdue for that example.

It appears that the zig-window project was exploiting the previous
behavior for it to function properly, so this prompts the question, is
there some kind of static/dynamic executable hybrid that the compiler
should recognize? Unclear - but we can discuss that in #7240.
2020-11-30 20:58:15 -07:00
Andrew Kelley
57ac835a03 Merge branch 'alexnask-fix_6868' into master
Closes #7139
Closes #6868
2020-11-30 18:13:06 -07:00
Andrew Kelley
3c907e51d1 fix regression on wasm targets
The previous commit broke wasm targets because the linking step would
look for the compiler-rt lib in the wrong place. Fixed in this commit.
2020-11-30 17:47:24 -07:00
Andrew Kelley
791e38da8c Merge branch 'alexnask-bundle_compiler_rt' into master
Closes #7013
Closes #6817
2020-11-30 16:50:56 -07:00
Michael Freundorfer
1a61a9d4bf Fix WindowsDynLib.openW trying to strip the \??\ prefix when it does not exist 2020-11-30 12:13:17 -07:00
Jonathan Marler
8f346d9a4b fix memory leak in BufMap 2020-11-30 11:40:44 -07:00
LemonBoy
a7c2cfe16d stage1: Fix typeInfo generation for arrays w/o sentinel
ZigTypeIdOptional types have a different way of specifying their payload
value depending on whether the child type is a pointer or not (plus some
other special cases).

Fixes #7251
2020-11-29 11:39:35 -07:00
LemonBoy
0a4a99ec87 stage1: Add missing bitcast when rendering var ptr
Some types require this extra bitcast, eg. structs or unions with extra
padding fields inserted by the compiler.

Fixes #7250
2020-11-29 11:37:44 -07:00
LemonBoy
be2adff087 std: Avoid deadlock in the signal handler
stderr_mutex may still be held when we reach the signal handler, grab
our own stderr handle to print the error messages and avoid deadlocking.

Closes #7247
2020-11-29 11:31:38 -07:00
christian-stephen
a6222d1d4b Add readAllArrayListAligned to Reader which can accept an arbitrary alignment 2020-11-27 18:01:49 -07:00
Andrew Kelley
f09f960ce4 Merge branch 'kubkon-elf-soname-opt-in' into master
closes #7162
2020-11-27 17:57:11 -07:00
LemonBoy
288b8b535f stage1: Fix crash in *[N]T to []T conversion with zst
Prevent the crash by not making the codegen try to access the
non-existing ptr field in the slice.

Closes #6951
2020-11-27 15:34:13 -07:00
LemonBoy
36b8f5d194 stage1: Force union member types to be resolved
No test case because I couldn't reduce the huuuge test case.
Fixes the problem discovered by @ifreund.
2020-11-26 11:50:38 -07:00
Isaac Freund
41d57b051f std/os: fix prctl constants 2020-11-25 16:47:44 -07:00
LemonBoy
24d4bfb666 stage1: Fix ICE when generating struct fields with padding
Make gen_const_ptr_struct_recursive aware of the possible presence of
some trailing padding by always bitcasting the pointer to its expected
type.

Not an elegant solution but makes LLVM happy and is consistent with how
the other callsites are handling this case.

Fixes #5398
2020-11-25 16:36:57 -07:00
Jonathan Marler
06a75c16ff fix for GCC 9.2: -Wno-maybe-uninitialized 2020-11-24 18:32:57 -07:00
Frank Denis
8af016c5be Update the minimum cmake version we require
Recent versions of cmake complain about it:

<<
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.
>>

We don't require anything from version 2.8.5, and version 2.8.12 was
released in 2011, so it is very unlikely that anyone still uses 2.8.5.
2020-11-24 18:32:51 -07:00
Isaac Freund
a05ae01b4f std/os: define and use dev_t for linux x86_64 2020-11-20 18:36:23 -07:00
Isaac Freund
1344706b47 std/os: add time_t definiton for x86_64 linux 2020-11-20 18:36:15 -07:00
LemonBoy
72980388ca stage1: Resolve usingnamespace decls when calling @typeInfo
Closes #7176
2020-11-20 18:02:20 -07:00
LemonBoy
c6c25a1c09 stage1: Fix undefined assignment for bitfields
Prevents silent memory corruption.

Closes #7055
2020-11-18 22:51:34 -07:00
Frank Denis
3f134cfe5e edwards25519 - skip useless operations and duplicate lookup table
Just some trivial changes; no functional changes.

Skip useless nul additions and multiplications and comptime the
basepoint multiples only once.
2020-11-18 21:45:42 -08:00
breakin
e814f71052 Change seed for Murmur2_64 from u32 to u64 2020-11-18 18:06:04 -07:00
Veikka Tuominen
50269f2315 Merge pull request #6649 from Rocknest/verparse
make Version.parse less strict
2020-11-18 17:47:43 -07:00
Vexu
8af0a1987b make help in commands more consistent
Closes #7101

Co-authored-by: pfg <pfg@pfg.pw>
2020-11-18 17:37:14 -07:00
Timon Kruiper
b498d26376 Allow Zig to be built with clang 11 and -Werror
This was brought to the horizon when using zig-bootstrap to cross compile
Zig for windows-gnu.
2020-11-18 17:32:48 -07:00
LemonBoy
d3f1a4edce stage1: Add architecture-specific clobbers to asm()
We're basically following Clang's lead, add the necessary clobbers to
minimize the risk of generating wrong code.
2020-11-18 17:32:41 -07:00
Veikka Tuominen
1add7c616f Merge pull request #7084 from xackus/mem-volatile
std.mem: make sliceAsBytes, etc. respect volatile
2020-11-18 17:31:11 -07:00
Frank Denis
5f9a664de9
STAGE1_SOURCES: In 0.7.x, leb128.zig is in std/debug (#7148)
* STAGE1_SOURCES: In 0.7.x, leb128.zig is in std/debug

* codegen/aarch64.zig doesn't exist in 0.7.x

Co-authored-by: Frank Denis <github@purftpd.org>
2020-11-18 14:53:47 -05:00
LemonBoy
1c8cd268be stage1: Fix asyncCall with non-abi-aligned arguments
Make the code used to calculate the variable slot index into the frame
match what's done during the structure layout calculation.

Prevents a few nasty LLVM errors when such types are passed around.
2020-11-17 16:55:44 -07:00
Andrew Kelley
eea4cd2924 cli: make -h, --help consistent in usage text and parsing
also trivial fixes in the general usage text
2020-11-17 16:54:15 -07:00
Guoxin Yin
4d44a813de Add -h alias for --help 2020-11-17 11:39:42 -07:00
johnLate
51ffb0548d CMake: properly detect when to rebuild zig1.o
This is andrewrk's patch from ziglang#6724 (rebased)

CMake: Fix dependency problem

I don't know whether the error was expected cmake behavior or a bug.
This change seems to fix the issue. See ziglang#6724 for details.

cmake: add the correct set of zig stage2 sources
2020-11-16 18:04:54 -07:00
Alex Cameron
5b42704ea7 Prevent double file close in MachO linking 2020-11-16 15:00:22 -07:00
Frank Denis
c8b6e407ba Enable loop interleaving when unrolling is enabled
This mimics clang's default behavior.
2020-11-16 15:00:16 -07:00