--- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -9278,20 +9278,6 @@ void add_cc_args(CodeGen *g, ZigList &args, const char *out_dep_pa args.append(g->framework_dirs.at(i)); } - if (g->libcpp_link_lib != nullptr) { - const char *libcxx_include_path = buf_ptr(buf_sprintf("%s" OS_SEP "libcxx" OS_SEP "include", - buf_ptr(g->zig_lib_dir))); - - args.append("-isystem"); - args.append(libcxx_include_path); - - if (target_abi_is_musl(g->zig_target->abi)) { - args.append("-D_LIBCPP_HAS_MUSL_LIBC"); - } - args.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); - args.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); - } - args.append("-target"); args.append(buf_ptr(&g->llvm_triple_str)); @@ -9342,6 +9328,21 @@ void add_cc_args(CodeGen *g, ZigList &args, const char *out_dep_pa case FileExtUnknown: break; } + + if (g->libcpp_link_lib != nullptr) { + const char *libcxx_include_path = buf_ptr(buf_sprintf("%s" OS_SEP "libcxx" OS_SEP "include", + buf_ptr(g->zig_lib_dir))); + + args.append("-isystem"); + args.append(libcxx_include_path); + + if (target_abi_is_musl(g->zig_target->abi)) { + args.append("-D_LIBCPP_HAS_MUSL_LIBC"); + } + args.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); + args.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); + } + for (size_t i = 0; i < g->zig_target->llvm_cpu_features_asm_len; i += 1) { args.append(g->zig_target->llvm_cpu_features_asm_ptr[i]); }