diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4700a183e6..f4e244ecf1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,8 +3,7 @@ on: pull_request: push: branches: - - master - - llvm19 + - 0.14.x concurrency: # Cancels pending runs when a PR gets updated. group: ${{ github.head_ref || github.run_id }}-${{ github.actor }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 700b724b00..db0febee72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ project(zig set(ZIG_VERSION_MAJOR 0) set(ZIG_VERSION_MINOR 14) -set(ZIG_VERSION_PATCH 0) +set(ZIG_VERSION_PATCH 1) set(ZIG_VERSION "" CACHE STRING "Override Zig version string. Default is to find out with git.") if("${ZIG_VERSION}" STREQUAL "") @@ -90,6 +90,7 @@ set(ZIG_STATIC_LLVM ${ZIG_STATIC} CACHE BOOL "Prefer linking against static LLVM set(ZIG_STATIC_ZLIB ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zlib") set(ZIG_STATIC_ZSTD ${ZIG_STATIC} CACHE BOOL "Prefer linking against static zstd") set(ZIG_STATIC_CURSES OFF CACHE BOOL "Enable static linking against curses") +set(ZIG_STATIC_LIBXML2 OFF CACHE BOOL "Enable static linking against libxml2") if (ZIG_SHARED_LLVM AND ZIG_STATIC_LLVM) message(SEND_ERROR "-DZIG_SHARED_LLVM and -DZIG_STATIC_LLVM cannot both be enabled simultaneously") @@ -167,6 +168,12 @@ if(ZIG_STATIC_CURSES) list(APPEND LLVM_LIBRARIES "${CURSES}") endif() +if(ZIG_STATIC_LIBXML2) + list(REMOVE_ITEM LLVM_LIBRARIES "-lxml2") + find_library(LIBXML2 NAMES libxml2.a NAMES_PER_DIR) + list(APPEND LLVM_LIBRARIES "${LIBXML2}") +endif() + find_package(Threads) set(ZIG_CONFIG_H_OUT "${PROJECT_BINARY_DIR}/config.h") diff --git a/build.zig b/build.zig index 2d196041b3..8967906d7b 100644 --- a/build.zig +++ b/build.zig @@ -11,7 +11,7 @@ const assert = std.debug.assert; const DevEnv = @import("src/dev.zig").Env; const ValueInterpretMode = enum { direct, by_name }; -const zig_version: std.SemanticVersion = .{ .major = 0, .minor = 14, .patch = 0 }; +const zig_version: std.SemanticVersion = .{ .major = 0, .minor = 14, .patch = 1 }; const stack_size = 46 * 1024 * 1024; pub fn build(b: *std.Build) !void { @@ -214,11 +214,6 @@ pub fn build(b: *std.Build) !void { test_step.dependOn(&exe.step); - if (target.result.os.tag == .windows and target.result.abi == .gnu) { - // LTO is currently broken on mingw, this can be removed when it's fixed. - exe.want_lto = false; - } - const use_llvm = b.option(bool, "use-llvm", "Use the llvm backend"); exe.use_llvm = use_llvm; exe.use_lld = use_llvm; @@ -257,13 +252,10 @@ pub fn build(b: *std.Build) !void { var code: u8 = undefined; const git_describe_untrimmed = b.runAllowFail(&[_][]const u8{ "git", - "-C", - b.build_root.path orelse ".", - "describe", - "--match", - "*.*.*", - "--tags", - "--abbrev=9", + "-C", b.build_root.path orelse ".", // affects the --git-dir argument + "--git-dir", ".git", // affected by the -C argument + "describe", "--match", "*.*.*", // + "--tags", "--abbrev=9", }, &code, .Ignore) catch { break :v version_string; }; @@ -334,7 +326,12 @@ pub fn build(b: *std.Build) !void { try addCmakeCfgOptionsToExe(b, cfg, exe, use_zig_libcxx); } else { // Here we are -Denable-llvm but no cmake integration. - try addStaticLlvmOptionsToModule(exe.root_module); + try addStaticLlvmOptionsToModule(exe.root_module, .{ + .llvm_has_m68k = llvm_has_m68k, + .llvm_has_csky = llvm_has_csky, + .llvm_has_arc = llvm_has_arc, + .llvm_has_xtensa = llvm_has_xtensa, + }); } if (target.result.os.tag == .windows) { // LLVM depends on networking as of version 18. @@ -362,11 +359,7 @@ pub fn build(b: *std.Build) !void { &[_][]const u8{ tracy_path, "public", "TracyClient.cpp" }, ); - // On mingw, we need to opt into windows 7+ to get some features required by tracy. - const tracy_c_flags: []const []const u8 = if (target.result.os.tag == .windows and target.result.abi == .gnu) - &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined", "-D_WIN32_WINNT=0x601" } - else - &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" }; + const tracy_c_flags: []const []const u8 = &.{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" }; exe.root_module.addIncludePath(.{ .cwd_relative = tracy_path }); exe.root_module.addCSourceFile(.{ .file = .{ .cwd_relative = client_cpp }, .flags = tracy_c_flags }); @@ -513,8 +506,8 @@ pub fn build(b: *std.Build) !void { .skip_non_native = skip_non_native, .skip_libc = skip_libc, .use_llvm = use_llvm, - // I observed a value of 5136793600 on the M2 CI. - .max_rss = 5368709120, + // I observed a value of 5605064704 on the M2 CI. + .max_rss = 6165571174, })); const unit_tests_step = b.step("test-unit", "Run the compiler source unit tests"); @@ -821,7 +814,12 @@ fn addCmakeCfgOptionsToExe( } } -fn addStaticLlvmOptionsToModule(mod: *std.Build.Module) !void { +fn addStaticLlvmOptionsToModule(mod: *std.Build.Module, options: struct { + llvm_has_m68k: bool, + llvm_has_csky: bool, + llvm_has_arc: bool, + llvm_has_xtensa: bool, +}) !void { // Adds the Zig C++ sources which both stage1 and stage2 need. // // We need this because otherwise zig_clang_cc1_main.cpp ends up pulling @@ -845,6 +843,22 @@ fn addStaticLlvmOptionsToModule(mod: *std.Build.Module) !void { mod.linkSystemLibrary(lib_name, .{}); } + if (options.llvm_has_m68k) for (llvm_libs_m68k) |lib_name| { + mod.linkSystemLibrary(lib_name, .{}); + }; + + if (options.llvm_has_csky) for (llvm_libs_csky) |lib_name| { + mod.linkSystemLibrary(lib_name, .{}); + }; + + if (options.llvm_has_arc) for (llvm_libs_arc) |lib_name| { + mod.linkSystemLibrary(lib_name, .{}); + }; + + if (options.llvm_has_xtensa) for (llvm_libs_xtensa) |lib_name| { + mod.linkSystemLibrary(lib_name, .{}); + }; + mod.linkSystemLibrary("z", .{}); mod.linkSystemLibrary("zstd", .{}); @@ -1333,6 +1347,33 @@ const llvm_libs = [_][]const u8{ "LLVMSupport", "LLVMDemangle", }; +const llvm_libs_m68k = [_][]const u8{ + "LLVMM68kDisassembler", + "LLVMM68kAsmParser", + "LLVMM68kCodeGen", + "LLVMM68kDesc", + "LLVMM68kInfo", +}; +const llvm_libs_csky = [_][]const u8{ + "LLVMCSKYDisassembler", + "LLVMCSKYAsmParser", + "LLVMCSKYCodeGen", + "LLVMCSKYDesc", + "LLVMCSKYInfo", +}; +const llvm_libs_arc = [_][]const u8{ + "LLVMARCDisassembler", + "LLVMARCCodeGen", + "LLVMARCDesc", + "LLVMARCInfo", +}; +const llvm_libs_xtensa = [_][]const u8{ + "LLVMXtensaDisassembler", + "LLVMXtensaAsmParser", + "LLVMXtensaCodeGen", + "LLVMXtensaDesc", + "LLVMXtensaInfo", +}; fn generateLangRef(b: *std.Build) std.Build.LazyPath { const doctest_exe = b.addExecutable(.{ diff --git a/ci/aarch64-linux-debug.sh b/ci/aarch64-linux-debug.sh old mode 100644 new mode 100755 index 220aaf12d9..143dd7c1c9 --- a/ci/aarch64-linux-debug.sh +++ b/ci/aarch64-linux-debug.sh @@ -48,11 +48,6 @@ unset CXX ninja install -# simultaneously test building self-hosted without LLVM and with 32-bit arm -stage3-debug/bin/zig build \ - -Dtarget=arm-linux-musleabihf \ - -Dno-lib - # No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts. stage3-debug/bin/zig build test docs \ --maxrss 24696061952 \ @@ -62,34 +57,12 @@ stage3-debug/bin/zig build test docs \ --zig-lib-dir "$PWD/../lib" \ -Denable-superhtml -# Ensure that updating the wasm binary from this commit will result in a viable build. -stage3-debug/bin/zig build update-zig1 - -mkdir ../build-new -cd ../build-new - -export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" -export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" - -cmake .. \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DCMAKE_BUILD_TYPE=Debug \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON \ - -DZIG_NO_LIB=ON \ - -GNinja - -unset CC -unset CXX - -ninja install - -stage3/bin/zig test ../test/behavior.zig -stage3/bin/zig build -p stage4 \ - -Dstatic-llvm \ - -Dtarget=native-native-musl \ +stage3-debug/bin/zig build \ + --prefix stage4-debug \ + -Denable-llvm \ -Dno-lib \ - --search-prefix "$PREFIX" \ - --zig-lib-dir "$PWD/../lib" -stage4/bin/zig test ../test/behavior.zig + -Dtarget=$TARGET \ + -Duse-zig-libcxx \ + -Dversion-string="$(stage3-debug/bin/zig version)" + +stage4-debug/bin/zig test ../test/behavior.zig diff --git a/ci/aarch64-linux-release.sh b/ci/aarch64-linux-release.sh old mode 100644 new mode 100755 index 69eed679e3..f6602850a9 --- a/ci/aarch64-linux-release.sh +++ b/ci/aarch64-linux-release.sh @@ -48,11 +48,6 @@ unset CXX ninja install -# simultaneously test building self-hosted without LLVM and with 32-bit arm -stage3-release/bin/zig build \ - -Dtarget=arm-linux-musleabihf \ - -Dno-lib - # No -fqemu and -fwasmtime here as they're covered by the x86_64-linux scripts. stage3-release/bin/zig build test docs \ --maxrss 24696061952 \ @@ -77,35 +72,3 @@ stage3-release/bin/zig build \ echo "If the following command fails, it means nondeterminism has been" echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." diff stage3-release/bin/zig stage4-release/bin/zig - -# Ensure that updating the wasm binary from this commit will result in a viable build. -stage3-release/bin/zig build update-zig1 - -mkdir ../build-new -cd ../build-new - -export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" -export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" - -cmake .. \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DCMAKE_BUILD_TYPE=Release \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON \ - -DZIG_NO_LIB=ON \ - -GNinja - -unset CC -unset CXX - -ninja install - -stage3/bin/zig test ../test/behavior.zig -stage3/bin/zig build -p stage4 \ - -Dstatic-llvm \ - -Dtarget=native-native-musl \ - -Dno-lib \ - --search-prefix "$PREFIX" \ - --zig-lib-dir "$PWD/../lib" -stage4/bin/zig test ../test/behavior.zig diff --git a/cmake/Findlld.cmake b/cmake/Findlld.cmake index 7c86aaed07..e71838d03d 100644 --- a/cmake/Findlld.cmake +++ b/cmake/Findlld.cmake @@ -12,8 +12,9 @@ find_path(LLD_INCLUDE_DIRS NAMES lld/Common/Driver.h /usr/lib/llvm-19/include /usr/local/llvm190/include /usr/local/llvm19/include - /usr/local/opt/llvm@19/include - /opt/homebrew/opt/llvm@19/include + /usr/local/opt/lld@19/include + /opt/homebrew/opt/lld@19/include + /home/linuxbrew/.linuxbrew/opt/lld@19/include /mingw64/include) find_library(LLD_LIBRARY NAMES lld-19.0 lld190 lld NAMES_PER_DIR @@ -22,8 +23,9 @@ find_library(LLD_LIBRARY NAMES lld-19.0 lld190 lld NAMES_PER_DIR /usr/lib/llvm-19/lib /usr/local/llvm190/lib /usr/local/llvm19/lib - /usr/local/opt/llvm@19/lib - /opt/homebrew/opt/llvm@19/lib + /usr/local/opt/lld@19/lib + /opt/homebrew/opt/lld@19/lib + /home/linuxbrew/.linuxbrew/opt/lld@19/lib ) if(EXISTS ${LLD_LIBRARY}) set(LLD_LIBRARIES ${LLD_LIBRARY}) @@ -37,8 +39,9 @@ else() /usr/lib/llvm-19/lib /usr/local/llvm190/lib /usr/local/llvm19/lib - /usr/local/opt/llvm@19/lib - /opt/homebrew/opt/llvm@19/lib + /usr/local/opt/lld@19/lib + /opt/homebrew/opt/lld@19/lib + /home/linuxbrew/.linuxbrew/opt/lld@19/lib /mingw64/lib /c/msys64/mingw64/lib c:/msys64/mingw64/lib) diff --git a/doc/langref.html.in b/doc/langref.html.in index 5ab601ab99..b30c01dfe6 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -316,7 +316,7 @@ 0.11.0 | 0.12.0 | 0.13.0 | - 0.14.0 | + 0.14.1 | master