| author | |
| committer | |
| log | 2482bdf22b77bdee718167da5390157cc792dced |
| tree | 9fb2cf78ae9d18d52bbbff2fb61b74161f68558d |
| parent | 19cf9bd06283d020fa013333b04504133a2e26cb |
| signature |
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) |
| 590 | else() | 590 | else() |
| 591 | set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a") | 591 | set(LIBUSERLAND "${CMAKE_BINARY_DIR}/libuserland.a") |
| 592 | endif() | 592 | endif() |
| 593 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | ||
| 594 | set(LIBUSERLAND_RELEASE_MODE "false") | ||
| 595 | else() | ||
| 596 | set(LIBUSERLAND_RELEASE_MODE "true") | ||
| 597 | endif() | ||
| 593 | add_custom_target(zig_build_libuserland ALL | 598 | add_custom_target(zig_build_libuserland ALL |
| 594 | COMMAND zig0 build | 599 | COMMAND zig0 build |
| 595 | --override-std-dir std | 600 | --override-std-dir std |
| 596 | --override-lib-dir "${CMAKE_SOURCE_DIR}" | 601 | --override-lib-dir "${CMAKE_SOURCE_DIR}" |
| 597 | libuserland install | 602 | 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 zig0 | 607 | 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); |
| 65 | 65 | ||
| 66 | addLibUserlandStep(b); | 66 | addLibUserlandStep(b, mode); |
| 67 | 67 | ||
| 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 | }; |
| 372 | 372 | ||
| 373 | fn addLibUserlandStep(b: *Builder) void { | 373 | fn 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 | } |
| 7383 | 7383 | ||
| 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 | } |
| 7389 | 7387 | ||
| 7390 | static void zig_llvm_emit_output(CodeGen *g) { | 7388 | static void zig_llvm_emit_output(CodeGen *g) { |