Commit Graph

14957 Commits

Author SHA1 Message Date
Andrew Kelley
968c969e2a add m68k musl (1.2.2) headers
This commit also corrects a mistake from commit
6dc2236054 which did not properly delete
files when upgrading to the 1.2.2 musl headers.
2021-08-16 01:40:27 -07:00
Andrew Kelley
2f599b655b update src/ to LLVM 13 rc1 API 2021-08-16 01:11:10 -07:00
Andrew Kelley
a69b86003c update CI scripts to llvm 13 rc1 2021-08-15 23:11:01 -07:00
Andrew Kelley
7adf15682c update target CPU features with LLVM 13 rc1 data 2021-08-15 23:09:55 -07:00
Andrew Kelley
d6467dcf71 update clang tools to 13 rc1 2021-08-15 18:06:29 -07:00
Andrew Kelley
21606339af update C header files to clang 13 rc1 2021-08-15 18:00:10 -07:00
Andrew Kelley
78ff2a148a cmake: update to LLVM 13 rc1
More precisely, aac4fe380d16a957627af2d6e5110ee35ad7e7e7 which is the
current tip of release/13.x.

Immediately following commits are tracking the same LLVM version.
2021-08-15 17:48:37 -07:00
Veikka Tuominen
e9bf8014bd
Merge pull request #9559 from squeek502/walker-basename
fs.Dir.Walker: Fix basename missing its first character for direct children of the initial directory
2021-08-14 11:08:10 +03:00
Meghan
fcf2ce0ffe std.fmt: add name of type in unsupport format string compile error 2021-08-14 11:07:01 +03:00
Thom Chiovoloni
c2635f9b02
Fix darwin ulock usage on macOS (#9545)
* Fix darwin ulock usage on macOS

* Fix review comments, and correctly handle timeout overflow on darwin

* Apply more review suggestions
2021-08-13 22:43:42 -05:00
Ayende Rahien
65208a7fa2
Expose register_eventfd, register_eventfd_async, unregister_eventfd i… (#9449)
* Expose register_eventfd, register_eventfd_async, unregister_eventfd in the IO URing API

* Fixing formatting

* Fixing typo

* Removing unnecessary casts and adding better comments for a single registration of eventfd

* Update lib/std/os/linux/io_uring.zig

Co-authored-by: Joran Dirk Greef <joran@coil.com>

* Update lib/std/os/linux/io_uring.zig

Co-authored-by: Joran Dirk Greef <joran@coil.com>

* Updating util function name

Co-authored-by: Joran Dirk Greef <joran@coil.com>
2021-08-13 22:41:18 -05:00
Ryan Liptak
f6bb56f8c7 Improve fs.Walker test
- Take into account that iteration order is undefined by checking against a map instead of relying on numerically sorted iteration order
- Check both path and basename for each entry instead of just path
2021-08-13 16:43:52 -07:00
Ryan Liptak
7e07df06a4 ComptimeStringMap: expose kvs array in returned struct
Allows for iterating over the kvs when constructing with a list literal instead of having to create a separate array to pass into ComptimeStringMap in order to maintain access to the values.

For example when making a set, before in order to loop over the kvs you'd have to do something like:

    const MyKV = struct { @"0": []const u8 };
    const kvs: []const MyKV = &[_]MyKV{ .{ @"0" = "foo"}, .{ @"0" = "bar" } };
    const map = ComptimeStringMap(void, kvs);
    for (kvs) |kv| {}

whereas now it's possible to do:

    const map = ComptimeStringMap(void, .{ .{"foo"}, .{"bar"} });
    for (map.kvs) |kv| {}
2021-08-13 16:22:56 -07:00
Ryan Liptak
8ff49966bc fs.Walker: Fix basename missing its first character for direct children of the initial directory
Closes #9557
2021-08-13 16:22:56 -07:00
Jakub Konka
1373df4c34
Merge pull request #9227 from mathetake/libc-wasi-test
WASI,libc: fix libstd with wasi-libc linkage, and enable tests.
2021-08-13 21:56:32 +02:00
Takeshi Yoneda
68617c9fb0 Add comment about compiletime check.
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-08-13 21:54:18 +09:00
Takeshi Yoneda
ca4898c0f3 Use std.buuiltin instead of importing builtin
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-08-13 21:49:52 +09:00
Jakub Konka
c53423f8aa macho: don't cache unused link options
This will change incrementally once we support more linker options.
2021-08-13 10:46:53 +02:00
Andrew Kelley
0961c1975a update_cpu_features tool: work around stage1 bug
This works around a stage1 compiler bug resulting in a segfault when
trying to use the tool.
2021-08-12 11:30:55 -07:00
Andrew Kelley
55c6a784a5 stage2 frontend improvements - @ptrCast and optionals
* AstGen: use coerced_ty ResultLoc on array types and rely on Sema
   doing type coercion, to reduce the size of the ZIR for these
   instructions.

 * Sema: implement `@ptrCast`.

 * Sema: implement coercion from `T` to `?T` with an intermediate
   coercion rather than equality check.
2021-08-12 10:48:54 -07:00
Andrew Kelley
fc55814faa compiler-rt: do not depend on usingnamespace
The idea is to depend on this language feature as little as possible
with the hopes that it can be adjusted to be less of an anti-pattern.
This also helps self-hosted, which does not yet implement
`usingnamespace`, get closer to being able to build compiler-rt.
2021-08-12 10:48:54 -07:00
Andrew Kelley
6eecc4af99 stage2 llvm backend: implement const inttoptr 2021-08-12 10:48:54 -07:00
Andrew Kelley
a0670e748e
Merge pull request #9166 from joachimschmidt557/stage2
stage2 Sema: Add error notes to unresolvable peer types
2021-08-12 13:22:27 -04:00
Jakub Konka
394d287778
Merge pull request #9535 from FnControlOption/128-bit-cmpxchg-test
Re-enable 128-bit cmpxchg test
2021-08-12 16:42:37 +02:00
Jakub Konka
f49aa960a9 macho: use ArrayHashMap.popOrNull where applicable 2021-08-12 10:20:57 +02:00
Jakub Konka
f01366e8b3 macho: exclude tentative def before checking for collision
when resolving global symbols.
2021-08-12 10:20:57 +02:00
Jakub Konka
35403d41ce macho: use array hashmaps for quick lookups
as containers for unresolved and tentative definitions when resolving
symbols.
2021-08-12 10:20:57 +02:00
Jakub Konka
da57d6df32 macho: simplify symbol management and resolution
instead of globally storing unresolved and tentative defs,
store indices to actual symbols in the functions that are responsible
for symbol resolution.
2021-08-12 10:20:57 +02:00
Ryan Liptak
493822ac3b Update mem.split/mem.tokenize doc comments
Follow up to #9531
2021-08-11 21:19:03 -04:00
Jakub Konka
0686954802
Merge pull request #9549 from ziglang/tapi-v3
macho: handle TAPI v3 and simplify handling of dependent dynamic libraries
2021-08-11 22:48:03 +02:00
Jakub Konka
5d548cc651 macho: move parsing logic for Object, Archive and Dylib into MachO
This way, the functionality is better segregated, and we finally do
not unnecessarily reparse dynamic libraries that were already visited
and parsed.
2021-08-11 19:38:00 +02:00
Jakub Konka
16bb5c05f1 macho: refactor stub parsing in Dylib 2021-08-11 19:38:00 +02:00
Jakub Konka
d95e8bc5f8 macho: simplify versioning logic for TAPI 2021-08-11 19:38:00 +02:00
Jakub Konka
8afe6210e9 macho: add TAPI v3 parser
This turns out needed to correctly support version back to macOS
10.14 (Mojave)
2021-08-11 19:38:00 +02:00
Jakub Konka
60a5552d41
Merge pull request #9532 from ziglang/basic-ios-support
Add minimal support to Zig toolchain to support building iOS binaries
2021-08-11 19:36:21 +02:00
Jakub Konka
509fe33d10 macho: when targeting simulator, match host dylibs too
otherwise, linking may fail as some libc functions are provided by
the host when simulating a different OS such iPhoneOS.
2021-08-10 13:41:10 +02:00
Jakub Konka
9ab8d065b6 macho: deinit BuildVersion load command 2021-08-10 13:41:10 +02:00
Jakub Konka
e9bee08f88 Try audodetecting sysroot when building Darwin on Darwin
This is now no longer limited to targeting macOS natively but also
tries to detect the sysroot when targeting different Apple platforms
from macOS; for instance targeting iPhone Simulator from macOS. In
this case, Zig will try detecting the SDK path by invoking
`xcrun --sdk iphonesimulator --show-sdk-path`, and if the command
fails because the SDK doesn't exist (case when having CLT installed only)
or not having either Xcode or CLT installed, we simply return null
signaling that the user has to provide the sysroot themselves.
2021-08-10 13:41:10 +02:00
Jakub Konka
2371a63bd4 macho: allow .simulator ABI when targeting Apple simulator env
For example, in order to run a binary on an iPhone Simulator,
you need to specify that explicitly as part of the target as
`aarch64-ios-simulator` rather than `aarch64-ios-gnu` or
`aarch64-ios` for short.
2021-08-10 13:41:10 +02:00
Jakub Konka
7007684984 macho: swap out VERSION_MIN for BUILD_VERSION
this makes the app successfully run on the iOS simluator!
2021-08-10 13:41:10 +02:00
Jakub Konka
ace9b3de64 macho: fix parsing target string when linking against tbds 2021-08-10 13:41:07 +02:00
Jakub Konka
049ff45430 macho: add basic support for building iOS binaries
* ensure we correctly transfer `-iwithsysroot` and
  `-iframeworkwithsysroot` flags with values from `build.zig` and that
  they are correctly transferred forward to `zig cc`
* try to look for `libSystem.tbd` in the provided syslibroot - one
  caveat that the user will have to specify library search paths too
2021-08-10 13:40:39 +02:00
Jakub Konka
f2bf1390a2 macho: fix linking of dylibs and frameworks
Previously, I have incorrectly assumed that with two-level namespace
we only need to link in dylibs/frameworks that actually export symbols
which are undefined in the linked image. Turns out, regardless of
whether we link with two-level namespace (default on macOS) or a
flat namespace (more common on other platforms), we always need to
put the dylibs/frameworks as specified by the user from the linker
line into the final linked image.
2021-08-10 08:13:07 +02:00
Frank Denis
2ccd023c6a
Ip4Address parser: reject 0-prefixed components (#9538)
Some parsers interpret these as octal, some don't, and the confusion can lead to vulnerabilities.

Return error.NonCanonical when parsing IPv4 addresses with 0 prefixes.
2021-08-09 22:44:23 +02:00
Takeshi Yoneda
97560cd915 Merge remote-tracking branch 'origin' into libc-wasi-test 2021-08-09 14:39:26 +09:00
Takeshi Yoneda
7814a2bd4a review: use defined flag for oflags.
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-08-09 14:36:11 +09:00
FnControlOption
f91782c6d1 Skip 128-bit cmpxchg test if CMPXCHG16B is not supported 2021-08-08 09:21:30 -07:00
Andrew Kelley
799fedf612 stage2: pass some error union tests
* Value: rename `error_union` to `eu_payload` and clarify the intended
   usage in the doc comments. The way error unions is represented with
   Value is fixed to not have ambiguous values.
 * Fix codegen for error union constants in all the backends.
 * Implement the AIR instructions having to do with error unions in the
   LLVM backend.
2021-08-07 20:34:28 -07:00
Andrew Kelley
f81b2531cb stage2: pass some pointer tests
* New AIR instructions: ptr_add, ptr_sub, ptr_elem_val, ptr_ptr_elem_val
   - See the doc comments for details.
 * Sema: implement runtime pointer arithmetic.
 * Sema: implement elem_val for many-pointers.
 * Sema: support coercion from `*[N:s]T` to `[*]T`.
 * Type: isIndexable handles many-pointers.
2021-08-07 15:46:53 -07:00
FnControlOption
d19e1709b3 Re-enable 128-bit cmpxchg test 2021-08-07 12:22:10 -07:00