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"),
25542554flagpd1("fencode-extended-block-signature"),
25552555sepd1("ferror-limit"),
25562556flagpd1("fescaping-block-tail-calls"),
2557.{
2558 .name = "fexceptions",
2559 .syntax = .flag,
2560 .zig_equivalent = .exceptions,
2561 .pd1 = true,
2562 .pd2 = false,
2563 .psl = false,
2564},
2557flagpd1("fexceptions"),
25652558flagpd1("fexperimental-isel"),
25662559flagpd1("fexperimental-new-constant-interpreter"),
25672560flagpd1("fexperimental-new-pass-manager"),
......@@ -2765,14 +2758,7 @@ flagpd1("fno-elide-type"),
27652758flagpd1("fno-eliminate-unused-debug-symbols"),
27662759flagpd1("fno-emulated-tls"),
27672760flagpd1("fno-escaping-block-tail-calls"),
2768.{
2769 .name = "fno-exceptions",
2770 .syntax = .flag,
2771 .zig_equivalent = .no_exceptions,
2772 .pd1 = true,
2773 .pd2 = false,
2774 .psl = false,
2775},
2761flagpd1("fno-exceptions"),
27762762flagpd1("fno-experimental-isel"),
27772763flagpd1("fno-experimental-new-pass-manager"),
27782764flagpd1("fno-fast-math"),
......@@ -2861,14 +2847,7 @@ flagpd1("fno-rewrite-includes"),
28612847flagpd1("fno-ropi"),
28622848flagpd1("fno-rounding-math"),
28632849flagpd1("fno-rtlib-add-rpath"),
2864.{
2865 .name = "fno-rtti",
2866 .syntax = .flag,
2867 .zig_equivalent = .no_rtti,
2868 .pd1 = true,
2869 .pd2 = false,
2870 .psl = false,
2871},
2850flagpd1("fno-rtti"),
28722851flagpd1("fno-rtti-data"),
28732852flagpd1("fno-rwpi"),
28742853flagpd1("fno-sanitize-address-poison-custom-array-cookie"),
......@@ -3016,14 +2995,7 @@ flagpd1("fno-frontend-optimize"),
30162995flagpd1("fropi"),
30172996flagpd1("frounding-math"),
30182997flagpd1("frtlib-add-rpath"),
3019.{
3020 .name = "frtti",
3021 .syntax = .flag,
3022 .zig_equivalent = .rtti,
3023 .pd1 = true,
3024 .pd2 = false,
3025 .psl = false,
3026},
2998flagpd1("frtti"),
30272999flagpd1("frwpi"),
30283000flagpd1("fsanitize-address-globals-dead-stripping"),
30293001flagpd1("fsanitize-address-poison-custom-array-cookie"),
src-self-hosted/stage2.zig-4
......@@ -1286,10 +1286,6 @@ pub const ClangArgIterator = extern struct {
12861286 sanitize,
12871287 linker_script,
12881288 verbose_cmds,
1289 exceptions,
1290 no_exceptions,
1291 rtti,
1292 no_rtti,
12931289 for_linker,
12941290 linker_input_z,
12951291 };
src/all_types.hpp-2
......@@ -2262,8 +2262,6 @@ struct CodeGen {
22622262 bool emit_asm;
22632263 bool emit_llvm_ir;
22642264 bool test_is_evented;
2265 bool cpp_rtti;
2266 bool cpp_exceptions;
22672265 CodeModel code_model;
22682266
22692267 Buf *root_out_name;
src/codegen.cpp-16
......@@ -8784,8 +8784,6 @@ static Error define_builtin_compile_vars(CodeGen *g) {
87848784 cache_bool(&cache_hash, g->is_test_build);
87858785 cache_bool(&cache_hash, g->is_single_threaded);
87868786 cache_bool(&cache_hash, g->test_is_evented);
8787 cache_bool(&cache_hash, g->cpp_rtti);
8788 cache_bool(&cache_hash, g->cpp_exceptions);
87898787 cache_int(&cache_hash, g->code_model);
87908788 cache_int(&cache_hash, g->zig_target->is_native_os);
87918789 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
92599257 case CSourceKindAsm:
92609258 break;
92619259 }
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 }
92709260 for (size_t i = 0; i < g->zig_target->llvm_cpu_features_asm_len; i += 1) {
92719261 args.append(g->zig_target->llvm_cpu_features_asm_ptr[i]);
92729262 }
......@@ -9714,8 +9704,6 @@ Error create_c_object_cache(CodeGen *g, CacheHash **out_cache_hash, bool verbose
97149704 cache_bool(cache_hash, g->have_sanitize_c);
97159705 cache_bool(cache_hash, want_valgrind_support(g));
97169706 cache_bool(cache_hash, g->function_sections);
9717 cache_bool(cache_hash, g->cpp_rtti);
9718 cache_bool(cache_hash, g->cpp_exceptions);
97199707 cache_int(cache_hash, g->code_model);
97209708
97219709 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) {
1055010538 cache_bool(ch, g->emit_bin);
1055110539 cache_bool(ch, g->emit_llvm_ir);
1055210540 cache_bool(ch, g->emit_asm);
10553 cache_bool(ch, g->cpp_rtti);
10554 cache_bool(ch, g->cpp_exceptions);
1055510541 cache_usize(ch, g->version_major);
1055610542 cache_usize(ch, g->version_minor);
1055710543 cache_usize(ch, g->version_patch);
......@@ -10856,8 +10842,6 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o
1085610842 parent_gen->build_mode, parent_gen->zig_lib_dir, libc, get_global_cache_dir(), false, child_progress_node);
1085710843 child_gen->root_out_name = buf_create_from_str(name);
1085810844 child_gen->disable_gen_h = true;
10859 child_gen->cpp_rtti = parent_gen->cpp_rtti;
10860 child_gen->cpp_exceptions = parent_gen->cpp_exceptions;
1086110845 child_gen->want_stack_check = WantStackCheckDisabled;
1086210846 child_gen->want_sanitize_c = WantCSanitizeDisabled;
1086310847 child_gen->verbose_tokenize = parent_gen->verbose_tokenize;
src/main.cpp-18
......@@ -458,8 +458,6 @@ static int main0(int argc, char **argv) {
458458 bool only_preprocess = false;
459459 bool ensure_libc_on_non_freestanding = false;
460460 bool ensure_libcpp_on_non_freestanding = false;
461 bool cpp_rtti = true;
462 bool cpp_exceptions = true;
463461
464462 ZigList<const char *> llvm_argv = {0};
465463 llvm_argv.append("zig (LLVM option parsing)");
......@@ -724,18 +722,6 @@ static int main0(int argc, char **argv) {
724722 verbose_cc = true;
725723 verbose_link = true;
726724 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;
739725 case Stage2ClangArgForLinker:
740726 linker_args.append(buf_create_from_str(it.only_arg));
741727 break;
......@@ -1331,8 +1317,6 @@ static int main0(int argc, char **argv) {
13311317 LinkLib *link_lib = codegen_add_link_lib(g, buf_create_from_str(link_libs.at(i)));
13321318 link_lib->provided_explicitly = true;
13331319 }
1334 g->cpp_rtti = cpp_rtti;
1335 g->cpp_exceptions = cpp_exceptions;
13361320 g->subsystem = subsystem;
13371321 g->valgrind_support = valgrind_support;
13381322 g->want_pic = want_pic;
......@@ -1481,8 +1465,6 @@ static int main0(int argc, char **argv) {
14811465 }
14821466 CodeGen *g = codegen_create(main_pkg_path, zig_root_source_file, &target, out_type, build_mode,
14831467 override_lib_dir, libc, cache_dir_buf, cmd == CmdTest, root_progress_node);
1484 g->cpp_rtti = cpp_rtti;
1485 g->cpp_exceptions = cpp_exceptions;
14861468 if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2);
14871469 g->valgrind_support = valgrind_support;
14881470 g->link_eh_frame_hdr = link_eh_frame_hdr;
src/stage2.h-4
......@@ -345,10 +345,6 @@ enum Stage2ClangArg {
345345 Stage2ClangArgSanitize,
346346 Stage2ClangArgLinkerScript,
347347 Stage2ClangArgVerboseCmds,
348 Stage2ClangArgExceptions,
349 Stage2ClangArgNoExceptions,
350 Stage2ClangArgRtti,
351 Stage2ClangArgNoRtti,
352348 Stage2ClangArgForLinker,
353349 Stage2ClangArgLinkerInputZ,
354350};
tools/update_clang_options.zig-16
......@@ -174,22 +174,6 @@ const known_options = [_]KnownOpt{
174174 .name = "###",
175175 .ident = "verbose_cmds",
176176 },
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 },
193177};
194178
195179const blacklisted_options = [_][]const u8{};