stage1: better value for builtin.link_mode

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

This partially addresses #6469.
master
Andrew Kelley 2020-10-03 23:15:45 -07:00
parent ab7ea53541
commit 2de53592a1
3 changed files with 5 additions and 1 deletions

View File

@ -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}")

View File

@ -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);

View File

@ -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