Commit Graph

7977 Commits

Author SHA1 Message Date
Andrew Kelley
884d150408
stage1 main: fix cli parsing of architecture 2020-02-19 22:09:05 -05:00
Andrew Kelley
c33cd370fc
fix unit test for Target.parse
I think this is working correctly. Without also removing sse2 from the
feature set, sse gets added back into the set because sse2 is part of
the x86_64 baseline (which is the cpu provided) and sse2 depends on sse.
2020-02-19 21:55:25 -05:00
Andrew Kelley
ef2d237f2f
this is not the proper way to support this feature 2020-02-19 21:51:24 -05:00
Andrew Kelley
84f1893c18
remove the concept of "sub-architecture"
in favor of CPU features. Also rearrange the `std.Target`
data structure.

 * note: `@import("builtin")` was already deprecated in favor of
   `@import("std").builtin`.
 * `std.builtin.arch` is now deprecated in favor of
   `std.builtin.cpu.arch`.
 * `std.Target.CpuFeatures.Cpu` is now `std.Target.Cpu.Model`.
 * `std.Target.CpuFeatures` is now `std.Target.Cpu`.
 * `std.Target` no longer has an `arch` field. Instead it has a
   `cpu` field, which has `arch`, `model`, and `features`.
 * `std.Target` no longer has a `cpu_features` field.
 * `std.Target.Arch` is moved to `std.Target.Cpu.Arch` and
   it is an enum instead of a tagged union.
 * `std.Target.parseOs` is moved to `std.Target.Os.parse`.
 * `std.Target.parseAbi` is moved to `std.Target.Abi.parse`.
 * `std.Target.parseArchSub` is only for arch now and moved
    to `std.Target.Cpu.Arch.parse`.
 * `std.Target.parse` is improved to accept CPU name and features.
 * `std.Target.Arch.getBaselineCpuFeatures` is moved to
   `std.Target.Cpu.baseline`.
 * `std.Target.allCpus` is renamed to `std.Target.allCpuModels`.
 * `std.Target.defaultAbi` is moved to `std.Target.Abi.default`.
 * Significant cleanup of aarch64 and arm CPU features, resulting in
   the needed bit count for cpu feature set going from 174 to 138.
 * Add `std.Target.Cpu.Feature.Set.addFeatureSet` for merging
   feature sets together.

`-target-feature` and `-target-cpu` are removed in favor of
`-mcpu`, to conform to established conventions, and it gains
additional power to support cpu features. The syntax is:
-mcpu=name+on1+on2-off1-off2

closes #4261
2020-02-19 21:30:36 -05:00
Andrew Kelley
96f45c27b6
arm: clean up the messy sub-architecture & CPU features 2020-02-19 19:11:20 -05:00
Andrew Kelley
4c6f207aff
clean up arm CPU features
* remove "cpu features" that are actually just processors
 * rename `v8` to `v8a`. this matches the corresponding
   change to target/aarch64.zig
 * rename types in preparation for removing sub-architecture
   from `std.Target`.

I have other files changed in my dirty working tree, but about to make
some changes to arm.zig that I don't want batched with this commit.
2020-02-19 18:12:06 -05:00
Bas
1483ae37f2
Add an appendValues method to ArrayList to append a value n times. (#4460) 2020-02-19 11:33:35 -05:00
daurnimator
e270db956c
std: tagged unions are broken on arm64 2020-02-19 23:17:04 +11:00
daurnimator
d989396a34
std: add json.parse to automatically decode json into a struct 2020-02-19 23:16:35 +11:00
daurnimator
5a20604820
std: add json.stringify to encode arbitrary values to JSON 2020-02-19 23:01:12 +11:00
Andrew Kelley
c664692bdd
make the CLI support depending on system headers and libraries
(include and lib search paths)

The detection of native system paths is self-hosted.

closes #2041
2020-02-19 01:24:34 -05:00
Andrew Kelley
63383a8af8
consistent capitalization of error message 2020-02-19 01:24:19 -05:00
Andrew Kelley
c5ca0fe237
Merge branch 'pixelherodev-emit'
Closes #4418
2020-02-18 22:01:08 -05:00
Andrew Kelley
d7968c6d33
improvements which allow zig to emit multiple things at once
example: zig build-obj test.zig -femit-llvm-ir -femit-asm

this will generate all three: test.o test.s test.ll
2020-02-18 21:59:43 -05:00
Noam Preil
dba12cd693
Rename produce_* bools to emit_* to match CLI 2020-02-18 18:59:45 -05:00
Noam Preil
9c98c73e73
Disable binary generation when deprecated --emit is used 2020-02-18 18:59:45 -05:00
Noam Preil
2502cb242a
Improve support for generating LLVM IR/asm files 2020-02-18 18:59:45 -05:00
Andrew Kelley
cbc4e59e68
Merge branch 'LemonBoy-c8c8c8c8'
closes #4502
2020-02-18 18:45:25 -05:00
Andrew Kelley
30194f27fb
update new test case to take into account lazy @typeInfo 2020-02-18 18:27:18 -05:00
LemonBoy
eb5e6259aa
docs: Fix wrong extern fn definition 2020-02-18 18:18:29 -05:00
LemonBoy
a6b74cdd38
stage1: Make the parser reject extern fn with body 2020-02-18 18:18:29 -05:00
LemonBoy
95a71e29f8
zig fmt: Fix callconv rewriting for extern + string
Closes #4473
2020-02-18 18:18:15 -05:00
Andrew Kelley
ccca4b5a5e
Merge pull request #4474 from LemonBoy/saukerkraut
Patches
2020-02-18 18:15:11 -05:00
Andrew Kelley
7f92d0d4a4
Merge branch 'daurnimator-use-fifo-from-stdio'
closes #3763
2020-02-18 16:48:58 -05:00
Andrew Kelley
a8d7652001
avoid a @ptrCast with an array literal 2020-02-18 16:48:26 -05:00
daurnimator
3632f31ec2
std: use LinearFifo to implement io.BufferedOutStreamCustom 2020-02-18 16:47:03 -05:00
daurnimator
dd75cc214d
std: let PeekStream have static/dynamic variants
This completes a TODO in the existing implementation
2020-02-18 16:47:03 -05:00
daurnimator
38ad7daebb
std: use LinearFifo to implement io.PeekStream 2020-02-18 16:47:03 -05:00
daurnimator
bdff2f43bd
std: use LinearFifo to implement io.BufferedInStreamCustom 2020-02-18 16:47:03 -05:00
Andrew Kelley
662996e4a8
Merge branch 'FireFox317-lazy-typeinfo-decls'
Closes #4435
Closes #3893
Closes #2584
2020-02-18 15:34:22 -05:00
Andrew Kelley
d056c7732b
fix std.meta.refAllDecls 2020-02-18 15:34:13 -05:00
Andrew Kelley
dd58278dbe
add behavior test for previous commit 2020-02-18 15:28:14 -05:00
Timon Kruiper
7560fc716d
Makes the declaration slice resolve lazely when using @typeInfo
This way all the declarations in a container won't be resolved untill
the user actually uses the decls slice in the builtin TypeInfo union.
2020-02-18 15:26:37 -05:00
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