103 Commits

Author SHA1 Message Date
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
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
cdc5070f21
Merge remote-tracking branch 'origin/master' into llvm10 2020-02-10 00:26:33 -05:00
LemonBoy
cfcaf09cce debug: Improve the frame-walking strategy
Clean up the code a bit and introduce a few checks meant to avoid
overshooting the end of the frame chain.
The code is now stable enough not to cause panics during the call frame
walking.
2020-02-06 11:25:40 -05:00
Andrew Kelley
d0b12d7726
Merge remote-tracking branch 'origin/master' into llvm10 2020-02-03 17:30:38 -05:00
Michaël Larouche
9b11e5e1f1 Add InstallRawStep to Zig build system that does a similar job to llvm-objcopy. To use it, do 'exe.installRaw("kernel.bin");' where exe is a LibExeObjStep
Part of #2826
2020-02-03 15:07:34 -05:00
Andrew Kelley
70ee818d21
update target CPUs and features with llvm10's data
based on zig-llvm-target-details-generator
commit 3aef1b9b4415ed3acfaea4ce8bc233e213548f71
2020-01-30 11:31:41 -05:00
Andrew Kelley
c75f65d38c
std.Target: add ve arch 2020-01-29 23:58:28 -05:00
Andrew Kelley
a95dce15ae
Merge remote-tracking branch 'origin/master' into llvm10 2020-01-29 23:33:12 -05:00
Andrew Kelley
800ead2810
update target info to llvm 10
the branch builds now
2020-01-23 17:31:25 -05:00
Andrew Kelley
fbfda7f00e
fix incorrect list of sub-arches for aarch64
tests use older sub-arch that works in the older qemu
2020-01-23 13:02:45 -05:00
Andrew Kelley
ead7d15772
use an older arm64 sub-arch for test suite
hopefully this avoids the older qemu version crashing
2020-01-23 00:41:46 -05:00
Andrew Kelley
fb8e681ea8
update zig_llvm.h and zig_llvm.cpp to llvm 10 2020-01-22 18:43:30 -05:00
Andrew Kelley
9845264a0b
aarch64: less feature-full baseline CPU 2020-01-22 18:40:34 -05:00
Andrew Kelley
0c477f3c79
fix std.Target.Arch.parseCpuFeatureSet unit test 2020-01-22 17:47:18 -05:00
Andrew Kelley
3227aec848
fix not respecting sub-arch feature 2020-01-22 17:35:57 -05:00
Andrew Kelley
48c7e6c48b
std.Target.CpuFeatures is now a struct with both CPU and feature set
Previously it was a tagged union which was one of:
 * baseline
 * a specific CPU
 * a set of features

Now, it's possible to have a CPU but also modify the CPU's feature set
on top of that. This is closer to what LLVM does.

This is more correct because Zig's notion of CPUs (and LLVM's) is not
exact CPU models. For example "skylake" is not one very specific model;
there are several different pieces of hardware that match "skylake" that
have different feature sets enabled.
2020-01-22 17:13:31 -05:00
Andrew Kelley
cbe9a51518
don't trust llvm's GetHostCPUName
comment from this commit reproduced here:

I have observed the CPU name reported by LLVM being incorrect. On
the SourceHut build services, LLVM 9.0 reports the CPU as "athlon-xp",
which is a 32-bit CPU, even though the system is 64-bit and the reported
CPU features include, among other things, +64bit.
So the strategy taken here is that we observe both reported CPU, and the
reported CPU features. The features are trusted more; but if the features
match exactly the features of the reported CPU, then we trust the reported CPU.
2020-01-21 22:02:13 -05:00
Andrew Kelley
68b6867e76
lazily compute the full cpu features dependencies 2020-01-21 20:11:36 -05:00
Andrew Kelley
92559cd02c
hit a comptime limitation with computing dense sets 2020-01-21 19:40:44 -05:00
Andrew Kelley
39759b90fc
make zig targets show native cpu name and features 2020-01-21 01:22:37 -05:00
Andrew Kelley
e640d01535
fixups to arch data, support any number of cpu features 2020-01-21 00:34:54 -05:00
Andrew Kelley
89e107ee4e
uncomment all the archs in target.zig 2020-01-20 23:14:35 -05:00
Andrew Kelley
f3dd9bbdac
improve zig targets 2020-01-20 13:40:25 -05:00
Andrew Kelley
bf82929557
fix std.Target.Arch.parseCpuFeatureSet 2020-01-20 12:41:18 -05:00
Andrew Kelley
8f29d14073
stage1 is building. zig targets now self-hosted 2020-01-20 01:42:31 -05:00
Andrew Kelley
e3b5e91878
do the x86 arch 2020-01-19 20:54:05 -05:00
Andrew Kelley
a867b43366
progress towards merging
see BRANCH_TODO file
2020-01-19 20:54:04 -05:00
Layne Gustafson
430077df1b
Allow target details with no LLVM support 2020-01-19 20:53:20 -05:00
Layne Gustafson
c61856ebcf
Add TargetDetails abstraction 2020-01-19 20:53:19 -05:00
Layne Gustafson
e4ecdefa9a
Rename subfeatures -> dependencies 2020-01-19 20:53:19 -05:00
Layne Gustafson
c8f1e0d6d8
Remove llvm_name from features 2020-01-19 20:53:19 -05:00
Layne Gustafson
c131e50ea7
Switch CPU/features to simple format 2020-01-19 20:53:18 -05:00
Layne Gustafson
8ac138a318
Add parseArchTag and fix parseArchSub 2020-01-19 20:53:18 -05:00
Layne Gustafson
0f46c12f78
Create initial target details infrastructure 2020-01-19 20:53:15 -05:00
LemonBoy
fa52c9e36e Small cleanups 2020-01-19 00:11:45 +01:00
Andrew Kelley
0c8ec369f0
std.os.memfd_create: add error.SystemOutdated 2019-12-31 17:57:20 -05:00
Haze Booth
c70a673c6e array literal address of fix 2019-12-30 05:48:27 -05:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args 2019-12-08 22:53:51 -05:00
Andrew Kelley
10e172b1d7
add other OS and fix regression in build-exe for freestanding 2019-12-04 14:42:40 -05:00
Andrew Kelley
dcbd5ad155
remove upstream support for Zen hobby OS
The new plan to support hobby operating systems is #3784.

And what kind of name is "Zen" anyway? There's already a
[Zen programming language](http://zenlang.sourceforge.net/)
and that's just confusing.
2019-12-02 12:01:49 -05:00
Andrew Kelley
7de138ad7c
std.elf: breaking improvements to the API
and also integration with std.Target.Arch
2019-11-26 14:25:35 -05:00
Andrew Kelley
4261fa3c49
move logic to the appropriate layers; add new compile error 2019-11-25 18:46:17 -05:00
Benjamin Feng
d27721f58c Add .enable_wasmtime build flag 2019-11-20 12:06:21 -06:00
Sahnvour
def5462d05 build: initial support for using vcpkg libraries 2019-11-09 12:37:38 +01:00
dimenus
8c8078513e missed cast in std/target.zig 2019-11-08 19:19:08 -05:00
Andrew Kelley
e0db54e89d
update the codebase to use @as 2019-11-08 15:57:24 -05:00
Andrew Kelley
c3d816a98e
std lib networking improvements, especially non-blocking I/O
* delete the std/event/net directory
 * `std.event.Loop.waitUntilFdReadable` and related functions
   no longer have possibility of failure. On Linux, they fall
   back to poll() and then fall back to sleep().
 * add some missing `noasync` decorations in `std.event.Loop`
 * redo the `std.net.Server` API. it's quite nice now, but
   shutdown does not work cleanly. There is a race condition with
   close() that I am actively working on.
 * move `std.io.OutStream` to its own file to match `std.io.InStream`.
   I started working on making `write` integrated with evented I/O,
   but it got tricky so I backed off and filed #3557. However
   I did integrate `std.os.writev` and `std.os.pwritev` with evented I/O.
 * add `std.Target.stack_align`
 * move networking tests to `lib/std/net/test.zig`
 * add `std.net.tcpConnectToHost` and `std.net.tcpConnectToAddress`.
 * rename `error.UnknownName` to `error.UnknownHostName` within the
   context of DNS resolution.
 * add `std.os.readv`, which is integrated with evented I/O.
 * `std.os.preadv`, is now integrated with evented I/O.
 * `std.os.accept4` now asserts that ENOTSOCK and EOPNOTSUPP never
    occur (misuse of API), instead of returning errors.
 * `std.os.connect` is now integrated with evented I/O.
   `std.os.connect_async` is gone. Just use `std.os.connect`.
 * fix false positive dependency loop regarding async function frames
 * add more compile notes to help when dependency loops occur
   in determining whether a function is async.
 * ir: change an assert to ir_assert to make it easier to find
   workarounds for when such an assert is triggered. In this case
   it was trying to parse an IPv4 address at comptime.
2019-10-29 22:59:30 -04:00
Andrew Kelley
4a57913ca0
std.target: use mem instead of std.mem 2019-10-27 14:27:20 -04:00