zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 2de53592a1d84a1476f662e20d7339d25d4716fe (tree)
parent ab7ea5354101ffaf5c9708ca6398ff7b765b781f
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sat,  3 Oct 2020 23:15:45 -0700

stage1: better value for builtin.link_mode

Now it is Dynamic unless -DZIG_STATIC=on is passed to cmake.

This partially addresses #6469.

Diffstat:
MCMakeLists.txt | 3+++
Msrc/stage1/codegen.cpp | 2+-
Msrc/stage1/config.h.in | 1+
3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -63,6 +63,9 @@ endif() if(ZIG_STATIC) set(ZIG_STATIC_LLVM "on") + set(ZIG_LINK_MODE "Static") +else() + set(ZIG_LINK_MODE "Dynamic") endif() string(REGEX REPLACE "\\\\" "\\\\\\\\" ZIG_LIBC_LIB_DIR_ESCAPED "${ZIG_LIBC_LIB_DIR}") diff --git a/src/stage1/codegen.cpp b/src/stage1/codegen.cpp @@ -8815,7 +8815,7 @@ Buf *codegen_generate_builtin_source(CodeGen *g) { buf_append_str(contents, "/// Deprecated: use `std.Target.current.cpu.arch.endian()`\n"); buf_append_str(contents, "pub const endian = Target.current.cpu.arch.endian();\n"); buf_appendf(contents, "pub const output_mode = OutputMode.Obj;\n"); - buf_appendf(contents, "pub const link_mode = LinkMode.Static;\n"); + buf_appendf(contents, "pub const link_mode = LinkMode.%s;\n", ZIG_LINK_MODE); buf_appendf(contents, "pub const is_test = false;\n"); buf_appendf(contents, "pub const single_threaded = %s;\n", bool_to_str(g->is_single_threaded)); buf_appendf(contents, "pub const abi = Abi.%s;\n", cur_abi); diff --git a/src/stage1/config.h.in b/src/stage1/config.h.in @@ -21,5 +21,6 @@ #define ZIG_CLANG_LIBRARIES "@CLANG_LIBRARIES@" #define ZIG_LLVM_CONFIG_EXE "@LLVM_CONFIG_EXE@" #define ZIG_DIA_GUIDS_LIB "@ZIG_DIA_GUIDS_LIB_ESCAPED@" +#define ZIG_LINK_MODE "@ZIG_LINK_MODE@" #endif