authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-09 09:33:33-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-09 09:33:33-04:00
log2482bdf22b77bdee718167da5390157cc792dced
tree9fb2cf78ae9d18d52bbbff2fb61b74161f68558d
parent19cf9bd06283d020fa013333b04504133a2e26cb
signature Commit is signed but in an unrecognized format.

release builds of stage1 have llvm ir verification

the stage2 zig code however gets compiled in release mode, and stripped.

3 files changed, 12 insertions(+), 4 deletions(-)

CMakeLists.txt+6
...@@ -590,12 +590,18 @@ if(MSVC)...@@ -590,12 +590,18 @@ if(MSVC)
590else()590else()
591 set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a")591 set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a")
592endif()592endif()
593if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
594 set(LIBUSERLAND_RELEASE_MODE "false")
595else()
596 set(LIBUSERLAND_RELEASE_MODE "true")
597endif()
593add_custom_target(zig_build_libuserland ALL598add_custom_target(zig_build_libuserland ALL
594 COMMAND zig0 build599 COMMAND zig0 build
595 --override-std-dir std600 --override-std-dir std
596 --override-lib-dir "${CMAKE_SOURCE_DIR}"601 --override-lib-dir "${CMAKE_SOURCE_DIR}"
597 libuserland install602 libuserland install
598 "-Doutput-dir=${CMAKE_BINARY_DIR}"603 "-Doutput-dir=${CMAKE_BINARY_DIR}"
604 "-Drelease=${LIBUSERLAND_RELEASE_MODE}"
599 "-Dlib-files-only"605 "-Dlib-files-only"
600 --prefix "${CMAKE_INSTALL_PREFIX}"606 --prefix "${CMAKE_INSTALL_PREFIX}"
601 DEPENDS zig0607 DEPENDS zig0
build.zig+6-2
...@@ -63,7 +63,7 @@ pub fn build(b: *Builder) !void {...@@ -63,7 +63,7 @@ pub fn build(b: *Builder) !void {
63 try configureStage2(b, test_stage2, ctx);63 try configureStage2(b, test_stage2, ctx);
64 try configureStage2(b, exe, ctx);64 try configureStage2(b, exe, ctx);
6565
66 addLibUserlandStep(b);66 addLibUserlandStep(b, mode);
6767
68 const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false;68 const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false;
69 const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release;69 const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release;
...@@ -370,11 +370,15 @@ const Context = struct {...@@ -370,11 +370,15 @@ const Context = struct {
370 llvm: LibraryDep,370 llvm: LibraryDep,
371};371};
372372
373fn addLibUserlandStep(b: *Builder) void {373fn addLibUserlandStep(b: *Builder, mode: builtin.Mode) void {
374 const artifact = b.addStaticLibrary("userland", "src-self-hosted/stage1.zig");374 const artifact = b.addStaticLibrary("userland", "src-self-hosted/stage1.zig");
375 artifact.disable_gen_h = true;375 artifact.disable_gen_h = true;
376 artifact.bundle_compiler_rt = true;376 artifact.bundle_compiler_rt = true;
377 artifact.setTarget(builtin.arch, builtin.os, builtin.abi);377 artifact.setTarget(builtin.arch, builtin.os, builtin.abi);
378 artifact.setBuildMode(mode);
379 if (mode != .Debug) {
380 artifact.strip = true;
381 }
378 artifact.linkSystemLibrary("c");382 artifact.linkSystemLibrary("c");
379 if (builtin.os == .windows) {383 if (builtin.os == .windows) {
380 artifact.linkSystemLibrary("ntdll");384 artifact.linkSystemLibrary("ntdll");
src/codegen.cpp-2
...@@ -7381,10 +7381,8 @@ static void do_code_gen(CodeGen *g) {...@@ -7381,10 +7381,8 @@ static void do_code_gen(CodeGen *g) {
7381 LLVMDumpModule(g->module);7381 LLVMDumpModule(g->module);
7382 }7382 }
73837383
7384#ifndef NDEBUG
7385 char *error = nullptr;7384 char *error = nullptr;
7386 LLVMVerifyModule(g->module, LLVMAbortProcessAction, &error);7385 LLVMVerifyModule(g->module, LLVMAbortProcessAction, &error);
7387#endif
7388}7386}
73897387
7390static void zig_llvm_emit_output(CodeGen *g) {7388static void zig_llvm_emit_output(CodeGen *g) {