| author | |
| committer | |
| log | f8b38a174f0c4a843688fe8adac09dc4f66cd585 |
| tree | 646d6157394480effbc44ef71717636a1511df71 |
| parent | 569182dbb259b2b5cfb457e798407d8ec2eacc2d |
The idea here is that the zig2 executable is perhaps the more useful
deliverable until we implement our own optimization passes. This will
allow system packages to provide Zig, and use it to compile Zig
projects, all without LLVM!4 files changed, 13 insertions(+), 20 deletions(-)
README.md+9-7| ... | @@ -70,14 +70,13 @@ In this case, the only system dependency is a C compiler. | ... | @@ -70,14 +70,13 @@ In this case, the only system dependency is a C compiler. |
| 70 | 70 | ||
| 71 | ``` | 71 | ``` |
| 72 | cc -o bootstrap bootstrap.c | 72 | cc -o bootstrap bootstrap.c |
| 73 | ./bootstrap build | 73 | ./bootstrap |
| 74 | ``` | 74 | ``` |
| 75 | 75 | ||
| 76 | You can pass any options to this that you would pass to `zig build` (see | 76 | This produces a `zig2` executable in the current working directory. This is a |
| 77 | `--help` for options). | 77 | "stage2" build of the compiler, |
| 78 | 78 | [without LLVM extensions](https://github.com/ziglang/zig/issues/16270), and is | |
| 79 | [Without LLVM extensions](https://github.com/ziglang/zig/issues/16270), a Zig | 79 | therefore lacking these features: |
| 80 | compiler is missing these features: | ||
| 81 | - Release mode optimizations | 80 | - Release mode optimizations |
| 82 | - aarch64 machine code backend | 81 | - aarch64 machine code backend |
| 83 | - `@cImport` / `zig translate-c` | 82 | - `@cImport` / `zig translate-c` |
| ... | @@ -86,7 +85,6 @@ compiler is missing these features: | ... | @@ -86,7 +85,6 @@ compiler is missing these features: |
| 86 | - [Some ELF linking features](https://github.com/ziglang/zig/issues/17749) | 85 | - [Some ELF linking features](https://github.com/ziglang/zig/issues/17749) |
| 87 | - [Most COFF/PE linking features](https://github.com/ziglang/zig/issues/17751) | 86 | - [Most COFF/PE linking features](https://github.com/ziglang/zig/issues/17751) |
| 88 | - [Some WebAssembly linking features](https://github.com/ziglang/zig/issues/17750) | 87 | - [Some WebAssembly linking features](https://github.com/ziglang/zig/issues/17750) |
| 89 | - [COFF linking](https://github.com/ziglang/zig/issues/17751) | ||
| 90 | - [Ability to output LLVM bitcode](https://github.com/ziglang/zig/issues/13265) | 88 | - [Ability to output LLVM bitcode](https://github.com/ziglang/zig/issues/13265) |
| 91 | - [Windows resource file compilation](https://github.com/ziglang/zig/issues/17752) | 89 | - [Windows resource file compilation](https://github.com/ziglang/zig/issues/17752) |
| 92 | - [Ability to create import libs from def files](https://github.com/ziglang/zig/issues/17807) | 90 | - [Ability to create import libs from def files](https://github.com/ziglang/zig/issues/17807) |
| ... | @@ -94,6 +92,10 @@ compiler is missing these features: | ... | @@ -94,6 +92,10 @@ compiler is missing these features: |
| 94 | - [Ability to create static archives from object files](https://github.com/ziglang/zig/issues/9828) | 92 | - [Ability to create static archives from object files](https://github.com/ziglang/zig/issues/9828) |
| 95 | - Ability to compile C++, Objective-C, and Objective-C++ files | 93 | - Ability to compile C++, Objective-C, and Objective-C++ files |
| 96 | 94 | ||
| 95 | However, a compiler built this way does provide a C backend, which may be | ||
| 96 | useful for creating system packages of Zig projects using the system C | ||
| 97 | toolchain. In such case, LLVM is not needed! | ||
| 98 | |||
| 97 | ## Contributing | 99 | ## Contributing |
| 98 | 100 | ||
| 99 | [Donate monthly](https://ziglang.org/zsf/). | 101 | [Donate monthly](https://ziglang.org/zsf/). |
bootstrap.c-11| ... | @@ -42,11 +42,6 @@ static void run(char **argv) { | ... | @@ -42,11 +42,6 @@ static void run(char **argv) { |
| 42 | if (WEXITSTATUS(status) != 0) | 42 | if (WEXITSTATUS(status) != 0) |
| 43 | panic("child process failed"); | 43 | panic("child process failed"); |
| 44 | } | 44 | } |
| 45 | |||
| 46 | static void run_execv(char **argv) { | ||
| 47 | if (execv(argv[0], argv) == -1 && errno == ENOENT) return; | ||
| 48 | perror("execv failed"); | ||
| 49 | } | ||
| 50 | #endif | 45 | #endif |
| 51 | 46 | ||
| 52 | static void print_and_run(const char **argv) { | 47 | static void print_and_run(const char **argv) { |
| ... | @@ -87,9 +82,6 @@ static const char *get_host_triple(void) { | ... | @@ -87,9 +82,6 @@ static const char *get_host_triple(void) { |
| 87 | } | 82 | } |
| 88 | 83 | ||
| 89 | int main(int argc, char **argv) { | 84 | int main(int argc, char **argv) { |
| 90 | argv[0] = "./zig2"; | ||
| 91 | run_execv(argv); | ||
| 92 | |||
| 93 | const char *cc = get_c_compiler(); | 85 | const char *cc = get_c_compiler(); |
| 94 | const char *host_triple = get_host_triple(); | 86 | const char *host_triple = get_host_triple(); |
| 95 | 87 | ||
| ... | @@ -188,7 +180,4 @@ int main(int argc, char **argv) { | ... | @@ -188,7 +180,4 @@ int main(int argc, char **argv) { |
| 188 | }; | 180 | }; |
| 189 | print_and_run(child_argv); | 181 | print_and_run(child_argv); |
| 190 | } | 182 | } |
| 191 | |||
| 192 | run_execv(argv); | ||
| 193 | panic("build script failed to create valid zig2 executable"); | ||
| 194 | } | 183 | } |
ci/x86_64-linux-debug.sh+2-1| ... | @@ -24,7 +24,8 @@ git fetch --tags | ... | @@ -24,7 +24,8 @@ git fetch --tags |
| 24 | git clean -fd | 24 | git clean -fd |
| 25 | rm -rf zig-out | 25 | rm -rf zig-out |
| 26 | cc -o bootstrap bootstrap.c | 26 | cc -o bootstrap bootstrap.c |
| 27 | ./bootstrap build -Dno-lib | 27 | ./bootstrap |
| 28 | ./zig2 build -Dno-lib | ||
| 28 | # In order to run these behavior tests we need to move the `@cImport` ones to somewhere else. | 29 | # In order to run these behavior tests we need to move the `@cImport` ones to somewhere else. |
| 29 | # ./zig-out/bin/zig test test/behavior.zig | 30 | # ./zig-out/bin/zig test test/behavior.zig |
| 30 | 31 |
ci/x86_64-linux-release.sh+2-1| ... | @@ -24,7 +24,8 @@ git fetch --tags | ... | @@ -24,7 +24,8 @@ git fetch --tags |
| 24 | git clean -fd | 24 | git clean -fd |
| 25 | rm -rf zig-out | 25 | rm -rf zig-out |
| 26 | cc -o bootstrap bootstrap.c | 26 | cc -o bootstrap bootstrap.c |
| 27 | ./bootstrap build -Dno-lib | 27 | ./bootstrap |
| 28 | ./zig2 build -Dno-lib | ||
| 28 | # In order to run these behavior tests we need to move the `@cImport` ones to somewhere else. | 29 | # In order to run these behavior tests we need to move the `@cImport` ones to somewhere else. |
| 29 | # ./zig-out/bin/zig test test/behavior.zig | 30 | # ./zig-out/bin/zig test test/behavior.zig |
| 30 | 31 |