From ebfddbaf0038c62f9560a8bf7134b401fb0e4d19 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 16 Apr 2022 03:41:33 -0700 Subject: [PATCH 1/2] CI: additionally test building stage3 --- ci/zinc/linux_test.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/zinc/linux_test.sh b/ci/zinc/linux_test.sh index 739d85cff0..b0f65aefd3 100755 --- a/ci/zinc/linux_test.sh +++ b/ci/zinc/linux_test.sh @@ -48,7 +48,10 @@ cd $WORKSPACE $ZIG fmt --check . --exclude test/compile_errors/ # Build stage2 standalone so that we can test stage2 against stage2 compiler-rt. -$ZIG build -p stage2 -Denable-llvm -Duse-zig-libcxx +$ZIG build -p stage2 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL" + +# Ensure that stage2 can build itself. +./stage2/bin/zig build -p stage3 -Dstatic-llvm -Dtarget=native-native-musl --search-prefix "$DEPS_LOCAL" stage2/bin/zig test test/behavior.zig -I test -fLLVM stage2/bin/zig test test/behavior.zig -I test -fno-LLVM @@ -95,8 +98,7 @@ tidy --drop-empty-elements no -qe zig-cache/langref.html $ZIG build \ --prefix "$RELEASE_STAGING" \ --search-prefix "$DEPS_LOCAL" \ - -Denable-llvm \ - -Duse-zig-libcxx \ + -Dstatic-llvm \ -Drelease \ -Dstrip \ -Dtarget="$TARGET" \ From ffaa045429c946eaafc199e82b8831cb1e2f637d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 21 Apr 2022 11:17:26 -0700 Subject: [PATCH 2/2] stage2: add zig_backend to the cache hash This makes stage2 and stage3 have different cache namespaces, so that building something with stage3 does not try to reuse the same cached artifacts as were produced by stage2. This makes sense since the code of stage3 is produced by the self-hosted compiler, whereas the code of stage2 is produced by the bootstrap compiler. Note also that stage4 and stage3 will share the same zig_backend, end hence cache namespace. Ideally stage4 and stage3 are identical binaries, so this checks out. --- src/Compilation.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Compilation.zig b/src/Compilation.zig index 6019fc0856..bfe52cd59e 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1224,6 +1224,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { // This is shared hasher state common to zig source and all C source files. cache.hash.addBytes(build_options.version); + cache.hash.add(builtin.zig_backend); cache.hash.addBytes(options.zig_lib_directory.path orelse "."); cache.hash.add(options.optimize_mode); cache.hash.add(options.target.cpu.arch);