authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-30 17:42:30-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-30 17:42:30-04:00
logcfedd3aca286881510e4a298756d4a5676e22137
tree48d4fcf40d69b7fcd4773c934110a83bbd710d71
parent6408766d6b55d228a305b877f28f45c1587f7d39
signaturelock-open Commit is signed but in an unrecognized format.

revert detection of rtti and exceptions

This caused link errors in c++ code because it was not correct to pass these flags to child codegens. And that was the only reason to detect these flags. Otherwise we can safely rely on non-explicitly-detected flag forwarding.

7 files changed, 4 insertions(+), 92 deletions(-)

src-self-hosted/clang_options_data.zig+4-32
...@@ -2554,14 +2554,7 @@ flagpd1("femulated-tls"),...@@ -2554,14 +2554,7 @@ flagpd1("femulated-tls"),
2554flagpd1("fencode-extended-block-signature"),2554flagpd1("fencode-extended-block-signature"),
2555sepd1("ferror-limit"),2555sepd1("ferror-limit"),
2556flagpd1("fescaping-block-tail-calls"),2556flagpd1("fescaping-block-tail-calls"),
2557.{2557flagpd1("fexceptions"),
2558 .name = "fexceptions",
2559 .syntax = .flag,
2560 .zig_equivalent = .exceptions,
2561 .pd1 = true,
2562 .pd2 = false,
2563 .psl = false,
2564},
2565flagpd1("fexperimental-isel"),2558flagpd1("fexperimental-isel"),
2566flagpd1("fexperimental-new-constant-interpreter"),2559flagpd1("fexperimental-new-constant-interpreter"),
2567flagpd1("fexperimental-new-pass-manager"),2560flagpd1("fexperimental-new-pass-manager"),
...@@ -2765,14 +2758,7 @@ flagpd1("fno-elide-type"),...@@ -2765,14 +2758,7 @@ flagpd1("fno-elide-type"),
2765flagpd1("fno-eliminate-unused-debug-symbols"),2758flagpd1("fno-eliminate-unused-debug-symbols"),
2766flagpd1("fno-emulated-tls"),2759flagpd1("fno-emulated-tls"),
2767flagpd1("fno-escaping-block-tail-calls"),2760flagpd1("fno-escaping-block-tail-calls"),
2768.{2761flagpd1("fno-exceptions"),
2769 .name = "fno-exceptions",
2770 .syntax = .flag,
2771 .zig_equivalent = .no_exceptions,
2772 .pd1 = true,
2773 .pd2 = false,
2774 .psl = false,
2775},
2776flagpd1("fno-experimental-isel"),2762flagpd1("fno-experimental-isel"),
2777flagpd1("fno-experimental-new-pass-manager"),2763flagpd1("fno-experimental-new-pass-manager"),
2778flagpd1("fno-fast-math"),2764flagpd1("fno-fast-math"),
...@@ -2861,14 +2847,7 @@ flagpd1("fno-rewrite-includes"),...@@ -2861,14 +2847,7 @@ flagpd1("fno-rewrite-includes"),
2861flagpd1("fno-ropi"),2847flagpd1("fno-ropi"),
2862flagpd1("fno-rounding-math"),2848flagpd1("fno-rounding-math"),
2863flagpd1("fno-rtlib-add-rpath"),2849flagpd1("fno-rtlib-add-rpath"),
2864.{2850flagpd1("fno-rtti"),
2865 .name = "fno-rtti",
2866 .syntax = .flag,
2867 .zig_equivalent = .no_rtti,
2868 .pd1 = true,
2869 .pd2 = false,
2870 .psl = false,
2871},
2872flagpd1("fno-rtti-data"),2851flagpd1("fno-rtti-data"),
2873flagpd1("fno-rwpi"),2852flagpd1("fno-rwpi"),
2874flagpd1("fno-sanitize-address-poison-custom-array-cookie"),2853flagpd1("fno-sanitize-address-poison-custom-array-cookie"),
...@@ -3016,14 +2995,7 @@ flagpd1("fno-frontend-optimize"),...@@ -3016,14 +2995,7 @@ flagpd1("fno-frontend-optimize"),
3016flagpd1("fropi"),2995flagpd1("fropi"),
3017flagpd1("frounding-math"),2996flagpd1("frounding-math"),
3018flagpd1("frtlib-add-rpath"),2997flagpd1("frtlib-add-rpath"),
3019.{2998flagpd1("frtti"),
3020 .name = "frtti",
3021 .syntax = .flag,
3022 .zig_equivalent = .rtti,
3023 .pd1 = true,
3024 .pd2 = false,
3025 .psl = false,
3026},
3027flagpd1("frwpi"),2999flagpd1("frwpi"),
3028flagpd1("fsanitize-address-globals-dead-stripping"),3000flagpd1("fsanitize-address-globals-dead-stripping"),
3029flagpd1("fsanitize-address-poison-custom-array-cookie"),3001flagpd1("fsanitize-address-poison-custom-array-cookie"),
src-self-hosted/stage2.zig-4
...@@ -1286,10 +1286,6 @@ pub const ClangArgIterator = extern struct {...@@ -1286,10 +1286,6 @@ pub const ClangArgIterator = extern struct {
1286 sanitize,1286 sanitize,
1287 linker_script,1287 linker_script,
1288 verbose_cmds,1288 verbose_cmds,
1289 exceptions,
1290 no_exceptions,
1291 rtti,
1292 no_rtti,
1293 for_linker,1289 for_linker,
1294 linker_input_z,1290 linker_input_z,
1295 };1291 };
src/all_types.hpp-2
...@@ -2262,8 +2262,6 @@ struct CodeGen {...@@ -2262,8 +2262,6 @@ struct CodeGen {
2262 bool emit_asm;2262 bool emit_asm;
2263 bool emit_llvm_ir;2263 bool emit_llvm_ir;
2264 bool test_is_evented;2264 bool test_is_evented;
2265 bool cpp_rtti;
2266 bool cpp_exceptions;
2267 CodeModel code_model;2265 CodeModel code_model;
22682266
2269 Buf *root_out_name;2267 Buf *root_out_name;
src/codegen.cpp-16
...@@ -8784,8 +8784,6 @@ static Error define_builtin_compile_vars(CodeGen *g) {...@@ -8784,8 +8784,6 @@ static Error define_builtin_compile_vars(CodeGen *g) {
8784 cache_bool(&cache_hash, g->is_test_build);8784 cache_bool(&cache_hash, g->is_test_build);
8785 cache_bool(&cache_hash, g->is_single_threaded);8785 cache_bool(&cache_hash, g->is_single_threaded);
8786 cache_bool(&cache_hash, g->test_is_evented);8786 cache_bool(&cache_hash, g->test_is_evented);
8787 cache_bool(&cache_hash, g->cpp_rtti);
8788 cache_bool(&cache_hash, g->cpp_exceptions);
8789 cache_int(&cache_hash, g->code_model);8787 cache_int(&cache_hash, g->code_model);
8790 cache_int(&cache_hash, g->zig_target->is_native_os);8788 cache_int(&cache_hash, g->zig_target->is_native_os);
8791 cache_int(&cache_hash, g->zig_target->is_native_cpu);8789 cache_int(&cache_hash, g->zig_target->is_native_cpu);
...@@ -9259,14 +9257,6 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa...@@ -9259,14 +9257,6 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa
9259 case CSourceKindAsm:9257 case CSourceKindAsm:
9260 break;9258 break;
9261 }9259 }
9262 if (source_kind == CSourceKindCpp) {
9263 if (!g->cpp_rtti) {
9264 args.append("-fno-rtti");
9265 }
9266 if (!g->cpp_exceptions) {
9267 args.append("-fno-exceptions");
9268 }
9269 }
9270 for (size_t i = 0; i < g->zig_target->llvm_cpu_features_asm_len; i += 1) {9260 for (size_t i = 0; i < g->zig_target->llvm_cpu_features_asm_len; i += 1) {
9271 args.append(g->zig_target->llvm_cpu_features_asm_ptr[i]);9261 args.append(g->zig_target->llvm_cpu_features_asm_ptr[i]);
9272 }9262 }
...@@ -9714,8 +9704,6 @@ Error create_c_object_cache(CodeGen *g, CacheHash **out_cache_hash, bool verbose...@@ -9714,8 +9704,6 @@ Error create_c_object_cache(CodeGen *g, CacheHash **out_cache_hash, bool verbose
9714 cache_bool(cache_hash, g->have_sanitize_c);9704 cache_bool(cache_hash, g->have_sanitize_c);
9715 cache_bool(cache_hash, want_valgrind_support(g));9705 cache_bool(cache_hash, want_valgrind_support(g));
9716 cache_bool(cache_hash, g->function_sections);9706 cache_bool(cache_hash, g->function_sections);
9717 cache_bool(cache_hash, g->cpp_rtti);
9718 cache_bool(cache_hash, g->cpp_exceptions);
9719 cache_int(cache_hash, g->code_model);9707 cache_int(cache_hash, g->code_model);
97209708
9721 for (size_t arg_i = 0; arg_i < g->clang_argv_len; arg_i += 1) {9709 for (size_t arg_i = 0; arg_i < g->clang_argv_len; arg_i += 1) {
...@@ -10550,8 +10538,6 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {...@@ -10550,8 +10538,6 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {
10550 cache_bool(ch, g->emit_bin);10538 cache_bool(ch, g->emit_bin);
10551 cache_bool(ch, g->emit_llvm_ir);10539 cache_bool(ch, g->emit_llvm_ir);
10552 cache_bool(ch, g->emit_asm);10540 cache_bool(ch, g->emit_asm);
10553 cache_bool(ch, g->cpp_rtti);
10554 cache_bool(ch, g->cpp_exceptions);
10555 cache_usize(ch, g->version_major);10541 cache_usize(ch, g->version_major);
10556 cache_usize(ch, g->version_minor);10542 cache_usize(ch, g->version_minor);
10557 cache_usize(ch, g->version_patch);10543 cache_usize(ch, g->version_patch);
...@@ -10856,8 +10842,6 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o...@@ -10856,8 +10842,6 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o
10856 parent_gen->build_mode, parent_gen->zig_lib_dir, libc, get_global_cache_dir(), false, child_progress_node);10842 parent_gen->build_mode, parent_gen->zig_lib_dir, libc, get_global_cache_dir(), false, child_progress_node);
10857 child_gen->root_out_name = buf_create_from_str(name);10843 child_gen->root_out_name = buf_create_from_str(name);
10858 child_gen->disable_gen_h = true;10844 child_gen->disable_gen_h = true;
10859 child_gen->cpp_rtti = parent_gen->cpp_rtti;
10860 child_gen->cpp_exceptions = parent_gen->cpp_exceptions;
10861 child_gen->want_stack_check = WantStackCheckDisabled;10845 child_gen->want_stack_check = WantStackCheckDisabled;
10862 child_gen->want_sanitize_c = WantCSanitizeDisabled;10846 child_gen->want_sanitize_c = WantCSanitizeDisabled;
10863 child_gen->verbose_tokenize = parent_gen->verbose_tokenize;10847 child_gen->verbose_tokenize = parent_gen->verbose_tokenize;
src/main.cpp-18
...@@ -458,8 +458,6 @@ static int main0(int argc, char **argv) {...@@ -458,8 +458,6 @@ static int main0(int argc, char **argv) {
458 bool only_preprocess = false;458 bool only_preprocess = false;
459 bool ensure_libc_on_non_freestanding = false;459 bool ensure_libc_on_non_freestanding = false;
460 bool ensure_libcpp_on_non_freestanding = false;460 bool ensure_libcpp_on_non_freestanding = false;
461 bool cpp_rtti = true;
462 bool cpp_exceptions = true;
463461
464 ZigList<const char *> llvm_argv = {0};462 ZigList<const char *> llvm_argv = {0};
465 llvm_argv.append("zig (LLVM option parsing)");463 llvm_argv.append("zig (LLVM option parsing)");
...@@ -724,18 +722,6 @@ static int main0(int argc, char **argv) {...@@ -724,18 +722,6 @@ static int main0(int argc, char **argv) {
724 verbose_cc = true;722 verbose_cc = true;
725 verbose_link = true;723 verbose_link = true;
726 break;724 break;
727 case Stage2ClangArgExceptions:
728 cpp_exceptions = true;
729 break;
730 case Stage2ClangArgNoExceptions:
731 cpp_exceptions = false;
732 break;
733 case Stage2ClangArgRtti:
734 cpp_rtti = true;
735 break;
736 case Stage2ClangArgNoRtti:
737 cpp_rtti = false;
738 break;
739 case Stage2ClangArgForLinker:725 case Stage2ClangArgForLinker:
740 linker_args.append(buf_create_from_str(it.only_arg));726 linker_args.append(buf_create_from_str(it.only_arg));
741 break;727 break;
...@@ -1331,8 +1317,6 @@ static int main0(int argc, char **argv) {...@@ -1331,8 +1317,6 @@ static int main0(int argc, char **argv) {
1331 LinkLib *link_lib = codegen_add_link_lib(g, buf_create_from_str(link_libs.at(i)));1317 LinkLib *link_lib = codegen_add_link_lib(g, buf_create_from_str(link_libs.at(i)));
1332 link_lib->provided_explicitly = true;1318 link_lib->provided_explicitly = true;
1333 }1319 }
1334 g->cpp_rtti = cpp_rtti;
1335 g->cpp_exceptions = cpp_exceptions;
1336 g->subsystem = subsystem;1320 g->subsystem = subsystem;
1337 g->valgrind_support = valgrind_support;1321 g->valgrind_support = valgrind_support;
1338 g->want_pic = want_pic;1322 g->want_pic = want_pic;
...@@ -1481,8 +1465,6 @@ static int main0(int argc, char **argv) {...@@ -1481,8 +1465,6 @@ static int main0(int argc, char **argv) {
1481 }1465 }
1482 CodeGen *g = codegen_create(main_pkg_path, zig_root_source_file, &target, out_type, build_mode,1466 CodeGen *g = codegen_create(main_pkg_path, zig_root_source_file, &target, out_type, build_mode,
1483 override_lib_dir, libc, cache_dir_buf, cmd == CmdTest, root_progress_node);1467 override_lib_dir, libc, cache_dir_buf, cmd == CmdTest, root_progress_node);
1484 g->cpp_rtti = cpp_rtti;
1485 g->cpp_exceptions = cpp_exceptions;
1486 if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2);1468 if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2);
1487 g->valgrind_support = valgrind_support;1469 g->valgrind_support = valgrind_support;
1488 g->link_eh_frame_hdr = link_eh_frame_hdr;1470 g->link_eh_frame_hdr = link_eh_frame_hdr;
src/stage2.h-4
...@@ -345,10 +345,6 @@ enum Stage2ClangArg {...@@ -345,10 +345,6 @@ enum Stage2ClangArg {
345 Stage2ClangArgSanitize,345 Stage2ClangArgSanitize,
346 Stage2ClangArgLinkerScript,346 Stage2ClangArgLinkerScript,
347 Stage2ClangArgVerboseCmds,347 Stage2ClangArgVerboseCmds,
348 Stage2ClangArgExceptions,
349 Stage2ClangArgNoExceptions,
350 Stage2ClangArgRtti,
351 Stage2ClangArgNoRtti,
352 Stage2ClangArgForLinker,348 Stage2ClangArgForLinker,
353 Stage2ClangArgLinkerInputZ,349 Stage2ClangArgLinkerInputZ,
354};350};
tools/update_clang_options.zig-16
...@@ -174,22 +174,6 @@ const known_options = [_]KnownOpt{...@@ -174,22 +174,6 @@ const known_options = [_]KnownOpt{
174 .name = "###",174 .name = "###",
175 .ident = "verbose_cmds",175 .ident = "verbose_cmds",
176 },176 },
177 .{
178 .name = "fexceptions",
179 .ident = "exceptions",
180 },
181 .{
182 .name = "fno-exceptions",
183 .ident = "no_exceptions",
184 },
185 .{
186 .name = "frtti",
187 .ident = "rtti",
188 },
189 .{
190 .name = "fno-rtti",
191 .ident = "no_rtti",
192 },
193};177};
194178
195const blacklisted_options = [_][]const u8{};179const blacklisted_options = [_][]const u8{};