Commit Graph

7977 Commits

Author SHA1 Message Date
Andrew Kelley
2246812184
use an explicit error set to fix a compilation error
this function has conditionally compiled out code in it about looking
for native glibc.
2020-02-29 22:20:44 -05:00
Andrew Kelley
6fcf6716be
std.Thread.cpuCount on Windows uses the PEB
rather than calling GetSystemInfo from kernel32.dll. Also remove
OutOfMemory from the error set.
2020-02-29 22:13:09 -05:00
Andrew Kelley
d951e0402a
Merge pull request #4586 from daurnimator/windows-PEB
Fill out windows PEB definition
2020-02-29 22:05:56 -05:00
Andrew Kelley
48cef8d5be
refactor std.zig.system.NativeTargetInfo functions
to make them a bit easier to test.
2020-02-29 21:31:03 -05:00
Andrew Kelley
c903b76010
Merge pull request #4589 from LemonBoy/fix-4583
target: Implement OS version detection for OSX
2020-02-29 20:39:29 -05:00
LemonBoy
845af5c552 Handle one more error 2020-02-29 23:11:36 +01:00
LemonBoy
3b29a72b3b Use .len instead of @sizeOf 2020-02-29 23:08:57 +01:00
LemonBoy
84549b3955 target: Implement OS version detection for OSX
Closes #4583
2020-02-29 21:46:07 +01:00
Andrew Kelley
3c7f030a60
add CrossTarget.getObjectFormat
closes #4588

thanks Michaël Larouche for the suggested fix
2020-02-29 12:27:13 -05:00
daurnimator
d0c22619f5
Complete windows PEB_LDR_DATA definition 2020-03-01 02:10:29 +11:00
daurnimator
513076ee9c
Fill out PEB definition 2020-03-01 00:12:08 +11:00
Andrew Kelley
7e6b68a534
std.Target.standardDynamicLinkerPath: delete bad doc comment 2020-02-29 02:08:26 -05:00
Andrew Kelley
7617610400
Merge pull request #4550 from ziglang/os-version-ranges
introduce operating system version ranges as part of the target; self-host native dynamic linker detection and native glibc version detection
2020-02-29 01:57:06 -05:00
Alexandros Naskos
1b41f2d77e
C pointer slices are no longer allowzero (#4462)
* Slices from C pointers are no longer allowzero but instead insert a runtime assertion.

* Added a test, fixed code for cases with non-allowzero C pointers

* Create new type when flipping allow_zero, sometimes we get a cached value back from adjust_ptr_len.

* Added comments, changed panic message

* Added runtime safety test.
2020-02-29 01:36:42 -05:00
Andrew Kelley
3cba603eae
fix crash when building docgen 2020-02-29 01:05:11 -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
a5a53a182a
fix typo from other commit
d2535c003c
2020-02-28 16:06:06 -05:00
Andrew Kelley
bee4007ec9
fix crash with multiple comptime fn calls and...
...default initialized array to undefined

closes #4578
2020-02-28 15:49:19 -05:00
Andrew Kelley
578dc16910
fix compiler crash when comptime parsing targets 2020-02-28 15:41:30 -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
662b5f7c60
update docs to latest Target API 2020-02-28 14:51:55 -05:00
Andrew Kelley
f89a1844bf
don't error out for targets with unknown standard dynamic linker path 2020-02-28 14:51:55 -05:00
Andrew Kelley
70bf8874d7
update docgen to new Target API 2020-02-28 14:51:55 -05:00
Andrew Kelley
3c3316d4ba
update tests to new Target API 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
2387f48d5c
fix incorrect builtin import code for windows 2020-02-28 14:51:54 -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
622b5b62c2
fix not setting the dynamic linker path when cross compiling 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
c8669a4cf8
improve debug info for optionals 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