diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-03-25 20:32:40 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-03-25 20:34:15 -0400 |
| commit | fae6cf09619e7a8e64f61b84cca7d9fcd471262f (patch) | |
| tree | 373d125e6c7eb97f563af264de62eb48fb6b5baa /src/codegen.cpp | |
| parent | dd66fbb96a2e1f85e7dacdce18ebc5f85d26d0cc (diff) | |
| download | zig-fae6cf09619e7a8e64f61b84cca7d9fcd471262f.tar.gz zig-fae6cf09619e7a8e64f61b84cca7d9fcd471262f.zip | |
improved handling of native system directories
* `-isystem` instead of `-I` for system include directories
fixes a problem with native system directories interfering with zig's
bundled libc.
* separate Stage2Target.is_native into Stage2Target.is_native_os and
Stage2Target.is_native_cpu.
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 3edc99156f..cb1ab6b6b8 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8782,7 +8782,8 @@ static Error define_builtin_compile_vars(CodeGen *g) { cache_bool(&cache_hash, g->is_single_threaded); cache_bool(&cache_hash, g->test_is_evented); cache_int(&cache_hash, g->code_model); - cache_int(&cache_hash, g->zig_target->is_native); + cache_int(&cache_hash, g->zig_target->is_native_os); + cache_int(&cache_hash, g->zig_target->is_native_cpu); cache_int(&cache_hash, g->zig_target->arch); cache_int(&cache_hash, g->zig_target->vendor); cache_int(&cache_hash, g->zig_target->os); @@ -8917,7 +8918,7 @@ static void init(CodeGen *g) { const char *target_specific_cpu_args = ""; const char *target_specific_features = ""; - if (g->zig_target->is_native) { + if (g->zig_target->is_native_cpu) { target_specific_cpu_args = ZigLLVMGetHostCPUName(); target_specific_features = ZigLLVMGetNativeFeatures(); } @@ -9034,7 +9035,7 @@ static void detect_libc(CodeGen *g) { return; } - if (g->zig_target->is_native) { + if (g->zig_target->is_native_os) { g->libc = heap::c_allocator.create<Stage2LibCInstallation>(); // search for native_libc.txt in following dirs: @@ -9672,7 +9673,8 @@ Error create_c_object_cache(CodeGen *g, CacheHash **out_cache_hash, bool verbose cache_int(cache_hash, g->err_color); cache_buf(cache_hash, g->zig_c_headers_dir); cache_list_of_str(cache_hash, g->libc_include_dir_list, g->libc_include_dir_len); - cache_int(cache_hash, g->zig_target->is_native); + cache_int(cache_hash, g->zig_target->is_native_os); + cache_int(cache_hash, g->zig_target->is_native_cpu); cache_int(cache_hash, g->zig_target->arch); cache_int(cache_hash, g->zig_target->vendor); cache_int(cache_hash, g->zig_target->os); @@ -10474,7 +10476,8 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) { cache_list_of_buf(ch, g->forbidden_libs.items, g->forbidden_libs.length); cache_int(ch, g->build_mode); cache_int(ch, g->out_type); - cache_bool(ch, g->zig_target->is_native); + cache_bool(ch, g->zig_target->is_native_os); + cache_bool(ch, g->zig_target->is_native_cpu); cache_int(ch, g->zig_target->arch); cache_int(ch, g->zig_target->vendor); cache_int(ch, g->zig_target->os); @@ -10941,7 +10944,7 @@ CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget os_path_join(g->zig_std_dir, buf_sprintf("special"), g->zig_std_special_dir); assert(target != nullptr); - if (!target->is_native) { + if (!target->is_native_os) { g->each_lib_rpath = false; } else { g->each_lib_rpath = true; |
