| author | |
| committer | |
| log | b5df5391aa46585a4b4773603c246abde1757a00 |
| tree | d7fcfd85a5a2e8228ace377d06cb2176361ce83e |
| parent | 312b231da9a90e477c56801fb2056324edc50ea1 |
| parent | 43a8e9ee80504a7dd93dc41869fb9a81c67ec625 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/3070411 files changed, 184 insertions(+), 14 deletions(-)
.forgejo/workflows/ci.yaml+21| ... | ... | @@ -78,6 +78,27 @@ jobs: |
| 78 | 78 | run: sh ci/loongarch64-linux-release.sh |
| 79 | 79 | timeout-minutes: 180 |
| 80 | 80 | |
| 81 | powerpc64le-linux-debug: | |
| 82 | runs-on: [self-hosted, powerpc64le-linux] | |
| 83 | steps: | |
| 84 | - name: Checkout | |
| 85 | uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28 | |
| 86 | with: | |
| 87 | fetch-depth: 0 | |
| 88 | - name: Build and Test | |
| 89 | run: sh ci/powerpc64le-linux-debug.sh | |
| 90 | timeout-minutes: 360 | |
| 91 | powerpc64le-linux-release: | |
| 92 | runs-on: [self-hosted, powerpc64le-linux] | |
| 93 | steps: | |
| 94 | - name: Checkout | |
| 95 | uses: https://codeberg.org/ziglang/checkout@19af6bac491e2534a4687a50ee84fa7f13258d28 | |
| 96 | with: | |
| 97 | fetch-depth: 0 | |
| 98 | - name: Build and Test | |
| 99 | run: sh ci/powerpc64le-linux-release.sh | |
| 100 | timeout-minutes: 240 | |
| 101 | ||
| 81 | 102 | riscv64-linux-debug: |
| 82 | 103 | if: github.event_name != 'pull_request' |
| 83 | 104 | runs-on: [self-hosted, riscv64-linux] |
CMakeLists.txt+5| ... | ... | @@ -787,6 +787,11 @@ else() |
| 787 | 787 | set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99 -O2") |
| 788 | 788 | set(ZIG1_COMPILE_FLAGS "-std=c99 -Os") |
| 789 | 789 | set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-sanitize=undefined -fno-stack-protector") |
| 790 | # Must match the condition in build.zig. | |
| 791 | if(ZIG_HOST_TARGET_ARCH MATCHES "^powerpc(64)?(le)?$") | |
| 792 | set(ZIG1_COMPILE_FLAGS "${ZIG1_COMPILE_FLAGS} -ffunction-sections -fdata-sections") | |
| 793 | set(ZIG2_COMPILE_FLAGS "${ZIG2_COMPILE_FLAGS} -ffunction-sections -fdata-sections") | |
| 794 | endif() | |
| 790 | 795 | if(APPLE) |
| 791 | 796 | set(ZIG2_LINK_FLAGS "-Wl,-stack_size,0x10000000") |
| 792 | 797 | elseif(MINGW) |
build.zig+7-1| ... | ... | @@ -477,7 +477,7 @@ pub fn build(b: *std.Build) !void { |
| 477 | 477 | .linux => switch (b.graph.host.result.cpu.arch) { |
| 478 | 478 | .aarch64 => 659_809_075, |
| 479 | 479 | .loongarch64 => 598_902_374, |
| 480 | .powerpc64le => 550_656_409, | |
| 480 | .powerpc64le => 627_431_833, | |
| 481 | 481 | .riscv64 => 827_043_430, |
| 482 | 482 | .s390x => 580_596_121, |
| 483 | 483 | .x86_64 => 3_290_894_745, |
| ... | ... | @@ -838,6 +838,12 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerModOptions) *std.Build.Ste |
| 838 | 838 | }); |
| 839 | 839 | exe.stack_size = stack_size; |
| 840 | 840 | |
| 841 | // Must match the condition in CMakeLists.txt. | |
| 842 | const function_data_sections = options.target.result.cpu.arch.isPowerPC(); | |
| 843 | ||
| 844 | exe.link_function_sections = function_data_sections; | |
| 845 | exe.link_data_sections = function_data_sections; | |
| 846 | ||
| 841 | 847 | return exe; |
| 842 | 848 | } |
| 843 | 849 |
ci/powerpc64le-linux-debug.sh created+66| ... | ... | @@ -0,0 +1,66 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | # Requires cmake ninja-build | |
| 4 | ||
| 5 | set -x | |
| 6 | set -e | |
| 7 | ||
| 8 | TARGET="powerpc64le-linux-musl" | |
| 9 | MCPU="baseline" | |
| 10 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1594+9fa433d71" | |
| 11 | PREFIX="$HOME/deps/$CACHE_BASENAME" | |
| 12 | ZIG="$PREFIX/bin/zig" | |
| 13 | ||
| 14 | # Override the cache directories because they won't actually help other CI runs | |
| 15 | # which will be testing alternate versions of zig, and ultimately would just | |
| 16 | # fill up space on the hard drive for no reason. | |
| 17 | export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" | |
| 18 | export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" | |
| 19 | ||
| 20 | mkdir build-debug | |
| 21 | cd build-debug | |
| 22 | ||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 25 | ||
| 26 | cmake .. \ | |
| 27 | -DCMAKE_INSTALL_PREFIX="stage3-debug" \ | |
| 28 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 29 | -DCMAKE_BUILD_TYPE=Debug \ | |
| 30 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 31 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 32 | -DZIG_STATIC=ON \ | |
| 33 | -DZIG_NO_LIB=ON \ | |
| 34 | -GNinja \ | |
| 35 | -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \ | |
| 36 | -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE | |
| 37 | # https://github.com/ziglang/zig/issues/22213 | |
| 38 | ||
| 39 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 40 | # so that installation and testing do not get affected by them. | |
| 41 | unset CC | |
| 42 | unset CXX | |
| 43 | ||
| 44 | ninja install | |
| 45 | ||
| 46 | # No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts. | |
| 47 | stage3-debug/bin/zig build test docs \ | |
| 48 | --maxrss ${ZSF_MAX_RSS:-0} \ | |
| 49 | -Dstatic-llvm \ | |
| 50 | -Dskip-non-native \ | |
| 51 | -Dtarget=native-native-musl \ | |
| 52 | -Dcpu=native+longcall \ | |
| 53 | --search-prefix "$PREFIX" \ | |
| 54 | --zig-lib-dir "$PWD/../lib" \ | |
| 55 | --test-timeout 4m | |
| 56 | ||
| 57 | stage3-debug/bin/zig build \ | |
| 58 | --prefix stage4-debug \ | |
| 59 | -Denable-llvm \ | |
| 60 | -Dno-lib \ | |
| 61 | -Dtarget=$TARGET \ | |
| 62 | -Dcpu=$MCPU \ | |
| 63 | -Duse-zig-libcxx \ | |
| 64 | -Dversion-string="$(stage3-debug/bin/zig version)" | |
| 65 | ||
| 66 | stage4-debug/bin/zig test ../test/behavior.zig |
ci/powerpc64le-linux-release.sh created+72| ... | ... | @@ -0,0 +1,72 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | # Requires cmake ninja-build | |
| 4 | ||
| 5 | set -x | |
| 6 | set -e | |
| 7 | ||
| 8 | TARGET="powerpc64le-linux-musl" | |
| 9 | MCPU="baseline" | |
| 10 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.16.0-dev.1594+9fa433d71" | |
| 11 | PREFIX="$HOME/deps/$CACHE_BASENAME" | |
| 12 | ZIG="$PREFIX/bin/zig" | |
| 13 | ||
| 14 | # Override the cache directories because they won't actually help other CI runs | |
| 15 | # which will be testing alternate versions of zig, and ultimately would just | |
| 16 | # fill up space on the hard drive for no reason. | |
| 17 | export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" | |
| 18 | export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" | |
| 19 | ||
| 20 | mkdir build-release | |
| 21 | cd build-release | |
| 22 | ||
| 23 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 24 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 25 | ||
| 26 | cmake .. \ | |
| 27 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 28 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 29 | -DCMAKE_BUILD_TYPE=Release \ | |
| 30 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 31 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 32 | -DZIG_STATIC=ON \ | |
| 33 | -DZIG_NO_LIB=ON \ | |
| 34 | -GNinja \ | |
| 35 | -DCMAKE_C_LINKER_DEPFILE_SUPPORTED=FALSE \ | |
| 36 | -DCMAKE_CXX_LINKER_DEPFILE_SUPPORTED=FALSE | |
| 37 | # https://github.com/ziglang/zig/issues/22213 | |
| 38 | ||
| 39 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 40 | # so that installation and testing do not get affected by them. | |
| 41 | unset CC | |
| 42 | unset CXX | |
| 43 | ||
| 44 | ninja install | |
| 45 | ||
| 46 | # No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts. | |
| 47 | stage3-release/bin/zig build test docs \ | |
| 48 | --maxrss ${ZSF_MAX_RSS:-0} \ | |
| 49 | -Dstatic-llvm \ | |
| 50 | -Dskip-non-native \ | |
| 51 | -Dtarget=native-native-musl \ | |
| 52 | -Dcpu=native+longcall \ | |
| 53 | --search-prefix "$PREFIX" \ | |
| 54 | --zig-lib-dir "$PWD/../lib" \ | |
| 55 | --test-timeout 4m | |
| 56 | ||
| 57 | # Ensure that stage3 and stage4 are byte-for-byte identical. | |
| 58 | stage3-release/bin/zig build \ | |
| 59 | --prefix stage4-release \ | |
| 60 | -Denable-llvm \ | |
| 61 | -Dno-lib \ | |
| 62 | -Doptimize=ReleaseFast \ | |
| 63 | -Dstrip \ | |
| 64 | -Dtarget=$TARGET \ | |
| 65 | -Dcpu=$MCPU \ | |
| 66 | -Duse-zig-libcxx \ | |
| 67 | -Dversion-string="$(stage3-release/bin/zig version)" | |
| 68 | ||
| 69 | # diff returns an error code if the files differ. | |
| 70 | echo "If the following command fails, it means nondeterminism has been" | |
| 71 | echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." | |
| 72 | diff stage3-release/bin/zig stage4-release/bin/zig |
src/Compilation.zig+4-4| ... | ... | @@ -8084,8 +8084,8 @@ fn buildOutputFromZig( |
| 8084 | 8084 | } |
| 8085 | 8085 | |
| 8086 | 8086 | pub const CrtFileOptions = struct { |
| 8087 | function_sections: ?bool = null, | |
| 8088 | data_sections: ?bool = null, | |
| 8087 | function_sections: bool = true, | |
| 8088 | data_sections: bool = true, | |
| 8089 | 8089 | omit_frame_pointer: ?bool = null, |
| 8090 | 8090 | unwind_tables: ?std.builtin.UnwindTables = null, |
| 8091 | 8091 | pic: ?bool = null, |
| ... | ... | @@ -8188,8 +8188,8 @@ pub fn build_crt_file( |
| 8188 | 8188 | .root_name = root_name, |
| 8189 | 8189 | .libc_installation = comp.libc_installation, |
| 8190 | 8190 | .emit_bin = .yes_cache, |
| 8191 | .function_sections = options.function_sections orelse false, | |
| 8192 | .data_sections = options.data_sections orelse false, | |
| 8191 | .function_sections = options.function_sections, | |
| 8192 | .data_sections = options.data_sections, | |
| 8193 | 8193 | .c_source_files = c_source_files, |
| 8194 | 8194 | .verbose_cc = comp.verbose_cc, |
| 8195 | 8195 | .verbose_link = comp.verbose_link, |
src/libs/libcxx.zig+4| ... | ... | @@ -265,6 +265,8 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 265 | 265 | .root_name = root_name, |
| 266 | 266 | .libc_installation = comp.libc_installation, |
| 267 | 267 | .emit_bin = .yes_cache, |
| 268 | .function_sections = true, | |
| 269 | .data_sections = true, | |
| 268 | 270 | .c_source_files = c_source_files.items, |
| 269 | 271 | .verbose_cc = comp.verbose_cc, |
| 270 | 272 | .verbose_link = comp.verbose_link, |
| ... | ... | @@ -459,6 +461,8 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 459 | 461 | .root_name = root_name, |
| 460 | 462 | .libc_installation = comp.libc_installation, |
| 461 | 463 | .emit_bin = .yes_cache, |
| 464 | .function_sections = true, | |
| 465 | .data_sections = true, | |
| 462 | 466 | .c_source_files = c_source_files.items, |
| 463 | 467 | .verbose_cc = comp.verbose_cc, |
| 464 | 468 | .verbose_link = comp.verbose_link, |
src/libs/libtsan.zig+2| ... | ... | @@ -288,6 +288,8 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo |
| 288 | 288 | .root_name = root_name, |
| 289 | 289 | .libc_installation = comp.libc_installation, |
| 290 | 290 | .emit_bin = .yes_cache, |
| 291 | .function_sections = true, | |
| 292 | .data_sections = true, | |
| 291 | 293 | .c_source_files = c_source_files.items, |
| 292 | 294 | .verbose_cc = comp.verbose_cc, |
| 293 | 295 | .verbose_link = comp.verbose_link, |
src/libs/libunwind.zig+2-1| ... | ... | @@ -155,7 +155,8 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 155 | 155 | .main_mod = null, |
| 156 | 156 | .libc_installation = comp.libc_installation, |
| 157 | 157 | .emit_bin = .yes_cache, |
| 158 | .function_sections = comp.function_sections, | |
| 158 | .function_sections = true, | |
| 159 | .data_sections = true, | |
| 159 | 160 | .c_source_files = &c_source_files, |
| 160 | 161 | .verbose_cc = comp.verbose_cc, |
| 161 | 162 | .verbose_link = comp.verbose_link, |
src/libs/mingw.zig+1| ... | ... | @@ -56,6 +56,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 56 | 56 | }, |
| 57 | 57 | }; |
| 58 | 58 | return comp.build_crt_file("crt2", .Obj, .@"mingw-w64 crt2.o", prog_node, &files, .{ |
| 59 | .function_sections = false, // https://codeberg.org/ziglang/zig/issues/30702 | |
| 59 | 60 | .unwind_tables = unwind_tables, |
| 60 | 61 | }); |
| 61 | 62 | }, |
src/libs/musl.zig-8| ... | ... | @@ -43,8 +43,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 43 | 43 | }, |
| 44 | 44 | }; |
| 45 | 45 | return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &files, .{ |
| 46 | .function_sections = true, | |
| 47 | .data_sections = true, | |
| 48 | 46 | .omit_frame_pointer = true, |
| 49 | 47 | .no_builtin = true, |
| 50 | 48 | }); |
| ... | ... | @@ -63,8 +61,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 63 | 61 | }, |
| 64 | 62 | }; |
| 65 | 63 | return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &files, .{ |
| 66 | .function_sections = true, | |
| 67 | .data_sections = true, | |
| 68 | 64 | .omit_frame_pointer = true, |
| 69 | 65 | .pic = true, |
| 70 | 66 | .no_builtin = true, |
| ... | ... | @@ -84,8 +80,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 84 | 80 | }, |
| 85 | 81 | }; |
| 86 | 82 | return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &files, .{ |
| 87 | .function_sections = true, | |
| 88 | .data_sections = true, | |
| 89 | 83 | .omit_frame_pointer = true, |
| 90 | 84 | .pic = true, |
| 91 | 85 | .no_builtin = true, |
| ... | ... | @@ -172,8 +166,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro |
| 172 | 166 | }; |
| 173 | 167 | } |
| 174 | 168 | return comp.build_crt_file("c", .Lib, .@"musl libc.a", prog_node, c_source_files.items, .{ |
| 175 | .function_sections = true, | |
| 176 | .data_sections = true, | |
| 177 | 169 | .omit_frame_pointer = true, |
| 178 | 170 | .no_builtin = true, |
| 179 | 171 | }); |