aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-09-09 09:33:33 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-09-09 09:33:33 -0400
commit2482bdf22b77bdee718167da5390157cc792dced (patch)
tree9fb2cf78ae9d18d52bbbff2fb61b74161f68558d
parent19cf9bd06283d020fa013333b04504133a2e26cb (diff)
downloadzig-2482bdf22b77bdee718167da5390157cc792dced.tar.gz
zig-2482bdf22b77bdee718167da5390157cc792dced.zip
release builds of stage1 have llvm ir verification
the stage2 zig code however gets compiled in release mode, and stripped.
-rw-r--r--CMakeLists.txt6
-rw-r--r--build.zig8
-rw-r--r--src/codegen.cpp2
3 files changed, 12 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05f603f12c..b43d31b58e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -590,12 +590,18 @@ if(MSVC)
else()
set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a")
endif()
+if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+ set(LIBUSERLAND_RELEASE_MODE "false")
+else()
+ set(LIBUSERLAND_RELEASE_MODE "true")
+endif()
add_custom_target(zig_build_libuserland ALL
COMMAND zig0 build
--override-std-dir std
--override-lib-dir "${CMAKE_SOURCE_DIR}"
libuserland install
"-Doutput-dir=${CMAKE_BINARY_DIR}"
+ "-Drelease=${LIBUSERLAND_RELEASE_MODE}"
"-Dlib-files-only"
--prefix "${CMAKE_INSTALL_PREFIX}"
DEPENDS zig0
diff --git a/build.zig b/build.zig
index 21fa79e863..457314b42a 100644
--- a/build.zig
+++ b/build.zig
@@ -63,7 +63,7 @@ pub fn build(b: *Builder) !void {
try configureStage2(b, test_stage2, ctx);
try configureStage2(b, exe, ctx);
- addLibUserlandStep(b);
+ addLibUserlandStep(b, mode);
const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false;
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 {
llvm: LibraryDep,
};
-fn addLibUserlandStep(b: *Builder) void {
+fn addLibUserlandStep(b: *Builder, mode: builtin.Mode) void {
const artifact = b.addStaticLibrary("userland", "src-self-hosted/stage1.zig");
artifact.disable_gen_h = true;
artifact.bundle_compiler_rt = true;
artifact.setTarget(builtin.arch, builtin.os, builtin.abi);
+ artifact.setBuildMode(mode);
+ if (mode != .Debug) {
+ artifact.strip = true;
+ }
artifact.linkSystemLibrary("c");
if (builtin.os == .windows) {
artifact.linkSystemLibrary("ntdll");
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 3066d8b1c5..b590995c92 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -7381,10 +7381,8 @@ static void do_code_gen(CodeGen *g) {
LLVMDumpModule(g->module);
}
-#ifndef NDEBUG
char *error = nullptr;
LLVMVerifyModule(g->module, LLVMAbortProcessAction, &error);
-#endif
}
static void zig_llvm_emit_output(CodeGen *g) {