Commit Graph

7791 Commits

Author SHA1 Message Date
Andrew Kelley
e8a84927ab
Merge pull request #4478 from ziglang/self-host-libc-detection
self-hosted libc and dynamic linker detection
2020-02-17 22:45:49 -05:00
Andrew Kelley
35f0cb049e
stage2: fix invalid iteration code in std.ast.Node.Asm
closes #4480
2020-02-17 20:25:02 -05:00
Andrew Kelley
99520c4e69
target_os_requires_libc implies dynamic linking 2020-02-17 19:49:19 -05:00
Andrew Kelley
5a4e8c779a
smarter detectNativeDynamicLinker logic
The current target's ABI cannot be relied on for this.
For example, we may build the zig compiler for target
riscv64-linux-musl and provide a tarball for users to
download. A user could then run that zig compiler on
riscv64-linux-gnu. This use case is well-defined and
supported by Zig. But that means that we must detect
the system ABI here rather than
relying on `std.Target.current`.
2020-02-17 19:26:32 -05:00
Andrew Kelley
b53afc510c
update dl_iterate_phdr test case to new API 2020-02-17 17:22:32 -05:00
Andrew Kelley
8fe636dafd
fix ABI mismatch of ZigTarget in stage2 glue code 2020-02-17 16:49:30 -05:00
Andrew Kelley
9b02cab3da
fix glibc not forcing dynamic link 2020-02-17 16:37:22 -05:00
Andrew Kelley
a959e98273
target requiring PIC does not imply dynamic linking
Related: #3237
2020-02-17 16:16:58 -05:00
Andrew Kelley
4b91e4c91f fix dynamic linker detection on windows (where there isn't one) 2020-02-17 16:03:01 -05:00
Andrew Kelley
e26f063b22 support the concept of a target not having a dynamic linker 2020-02-17 15:46:53 -05:00
Andrew Kelley
2f9c5c0644
self-host dynamic linker detection 2020-02-17 15:23:59 -05:00
Andrew Kelley
c784c52819
fix backwards warning of zig libc
crt_dir is only not required for darwin
2020-02-17 01:15:43 -05:00
Andrew Kelley
44c14749a1
expand argv[0] when spawning system C compiler
Some C compilers, such as Clang, are known to rely on
argv[0] to find the path to their own executable,
without even bothering to resolve PATH. This results
in the message:

error: unable to execute command: Executable "" doesn't exist!

So we tell ChildProcess to expand argv[0] to the absolute path
to give them a helping hand.
2020-02-17 00:58:30 -05:00
Andrew Kelley
a5d47be5ad
stage1 os_update_file additionally compares src and dest size
prevents problems when source is created and then immediately copied to
dest.
2020-02-16 22:50:04 -05:00
Andrew Kelley
d5860cbade fix os_update_file implementation on Windows 2020-02-16 22:34:40 -05:00
Andrew Kelley
364a284eb3
stage1 os: handle errors from read/write
not sure why the CI is complaining about these now and not in master
branch. but this is a slight code improvement anyway
2020-02-16 21:35:12 -05:00
Andrew Kelley
a26800c099
stage1: don't copy unchanged output files
when both `--cache on` and `--output-dir` parameters
are provided. This prevents re-linking `zig` with every
`make` even when `libzigstage2.a` was unchanged.
2020-02-16 21:10:03 -05:00
Andrew Kelley
5c54d7bee7
add missing implementations of libc installation to detect msvc paths 2020-02-16 19:58:27 -05:00
Andrew Kelley
20f3b0efff rename libuserland to libstage2 2020-02-16 19:16:08 -05:00
Andrew Kelley
c25742010d add the dummy libc paths back in 2020-02-16 19:02:26 -05:00
Andrew Kelley
7eb0a3edce
remove libc dependency of zig0 building libstage2
Rather than `zig0 build ...` the build now does
`zig0 build-lib ...`, avoiding the requirement of linking the build
script, and thus avoiding the requirement of finding native libc,
for systems where libc is the system ABI.
2020-02-16 18:57:34 -05:00
Andrew Kelley
39ee46a6c1 fix building zig0 -> zig on macos 2020-02-16 17:35:35 -05:00
Andrew Kelley
8173fbfb66
implement os.faccessat for Windows 2020-02-16 17:10:43 -05:00
Andrew Kelley
4b02a39aa9
self-hosted libc detection
* libc_installation.cpp is deleted.
   src-self-hosted/libc_installation.zig is now used for both stage1 and
   stage2 compilers.
 * (breaking) move `std.fs.File.access` to `std.fs.Dir.access`. The API
   now encourages use with an open directory handle.
 * Add `std.os.faccessat` and related functions.
 * Deprecate the "C" suffix naming convention for null-terminated
   parameters. "C" should be used when it is related to libc. However
   null-terminated parameters often have to do with the native system
   ABI rather than libc. "Z" suffix is the new convention. For example,
   `std.os.openC` is deprecated in favor of `std.os.openZ`.
 * Add `std.mem.dupeZ` for using an allocator to copy memory and add a
   null terminator.
 * Remove dead struct field `std.ChildProcess.llnode`.
 * Introduce `std.event.Batch`. This API allows expressing concurrency
   without forcing code to be async. It requires no Allocator and does
   not introduce any failure conditions. However it is not thread-safe.
 * There is now an ongoing experiment to transition away from
   `std.event.Group` in favor of `std.event.Batch`.
 * `std.os.execvpeC` calls `getenvZ` rather than `getenv`. This is
   slightly more efficient on most systems, and works around a
   limitation of `getenv` lack of integration with libc.
 * (breaking) `std.os.AccessError` gains `FileBusy`, `SymLinkLoop`, and
   `ReadOnlyFileSystem`. Previously these error codes were all reported
   as `PermissionDenied`.
 * Add `std.Target.isDragonFlyBSD`.
 * stage2: access to the windows_sdk functions is done with a manually
   maintained .zig binding file instead of `@cImport`.
 * Update src-self-hosted/libc_installation.zig with all the
   improvements that stage1 has seen to src/libc_installation.cpp until
   now. In addition, it now takes advantage of Batch so that evented I/O
   mode takes advantage of concurrency, but it still works in blocking
   I/O mode, which is how it is used in stage1.
2020-02-16 13:25:30 -05:00
Andrew Kelley
5e37fc0746
more user-friendly error message for some clang diagnostics
See #4455
2020-02-16 01:45:48 -05:00
Andrew Kelley
7f7d1fbe5a
Implement noasync awaits
Note that there is not yet runtime safety for this.

See #3157
2020-02-16 01:44:52 -05:00
Andrew Kelley
cb3a818699
zig fmt: support noasync await 2020-02-16 01:44:52 -05:00
Andrew Kelley
72805fd66e
fix taking address of temporary async frame 2020-02-16 01:44:49 -05:00
Michael Dusan
652efe38b4
Merge pull request #4467 from mikdusan/translate-c-error
translate-c: change OutOfMemory → ASTUnitFailure
2020-02-15 15:45:02 -05:00
Michael Dusan
8583038640
translate-c: change OutOfMemory → ASTUnitFailure
- return a better error when no diagnostics are available
2020-02-15 05:14:31 -05:00
Vexu
b15958c557 fix c tokenizer bug 2020-02-14 18:57:57 -05:00
Andrew Kelley
9e1afdc234
Merge pull request #4454 from LemonBoy/capture-reform
Payload captures no longer alias the original value
2020-02-14 14:39:00 -05:00
Andrew Kelley
058f38220a enable passing freebsd tests
See #3210 and #4455
2020-02-14 12:00:38 -05:00
LemonBoy
1c8ac2a0c1 test: Add test cases for the new capture behavior 2020-02-14 15:59:28 +01:00
Andrew Kelley
40b9db7cad
Merge pull request #4451 from daurnimator/use-testing.allocator
Migrate (more) tests from FixedBufferAllocator to testing.allocator
2020-02-14 09:40:08 -05:00
Vexu
9206f8a8cd translate-c improve macro cast translation 2020-02-14 09:36:44 -05:00
xackus
7396b144ba modernize std.meta 2020-02-14 09:35:38 -05:00
LemonBoy
3038290a46 ir: Make all the payload captures do a copy
The payload doesn't alias anymore the same memory it comes from and is
instead a fresh copy of the original object.
2020-02-14 15:30:20 +01:00
daurnimator
6ea6d5a4bd
std: use testing.allocator in tests 2020-02-14 19:15:09 +11:00
daurnimator
ca41567924
std: use testing.allocator in big int tests 2020-02-14 18:59:40 +11:00
daurnimator
f20ba7c32c
std: increase memory available to testing allocator 2020-02-14 18:59:25 +11:00
daurnimator
b61e53cc40
std: bigint.deinit() shouldn't need a mutable pointer 2020-02-14 18:59:07 +11:00
Andrew Kelley
fb6b94f80f
cmake: remove case mismatch detection on build mode
See discussion here for context:
c6df5deb34 (comments)

Michael - I appreciate what you did here, making the configure script
work better for people in practice. When it was checking the build type
against a whitelist, I think it was worth it. However, now that we are
supporting systems which use non-standard cmake build modes, I don't
think this case-mismatch detection thing is worth it. It's starting to
get to the point where it's a lot of complication for very little
benefit. Besides, cmake is not case sensitive. If we support
non-standard build modes, then we would need to support a hypothetical
build mode of `release` (lower case).

So let's just remove this and rely on people to use the build system
correctly (like they will have to do when building any cmake project
from source).
2020-02-13 20:47:44 -05:00
Felix (xq) Queißner
cf67d30cdc Makes ArenaAllocator.deinit() not require a mutable reference. 2020-02-13 16:19:34 -05:00
LemonBoy
a090a5e3bc ir: Don't crash when converting undefined ptrs 2020-02-13 16:18:24 -05:00
Andrew Kelley
e8dfc5e7f6
Merge pull request #4442 from fengb/testing-allocator-calls
Migrate tests from FixedBufferAllocator to testing.allocator
2020-02-13 16:17:21 -05:00
Andrew Kelley
de23c57133
Merge branch 'LemonBoy-revive-3904'
closes #3904
closes #4448
2020-02-13 16:14:10 -05:00
Andrew Kelley
cdba521a06
annotate skipped test with issue link 2020-02-13 16:13:53 -05:00
data-man
948a463cf1
fmt: vector formatting 2020-02-13 16:12:54 -05:00
Andrew Kelley
1675d4f82b
Merge pull request #4443 from LemonBoy/werkzeug
A train of small patches
2020-02-13 13:12:18 -05:00