Commit Graph

1061 Commits

Author SHA1 Message Date
LemonBoy
5822220435 Address review comments 2020-02-29 14:19:13 +01:00
LemonBoy
f072b0c056 target: Implement OS version detection for Windows
Closes #4581
2020-02-29 12:02:40 +01:00
Andrew Kelley
7e6b68a534
std.Target.standardDynamicLinkerPath: delete bad doc comment 2020-02-29 02:08:26 -05:00
Andrew Kelley
1aef0bef75
std.Target.Os.WindowsVersion: non-exhaustive enum 2020-02-28 19:24:52 -05:00
Andrew Kelley
e683eee415
fix CrossTarget.isNative, setGnuLibCVersion, zigTriple 2020-02-28 19:18:27 -05:00
Andrew Kelley
4bc893c346
update test to newer API 2020-02-28 19:05:14 -05:00
Andrew Kelley
7e3bb00a0e
don't choose native ld path when os is non native 2020-02-28 18:48:19 -05:00
Andrew Kelley
4591236ae1
CrossTarget.cpu_model: communicate intent precisely 2020-02-28 18:31:46 -05:00
Andrew Kelley
aa13f339d4
fix handling of CrossTarget.cpu_model 2020-02-28 18:09:33 -05:00
Andrew Kelley
8691d3c50d
improve std.zig.system.NativeTargetInfo.detect
It now takes a std.zig.CrossTarget parameter, and only resolves
native things, leaving explicitly overridden things alone.
2020-02-28 17:23:16 -05:00
Andrew Kelley
500dde32d5
dynamic_linker becomes a field of std.zig.CrossTarget 2020-02-28 14:51:56 -05:00
Andrew Kelley
07f52119de
implement native OS version detection for linux 2020-02-28 14:51:56 -05:00
Andrew Kelley
ef24f2dd93
remove special darwin os version min handling
now it is integrated with zig's target OS range.
2020-02-28 14:51:56 -05:00
Andrew Kelley
d45ea4d89d
stage1: make get_native_target go through self-hosted 2020-02-28 14:51:56 -05:00
Andrew Kelley
3683ba87ac
complete the native target detection based on /usr/bin/env 2020-02-28 14:51:56 -05:00
Andrew Kelley
fd006c1c74
std.zig.system.NativeTargetInfo.detect: almost no Allocator 2020-02-28 14:51:55 -05:00
Andrew Kelley
60f2f3457d
getStandardDynamicLinkerPath renamed and no allocator
* `std.Target.getStandardDynamicLinkerPath` =>
   `std.Target.standardDynamicLinkerPath`
 * it now takes a pointer to fixed size array rather than an allocator
 * `std.zig.system.NativeTargetInfo.detect` now supports reading
   PT_INTERP from /usr/bin/env
2020-02-28 14:51:55 -05:00
Andrew Kelley
2536e4c70c
WASI has no dynamic linker 2020-02-28 14:51:55 -05:00
Andrew Kelley
bafa895561
compiler-rt: inline at call site to workaround a bug
The bug is #2154
2020-02-28 14:51:55 -05:00
Andrew Kelley
36aa3c8e7f
fix __stack_chk_guard emitted even when not linking libc 2020-02-28 14:51:55 -05:00
Andrew Kelley
6226726571
fix builder.findProgram test 2020-02-28 14:51:55 -05:00
Andrew Kelley
7927764cc2
mips: implement Target.getStandardDynamicLinkerPath 2020-02-28 14:51:54 -05:00
Andrew Kelley
34d2700af4
clean up CrossTarget.getExternalExecutor 2020-02-28 14:51:54 -05:00
Andrew Kelley
0912484c4f
improve the "external executor" detection logic 2020-02-28 14:51:54 -05:00
Andrew Kelley
cebcacd872
fix standardTargetOptions and improve init-exe to use it 2020-02-28 14:51:54 -05:00
Andrew Kelley
cf233bad58
fix target parsing 2020-02-28 14:51:54 -05:00
Andrew Kelley
dbe4d72bcf
separate std.Target and std.zig.CrossTarget
Zig now supports a more fine-grained sense of what is native and what is
not. Some examples:

This is now allowed:
-target native

Different OS but native CPU, default Windows C ABI:
-target native-windows
This could be useful for example when running in Wine.

Different CPU but native OS, native C ABI.
-target x86_64-native -mcpu=skylake

Different C ABI but otherwise native target:
-target native-native-musl
-target native-native-gnu

Lots of breaking changes to related std lib APIs.
Calls to getOs() will need to be changed to getOsTag().
Calls to getArch() will need to be changed to getCpuArch().

Usage of Target.Cross and Target.Native need to be updated to use
CrossTarget API.

`std.build.Builder.standardTargetOptions` is changed to accept its
parameters as a struct with default values. It now has the ability to
specify a whitelist of targets allowed, as well as the default target.
Rather than two different ways of collecting the target, it's now always
a string that is validated, and prints helpful diagnostics for invalid
targets. This feature should now be actually useful, and contributions
welcome to further improve the user experience.

`std.build.LibExeObjStep.setTheTarget` is removed.
`std.build.LibExeObjStep.setTarget` is updated to take a CrossTarget
parameter.

`std.build.LibExeObjStep.setTargetGLibC` is removed. glibc versions are
handled in the CrossTarget API and can be specified with the `-target`
triple.

`std.builtin.Version` gains a `format` method.
2020-02-28 14:51:54 -05:00
Andrew Kelley
87b9e744dd
update std lib to new Target API 2020-02-28 14:51:54 -05:00
Andrew Kelley
4616af0ca4
introduce operating system version ranges as part of the target
* re-introduce `std.build.Target` which is distinct from `std.Target`.
   `std.build.Target` wraps `std.Target` so that it can be annotated as
   "the native target" or an explicitly specified target.
 * `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a
   struct which has the tag as well as version range information.
 * `std.elf` gains some more ELF header constants.
 * `std.Target.parse` gains the ability to parse operating system
   version ranges as well as glibc version.
 * Added `std.Target.isGnuLibC()`.
 * self-hosted dynamic linker detection and glibc version detection.
   This also adds the improved logic using `/usr/bin/env` rather than
   invoking the system C compiler to find the dynamic linker when zig
   is statically linked. Related: #2084
   Note: this `/usr/bin/env` code is work-in-progress.
 * `-target-glibc` CLI option is removed in favor of the new `-target`
   syntax. Example: `-target x86_64-linux-gnu.2.27`

closes #1907
2020-02-28 14:51:53 -05:00
Andrew Kelley
fba39ff331
restructuring std.Target for OS version ranges, pass 1 2020-02-28 14:51:50 -05:00
LemonBoy
6a0927d8c1 debug: Fix end-of-stream condition in DWARF parser 2020-02-26 21:02:54 -05:00
Andrew Kelley
0a88352689
fix behavior tests with --test-evented-io 2020-02-26 13:17:38 -05:00
Andrew Kelley
2b33e27e1c
arm baseline CPU is v7a rather than v6m
v6m is thumb-mode and the baseline should probably be an 'a' variant.
2020-02-26 12:37:13 -05:00
Vexu
22432b15e3
add test for @intToEnum 2020-02-26 11:19:40 -05:00
Andrew Kelley
aa2aad229c
Merge pull request #4497 from LemonBoy/do-do-do
The great stack-trace race (Part 1 of N)
2020-02-26 11:10:38 -05:00
Andrew Kelley
7cfe854359
clean up std.Buffer.print 2020-02-24 22:34:06 -05:00
vegecode
6fa143355f
Add formatted printing directly into std.Buffer 2020-02-24 22:30:23 -05:00
Andrew Kelley
5503f3f7c4
Merge pull request #4544 from BarabasGitHub/zeroes-for-non-extern-types
implement zeroes for non extern structs and native types
2020-02-24 22:01:56 -05:00
Andrew Kelley
61a50a23e8
Merge pull request #4547 from Vexu/deprecate
Remove deprecated builtins
2020-02-24 21:57:29 -05:00
Andrew Kelley
544bc42fd9
expose --verbose-llvm-cpu-features to zig build 2020-02-24 20:11:33 -05:00
Vexu
538d9a5dd8
remove uses of @ArgType and @IntType 2020-02-24 23:39:03 +02:00
Bas van den Berg
f7aa4f5280 Processed review comments. Updated documentation, used the typinfo for field access, generate compile error on allowzero and set C poitners to null 2020-02-24 22:15:04 +01:00
Vexu
45da72c5b6
remove usages of @typeId, @memberCount, @memberName and @memberType 2020-02-24 23:09:01 +02:00
Bas van den Berg
195195d238 vectors do not support iterating, do not support them (for now) 2020-02-24 20:50:51 +01:00
Bas van den Berg
0972b2a8fe implement zeroes for non extern structs and native types 2020-02-24 20:38:33 +01:00
Andrew Kelley
1d06c82c3b
Merge pull request #4516 from xackus/remove-bytes-to-slice
remove @bytesToSlice, @sliceToBytes from the language
2020-02-24 13:51:47 -05:00
J.W
5275b01202 hashing algorithms: fix logic and index out of bounds 2020-02-24 13:43:54 -05:00
Heide Onas Auri
907c5589ae
std.time.Timer.lap: only read system time once (#4533)
Calling Timer.lap queried the system time twice; once to compute the lap
time and once to reset the timer. This can lead to time discrepancies
between actual and computed durations when summing the result of
Timer.lap in a loop. This commit fixes that.

also fix Timer.read to not require a pointer
2020-02-23 18:25:52 -05:00
LemonBoy
08047cd6d7 correct test expectations 2020-02-23 22:47:48 +01:00
xackus
7664c3bc11 remove @bytesToSlice, @sliceToBytes from tests, docs 2020-02-23 18:03:50 +01:00