diff options
45 files changed, 867 insertions, 186 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9086576410a..7f78fd315fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,105 @@ +2013-05-31 Caroline Tice <cmtice@google.com> + + * configure (CXX_FOR_TARGET): Add libstdc++-v3/libsupc++/.libs to the + library search path. + * ligbcc/config.host (extra_parts): Add vtv_start.o and vtv_end.o to + the list. + * libgcc/Makefile.in: Add definitin for gcc_srcdir; add rules for + building vtv_start.o and vtv_end.o. + * passes.c (init_optimization_pass): Add pass_vtable_verify. + * vtv_start.c: New file. + * tree-pass.h (pass_vtable_verify): Declare new pass. + * vtable-verify.c: New file, contains vtable verification tree + pass. + * vtable-verify.h: New file. + * common.opt: (fvtable-verify=): New option. Also define vtv_priority + values for the option. + * timevar.def (TV_VTABLE_VERIFICATION): Declare new time var. + * config/gnu-user.h: Add vtv_start.o to STARTFILE_SPEC if + fvtable-verify is present; Add vtv_end.o to ENDFILE_SPEC if + fvtable-verify is present. + * tree.h: Add extern function declaration for save_vtable_map_decl. + * vtv_end.c: New file. + * flag-types.h (vtv_priority): New enum, for values for new + '-fvtable-verify=' option. + * Makefile.in (OBJS): Add vtable-verify.o to list of object + files. + (vtable-verify.o): Add rule for building object file. + (GTFILES): Add vtable-verify.c to list of files that use GCC's + garbage collector. + * varasm.c (assemble_variable): Add code for handling variables that + go into the ".vtable_map_vars" section. + (assemble_vtv_perinit_initializer): New function. + (default_section_type_flags): Add SECTION_LINKONCE to + ".vtable_map_vars" section items. + * output.h (assemble_vtv_preinit_initializer): External function decl. + +2013-05-31 Yuri Rumyantsev <yuri.s.rumyantsev@intel.com> + Igor Zamyatin <igor.zamyatin@intel.com> + + Silvermont (SLM) architecture performance tuning. + * config/i386/i386.h (enum ix86_tune_indices): Add + X86_TUNE_SPLIT_MEM_OPND_FOR_FP_CONVERTS. + (TARGET_SPLIT_MEM_OPND_FOR_FP_CONVERTS): New define. + + * config/i386/i386.c (initial_ix86_tune_features) + <X86_TUNE_SPLIT_MEM_OPND_FOR_FP_CONVERTS>: Initialize. + (ix86_lea_outperforms): Handle Silvermont tuning. + (ix86_avoid_lea_for_add): Add new argument to ix86_lea_outperforms + call. + (ix86_use_lea_for_mov): Likewise. + (ix86_avoid_lea_for_addr): Likewise. + (ix86_lea_for_add_ok): Likewise. + (exact_dependency_1): New function. + (exact_store_load_dependency): Likewise. + (ix86_adjust_cost): Handle Silvermont tuning. + (do_reoder_for_imul): Likewise. + (swap_top_of_ready_list): New function. + (ix86_sched_reorder): Changed to handle Silvermont tuning. + + * config/i386/i386.md (peepholes that split memory operand in fp + converts): New. + +2013-05-31 Marcus Shawcroft <marcus.shawcroft@arm.com> + + * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): + Remove un-necessary braces. + +2013-05-31 Marcus Shawcroft <marcus.shawcroft@arm.com> + + * config/aarch64/aarch64.c (aarch64_classify_symbol): + Use SYMBOL_TINY_ABSOLUTE for AARCH64_CMODEL_TINY_PIC. + +2013-05-31 Tobias Burnus <burnus@net-b.de> + + PR middle-end/57073 + * tree-ssa-math-opts.c (execute_cse_sincos): Move check + further up. + +2013-05-31 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/56315 + * config/arm/arm.c (const_ok_for_dimode_op): Handle IOR. + * config/arm/arm.md (*iordi3_insn): Change to insn_and_split. + * config/arm/neon.md (iordi3_neon): Remove. + (neon_vorr<mode>): Generate iordi3 instead of iordi3_neon. + * config/arm/predicates.md (imm_for_neon_logic_operand): + Move to earlier in the file. + (neon_logic_op2): Likewise. + (arm_iordi_operand_neon): New predicate. + +2013-05-31 Richard Biener <rguenther@suse.de> + + PR tree-optimization/57478 + PR tree-optimization/57453 + * tree-vect-slp.c (vect_bb_slp_scalar_cost): Uses in PHI nodes + are life as well. + +2013-05-31 Kaushik Phatak <kaushik.phatak@kpitcummins.com> + + * config/rl78/rl78.md (mulqi3,mulhi3): New define_expands. + (*mulqi3_rl78,*mulhi3_rl78,*mulhi3_g13): New define_insns. + 2013-05-30 Tobias Burnus <burnus@net-b.de> Thomas Koenig <tkoenig@gcc.gnu.org> @@ -678,18 +780,17 @@ 2013-05-24 Vladimir Makarov <vmakarov@redhat.com> - * lra-constraints.c (emit_spill_move): Use smaller mode for + * lra-constraints.c (emit_spill_move): Use smaller mode for mem-mem moves. - (check_and_process_move): Consider mem-reg moves for secondary + (check_and_process_move): Consider mem-reg moves for secondary too. - (curr_insn_transform): Don't lose insns emitted before for + (curr_insn_transform): Don't lose insns emitted before for secondary memory moves. (inherit_in_ebb): Mark defined reg. Add usage only if it is not a reg set up in the current insn. 2013-05-24 Dehao Chen <dehao@google.com> - * testsuite/gcc.dg/debug/dwarf2/discriminator.c: New Testcase. * tree-cfg.c (locus_descrim_hasher::hash): Change discriminator hash function. (locus_descrim_hasher::equal): Likewise. @@ -1046,8 +1147,8 @@ 2013-05-21 Christian Bruel <christian.bruel@st.com> - * dwarf2out.c (multiple_reg_loc_descriptor): Use dbx_reg_number for - spanning registers. LEAF_REG_REMAP is supported only for contiguous + * dwarf2out.c (multiple_reg_loc_descriptor): Use dbx_reg_number for + spanning registers. LEAF_REG_REMAP is supported only for contiguous registers. Set register size out of the PARALLEL loop. 2013-05-20 Oleg Endo <olegendo@gcc.gnu.org> diff --git a/gcc/Makefile.in b/gcc/Makefile.in index e95dd63c7db..6664305fb10 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1468,6 +1468,7 @@ OBJS = \ varasm.o \ varpool.o \ vmsdbgout.o \ + vtable-verify.o \ web.o \ xcoffout.o \ $(out_object_file) \ @@ -2638,6 +2639,12 @@ tree-vectorizer.o: tree-vectorizer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(DUMPFILE_H) $(TM_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) \ $(CFGLOOP_H) $(TREE_PASS_H) $(TREE_VECTORIZER_H) \ $(TREE_PRETTY_PRINT_H) +vtable-verify.o: vtable-verify.c vtable-verify.h $(CONFIG_H) \ + $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) cp/cp-tree.h $(TM_P_H) \ + $(BASIC_BLOCK_H) output.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(TREE_PASS_H) \ + $(TIMEVAR_H) $(CFGLOOP_H) $(FLAGS_H) $(TREE_INLINE_H) $(SCEV_H) \ + $(DIAGNOSTIC_CORE_H) $(GIMPLE_PRETTY_PRINT_H) toplev.h langhooks.h \ + gt-vtable-verify.h tree-loop-distribution.o: tree-loop-distribution.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H) tree-parloops.o: tree-parloops.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ @@ -3801,6 +3808,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/lto-streamer.h \ $(srcdir)/target-globals.h \ $(srcdir)/ipa-inline.h \ + $(srcdir)/vtable-verify.c \ $(srcdir)/asan.c \ $(srcdir)/tsan.c \ @all_gtfiles@ diff --git a/gcc/common.opt b/gcc/common.opt index 4c7933e587c..43a97bdc5bc 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2311,6 +2311,26 @@ Enum(symbol_visibility) String(hidden) Value(VISIBILITY_HIDDEN) EnumValue Enum(symbol_visibility) String(protected) Value(VISIBILITY_PROTECTED) +fvtable-verify= +Common Joined RejectNegative Enum(vtv_priority) Var(flag_vtable_verify) Init(VTV_NO_PRIORITY) +Validate vtable pointers before using them. + +Enum +Name(vtv_priority) Type(enum vtv_priority) UnknownError(unknown vtable verify initialization priority %qs) + +EnumValue +Enum(vtv_priority) String(none) Value(VTV_NO_PRIORITY) + +EnumValue +Enum(vtv_priority) String(std) Value(VTV_STANDARD_PRIORITY) + +EnumValue +Enum(vtv_priority) String(preinit) Value(VTV_PREINIT_PRIORITY) + +fvtv-counts +Common Var(flag_vtv_counts) +Output vtable verification counters. + fvpt Common Report Var(flag_value_profile_transformations) Optimization Use expression value profiles in optimizations diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h index bcdf0e6cc5a..1395b795f5c 100644 --- a/gcc/config/gnu-user.h +++ b/gcc/config/gnu-user.h @@ -43,11 +43,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #if defined HAVE_LD_PIE #define GNU_USER_TARGET_STARTFILE_SPEC \ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ - crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" + crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ + %{fvtable-verify=std:vtv_start.o%s} \ + %{fvtable-verify=preinit:vtv_start_preinit.o%s}" #else #define GNU_USER_TARGET_STARTFILE_SPEC \ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ - crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" + crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ + %{fvtable-verify=std:vtv_start.o%s} \ + %{fvtable-verify=preinit:vtv_start_preinit.o%s}" #endif #undef STARTFILE_SPEC #define STARTFILE_SPEC GNU_USER_TARGET_STARTFILE_SPEC @@ -59,7 +63,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see GNU userspace "finalizer" file, `crtn.o'. */ #define GNU_USER_TARGET_ENDFILE_SPEC \ - "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" + "%{fvtable-verify=std:vtv_end.o%s} \ + %{fvtable-verify=preinit:vtv_end_preinit.o%s} \ + %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" #undef ENDFILE_SPEC #define ENDFILE_SPEC GNU_USER_TARGET_ENDFILE_SPEC diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ae2c174754e..15733a55eef 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,84 +1,39 @@ -2013-05-30 Jason Merrill <jason@redhat.com> - - PR c++/57404 - * cp-lang.c (cp_classify_record): Handle structs without - TYPE_LANG_SPECIFIC. - - PR c++/52377 - * class.c (common_enclosing_class): New. - * cp-tree.h: Declare it. - * init.c (sort_mem_initializers): Don't splice out a union member - with an NSDMI. - -2013-05-29 Jan Hubicka <jh@suse.cz> - - * tree.c (cp_fix_function_decl_p): Update for new symtab flags. - * decl2.c )var_finalized_p, cp_write_global_declarations): Likewise. - -2013-05-25 Paolo Carlini <paolo.carlini@oracle.com> - - PR c++/25666 - * decl2.c (check_classfn): Check for destructors declared as member - templates. - -2013-05-24 Jason Merrill <jason@redhat.com> - - PR c++/56971 - * pt.c (any_template_arguments_need_structural_equality_p): A - TEMPLATE_TEMPLATE_PARM can require structural type comparison. - -2013-05-24 Paolo Carlini <paolo.carlini@oracle.com> - - PR c++/19618 - * class.c (check_bitfield_decl): Warn for bool and enum bitfields - with width exceeding the type. - -2013-05-24 Jason Merrill <jason@redhat.com> - - PR c++/57391 - * semantics.c (cxx_eval_constant_expression): Handle FMA_EXPR. - (cxx_eval_trinary_expression): Rename from cxx_eval_vec_perm_expr. - -2013-05-23 Jason Merrill <jason@redhat.com> - - PR c++/57388 - * tree.c (build_ref_qualified_type): Clear - FUNCTION_RVALUE_QUALIFIED for lvalue ref-qualifier. - -2013-05-22 Jason Merrill <jason@redhat.com> - - PR c++/56930 - * call.c (convert_like_real): Use cp_convert_and_check. - * cvt.c (cp_convert_and_check): Use maybe_constant_value. - * semantics.c (cxx_eval_constant_expression): Handle LTGT_EXPR. - (potential_constant_expression_1): Handle OMP_ATOMIC*. - - PR c++/56915 - * semantics.c (maybe_add_lambda_conv_op): Give up if the call op - isn't defined. - -2013-05-22 Paolo Carlini <paolo.carlini@oracle.com> - - PR c++/57352 - * parser.c (cp_parser_conversion_type_id): Set up - parser->type_definition_forbidden_message before calling - cp_parser_type_specifier_seq. - -2013-05-22 Paolo Carlini <paolo.carlini@oracle.com> - - PR c++/57211 - * method.c (defaultable_fn_check): Avoid do_warn_unused_parameter - warnings about defaulted functions. - -2013-05-21 Paolo Carlini <paolo.carlini@oracle.com> - - * call.c (build_conditional_expr_1): Add location_t parameter. - (build_conditional_expr): Likewise. - * typeck.c (rationalize_conditional_expr, cp_build_array_ref, - get_member_function_from_ptrfunc, build_x_conditional_expr, - cp_build_modify_expr): Update. - * init.c (build_new_1): Likewise. - * cp-tree.h: Update declaration. +2013-05-20 Caroline Tice <cmtice@google.com> + + * class.c (finish_struct_1): Add call to vtv_save_class_info if vtable + verification is turned on. + * config-lang.in: Add vtable-class-hierarchy.c to the list of files + that use GCC's garbage collector. + * g++spec.c (VTABLE_LOAD_MODULE_UNIT): New macro for link option needed + with vtable verification. + (lang_specific_driver): Added variable to indicate if vtable + verification option is used, and which flavor. Process -fvtable-verify + option, update num_args if option is present, and add appropriate + driver options if fvtable-verify is present. + * vtable-class-hierarchy.c: New file, containing the bulk of vtable + verification's front-end work. + * mangle.c (get_mangled_vtable_map_var_name): New function. + * decl2.c (start_objects): Update function comment. + (cp_write_global_declarations): If vtable verification is turned on, + call vtv_recover_class_info and + vtv_compute_class_hierarchy_transitive_closure before calling + finalize_compilation_unit. Call vtv_generate_init_routine after. + (vtv_start_verification_constructor_init_function): New externally + visible wrapper function to call start_objects for vtable verification. + (vtv_finish_verification_constructor_init_function): New function. + * init.c (build_vtbl_address): Make function not static (externally + visible). + * Make-lang.in: (CXX_AND_OBJCXX_OBJS): Add vtable-class-hierarchy.o to + list of object files. + (vtable-class-hierarchy.o): Add rule for building object file. + * pt.c (mark_class_instantiated): Add call to vtv_save_class_info if + vtable verification is turned on. + * cp-tree.h: Add extern function declarations for + vtv_start_verification_constructor_init_function, + vtv_finish_verification_constructor_init_function, build_vtbl_address, + vtv_compute_class_hierarchy_transitive_closure, + vtv_generate_init_routine, vtv_save_class_info, + vtv_recover_class_info and get_mangled_vtable_map_var_name. 2013-05-20 Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index df8ed3ee0d9..36ad099d14c 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -80,7 +80,7 @@ CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \ cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o \ cp/mangle.o cp/cp-objcp-common.o cp/name-lookup.o cp/cxx-pretty-print.o \ - cp/cp-gimplify.o $(CXX_C_OBJS) + cp/cp-gimplify.o cp/vtable-class-hierarchy.o $(CXX_C_OBJS) # Language-specific object files for C++. CXX_OBJS = cp/cp-lang.o c-family/stub-objc.o $(CXX_AND_OBJCXX_OBJS) @@ -338,7 +338,12 @@ cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_CORE_H) \ c-family/c-objc.h tree-pretty-print.h $(CXX_PARSER_H) $(TIMEVAR_H) cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \ $(TM_H) coretypes.h pointer-set.h tree-iterator.h $(SPLAY_TREE_H) - +cp/vtable-class-hierarchy.o: cp/vtable-class-hierarchy.c \ + $(TM_H) $(TIMEVAR_H) $(CXX_TREE_H) intl.h $(CXX_PARSER_H) cp/decl.h \ + $(FLAGS_H) $(DIAGNOSTIC_CORE_H) output.h $(CGRAPH_H) c-family/c-common.h \ + c-family/c-objc.h $(PLUGIN_H) \ + tree-iterator.h vtable-verify.h $(GIMPLE_H) \ + gt-cp-vtable-class-hierarchy.h cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(CXX_TREE_H) $(TIMEVAR_H) gt-cp-name-lookup.h $(PARAMS_H) \ $(DIAGNOSTIC_CORE_H) $(FLAGS_H) debug.h pointer-set.h diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 22cdf90f735..c2e9b4e548e 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6434,6 +6434,9 @@ finish_struct_1 (tree t) maybe_suppress_debug_info (t); + if (flag_vtable_verify) + vtv_save_class_info (t); + dump_class_hierarchy (t); /* Finish debugging output for this type. */ diff --git a/gcc/cp/config-lang.in b/gcc/cp/config-lang.in index 1597bf97017..4ea9b4d9a2b 100644 --- a/gcc/cp/config-lang.in +++ b/gcc/cp/config-lang.in @@ -29,4 +29,4 @@ compilers="cc1plus\$(exeext)" target_libs="target-libstdc++-v3" -gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.h \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/cp-lang.c \$(srcdir)/cp/except.c" +gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.h \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/cp-lang.c \$(srcdir)/cp/except.c \$(srcdir)/cp/vtable-class-hierarchy.c" diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index aebc440a427..6a5102d9aba 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5290,6 +5290,8 @@ extern void note_vague_linkage_fn (tree); extern tree build_artificial_parm (tree, tree); extern bool possibly_inlined_p (tree); extern int parm_index (tree); +extern tree vtv_start_verification_constructor_init_function (void); +extern tree vtv_finish_verification_constructor_init_function (tree); /* in error.c */ extern void init_error (void); @@ -5380,6 +5382,7 @@ extern tree build_java_class_ref (tree); extern tree integral_constant_value (tree); extern tree decl_constant_value_safe (tree); extern int diagnose_uninitialized_cst_or_ref_member (tree, bool, bool); +extern tree build_vtbl_address (tree); /* in lex.c */ extern void cxx_dup_lang_specific_decl (tree); @@ -5608,7 +5611,6 @@ extern tree copied_binfo (tree, tree); extern tree original_binfo (tree, tree); extern int shared_member_p (tree); - /* The representation of a deferred access check. */ typedef struct GTY(()) deferred_access_check { @@ -6099,6 +6101,7 @@ extern tree mangle_tls_init_fn (tree); extern tree mangle_tls_wrapper_fn (tree); extern bool decl_tls_wrapper_p (tree); extern tree mangle_ref_init_variable (tree); +extern char * get_mangled_vtable_map_var_name (tree); /* in dump.c */ extern bool cp_dump_tree (void *, tree); @@ -6131,6 +6134,13 @@ extern bool cxx_omp_privatize_by_reference (const_tree); extern void suggest_alternatives_for (location_t, tree); extern tree strip_using_decl (tree); +/* in vtable-class-hierarchy.c */ +extern void vtv_compute_class_hierarchy_transitive_closure (void); +extern void vtv_generate_init_routine (void); +extern void vtv_save_class_info (tree); +extern void vtv_recover_class_info (void); +extern void vtv_build_vtable_verify_fndecl (void); + /* -- end of C++ */ #endif /* ! GCC_CP_TREE_H */ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 409a7436dca..f725d83d0f2 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3019,7 +3019,8 @@ generate_tls_wrapper (tree fn) } /* Start the process of running a particular set of global constructors - or destructors. Subroutine of do_[cd]tors. */ + or destructors. Subroutine of do_[cd]tors. Also called from + vtv_start_verification_constructor_init_function. */ static tree start_objects (int method_type, int initp) @@ -4333,8 +4334,25 @@ cp_write_global_declarations (void) timevar_stop (TV_PHASE_DEFERRED); timevar_start (TV_PHASE_OPT_GEN); + if (flag_vtable_verify) + { + vtv_recover_class_info (); + vtv_compute_class_hierarchy_transitive_closure (); + vtv_build_vtable_verify_fndecl (); + } + finalize_compilation_unit (); + if (flag_vtable_verify) + { + /* Generate the special constructor initialization function that + calls __VLTRegisterPairs, and give it a very high + initialization priority. This must be done after + finalize_compilation_unit so that we have accurate + information about which vtable will actually be emitted. */ + vtv_generate_init_routine (); + } + timevar_stop (TV_PHASE_OPT_GEN); timevar_start (TV_PHASE_CHECK_DBGINFO); @@ -4701,4 +4719,23 @@ mark_used (tree decl) return true; } +tree +vtv_start_verification_constructor_init_function (void) +{ + return start_objects ('I', MAX_RESERVED_INIT_PRIORITY - 1); +} + +tree +vtv_finish_verification_constructor_init_function (tree function_body) +{ + tree fn; + + finish_compound_stmt (function_body); + fn = finish_function (0); + DECL_STATIC_CONSTRUCTOR (fn) = 1; + decl_init_priority_insert (fn, MAX_RESERVED_INIT_PRIORITY - 1); + + return fn; +} + #include "gt-cp-decl2.h" diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c index b896eead001..d33afea2414 100644 --- a/gcc/cp/g++spec.c +++ b/gcc/cp/g++spec.c @@ -50,6 +50,12 @@ along with GCC; see the file COPYING3. If not see #define LIBSTDCXX_STATIC NULL #endif +/* Link commands for linking in libvtv_inint when doing vtable + verification. */ + +#define VTABLE_LOAD_MODULE_INIT "--whole-archive,-lvtv_init,--no-whole-archive" +#define VTABLE_LOAD_MODULE_PREINIT "-lvtv_init" + void lang_specific_driver (struct cl_decoded_option **in_decoded_options, unsigned int *in_decoded_options_count, @@ -111,6 +117,11 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* The total number of arguments with the new stuff. */ unsigned int num_args = 1; + /* The command line contains a -fvtable_verify. We need to add the + init library if we are linking and if we are adding the stdc++ + library. */ + int saw_vtable_verify = 0; + argc = *in_decoded_options_count; decoded_options = *in_decoded_options; added_libraries = *in_added_libraries; @@ -236,6 +247,14 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, } } break; + + case OPT_fvtable_verify_: + if (strcmp (arg, "std") == 0) + saw_vtable_verify = 1; + else if (strcmp (arg, "preinit") == 0) + saw_vtable_verify = 2; + break; + } } @@ -247,6 +266,12 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* Add one for shared_libgcc or extra static library. */ num_args = argc + added + need_math + (library > 0) * 4 + 1; + + /* Add two more linker args, '-Wl,-u_vtable_map_vars_start and + '-Wl,-u_vtable_map_vars_end. */ + if (saw_vtable_verify && library > 0) + num_args += 2; + new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args); i = 0; @@ -309,6 +334,40 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, j++; } + /* Add option to make sure that if we are doing vtable + verification then we link with the libvtv_init library. */ + + if (saw_vtable_verify == 1 && library > 0) + { + generate_option(OPT_Wl_, VTABLE_LOAD_MODULE_INIT, 1, + CL_DRIVER, &new_decoded_options[j]); + added_libraries++; + j++; + } + else if (saw_vtable_verify == 2 && library > 0) + { + generate_option(OPT_Wl_, VTABLE_LOAD_MODULE_PREINIT, 1, + CL_DRIVER, &new_decoded_options[j]); + added_libraries++; + j++; + } + + /* If we are doing vtable verification, make sure the linker does + not garbage-collect the special symbols that mark the start and + end of the ".vtable_map_vars" section in the binary. (See + comments in vtv_start.c and vtv_end.c for more details). */ + + if (saw_vtable_verify > 0 && library > 0) + { + generate_option (OPT_Wl_,"-u_vtable_map_vars_start", 1, + CL_DRIVER, &new_decoded_options[j]); + j++; + + generate_option (OPT_Wl_,"-u_vtable_map_vars_end", 1, + CL_DRIVER, &new_decoded_options[j]); + j++; + } + /* Add `-lstdc++' if we haven't already done so. */ if (library > 0) { diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 4edd150d913..ea1663276c4 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -43,7 +43,6 @@ static tree initializing_context (tree); static void expand_cleanup_for_base (tree, tree); static tree dfs_initialize_vtbl_ptrs (tree, void *); static tree build_field_list (tree, tree, int *); -static tree build_vtbl_address (tree); static int diagnose_uninitialized_cst_or_ref_member_1 (tree, tree, bool, bool); /* We are about to generate some complex initialization code. @@ -1098,7 +1097,7 @@ emit_mem_initializers (tree mem_inits) /* Returns the address of the vtable (i.e., the value that should be assigned to the vptr) for BINFO. */ -static tree +tree build_vtbl_address (tree binfo) { tree binfo_for = binfo; diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 8da62b5e969..7d7c3f5b4a4 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -3886,4 +3886,34 @@ write_java_integer_type_codes (const tree type) gcc_unreachable (); } +/* Given a CLASS_TYPE, such as a record for std::bad_exception this + function generates a mangled name for the vtable map variable of + the class type. For example, if the class type is + "std::bad_exception", the mangled name for the class is + "St13bad_exception". This function would generate the name + "_ZN4_VTVISt13bad_exceptionE12__vtable_mapE", which unmangles as: + "_VTV<std::bad_exception>::__vtable_map". */ + + +char * +get_mangled_vtable_map_var_name (tree class_type) +{ + char *var_name = NULL; + const char *prefix = "_ZN4_VTVI"; + const char *postfix = "E12__vtable_mapE"; + + gcc_assert (TREE_CODE (class_type) == RECORD_TYPE); + + tree class_id = DECL_ASSEMBLER_NAME (TYPE_NAME (class_type)); + unsigned int len = strlen (IDENTIFIER_POINTER (class_id)) + + strlen (prefix) + + strlen (postfix) + 1; + + var_name = (char *) xmalloc (len); + + sprintf (var_name, "%s%s%s", prefix, IDENTIFIER_POINTER (class_id), postfix); + + return var_name; +} + #include "gt-cp-mangle.h" diff --git a/gcc/flag-types.h b/gcc/flag-types.h index 4fc5d33348e..8eea9a67079 100644 --- a/gcc/flag-types.h +++ b/gcc/flag-types.h @@ -191,4 +191,10 @@ enum fp_contract_mode { FP_CONTRACT_FAST = 2 }; +/* flag_vtable_verify initialization levels. */ +enum vtv_priority { + VTV_NO_PRIORITY = 0, /* i.E. Do NOT do vtable verification. */ + VTV_STANDARD_PRIORITY = 1, + VTV_PREINIT_PRIORITY = 2 +}; #endif /* ! GCC_FLAG_TYPES_H */ diff --git a/gcc/output.h b/gcc/output.h index cc48dfbed50..7b262566c2f 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -197,6 +197,10 @@ extern void assemble_end_function (tree, const char *); initial value (that will be done by the caller). */ extern void assemble_variable (tree, int, int, int); +/* Put the vtable verification constructor initialization function + into the preinit array. */ +extern void assemble_vtv_preinit_initializer (tree); + /* Compute the alignment of variable specified by DECL. DONT_OUTPUT_DATA is from assemble_variable. */ extern void align_variable (tree decl, bool dont_output_data); diff --git a/gcc/passes.c b/gcc/passes.c index feaf3226fac..b9f0edd451a 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1559,6 +1559,7 @@ init_optimization_passes (void) NEXT_PASS (pass_tm_memopt); NEXT_PASS (pass_tm_edges); } + NEXT_PASS (pass_vtable_verify); NEXT_PASS (pass_lower_vector); NEXT_PASS (pass_lower_complex_O0); NEXT_PASS (pass_asan_O0); diff --git a/gcc/timevar.def b/gcc/timevar.def index 44f0eac52c7..8ab9b99eadf 100644 --- a/gcc/timevar.def +++ b/gcc/timevar.def @@ -255,6 +255,7 @@ DEFTIMEVAR (TV_TREE_UNINIT , "uninit var analysis") DEFTIMEVAR (TV_PLUGIN_INIT , "plugin initialization") DEFTIMEVAR (TV_PLUGIN_RUN , "plugin execution") DEFTIMEVAR (TV_GIMPLE_SLSR , "straight-line strength reduction") +DEFTIMEVAR (TV_VTABLE_VERIFICATION , "vtable verification") /* Everything else in rest_of_compilation not included above. */ DEFTIMEVAR (TV_EARLY_LOCAL , "early local passes") diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index b8c59a742c2..72fc8cd55de 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -365,6 +365,7 @@ extern struct gimple_opt_pass pass_tm_edges; extern struct gimple_opt_pass pass_split_functions; extern struct gimple_opt_pass pass_feedback_split_functions; extern struct gimple_opt_pass pass_strength_reduction; +extern struct gimple_opt_pass pass_vtable_verify; /* IPA Passes */ extern struct simple_ipa_opt_pass pass_ipa_lower_emutls; diff --git a/gcc/tree.h b/gcc/tree.h index 1d2b252dec0..54abf25ade2 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -6491,6 +6491,9 @@ is_lang_specific (tree t) /* In gimple-low.c. */ extern bool block_may_fallthru (const_tree); +/* In vtable-verify.c. */ +extern void save_vtable_map_decl (tree); + /* Functional interface to the builtin functions. */ @@ -6581,4 +6584,5 @@ builtin_decl_implicit_p (enum built_in_function fncode) && builtin_info.implicit_p[uns_fncode]); } + #endif /* GCC_TREE_H */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 72bff5a8b9a..81552fe6fed 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2035,7 +2035,21 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED, assemble_noswitch_variable (decl, name, sect); else { - switch_to_section (sect); + if (sect->named.name + && (strcmp (sect->named.name, ".vtable_map_vars") == 0)) + { +#if defined (OBJECT_FORMAT_ELF) + targetm.asm_out.named_section (sect->named.name, + sect->named.common.flags + | SECTION_LINKONCE, + DECL_NAME (decl)); + in_section = sect; +#else + switch_to_section (sect); +#endif + } + else + switch_to_section (sect); if (DECL_ALIGN (decl) > BITS_PER_UNIT) ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (DECL_ALIGN_UNIT (decl))); assemble_variable_contents (decl, name, dont_output_data); @@ -2048,6 +2062,23 @@ assemble_variable (tree decl, int top_level ATTRIBUTE_UNUSED, } } + +/* Given a function declaration (FN_DECL), this function assembles the + function into the .preinit_array section. */ + +void +assemble_vtv_preinit_initializer (tree fn_decl) +{ + section *sect; + unsigned flags = SECTION_WRITE; + rtx symbol = XEXP (DECL_RTL (fn_decl), 0); + + flags |= SECTION_NOTYPE; + sect = get_section (".preinit_array", flags, fn_decl); + switch_to_section (sect); + assemble_addr_to_section (symbol, sect); +} + /* Return 1 if type TYPE contains any pointers. */ static int @@ -5997,6 +6028,9 @@ default_section_type_flags (tree decl, const char *name, int reloc) if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl)) flags |= SECTION_LINKONCE; + if (strcmp (name, ".vtable_map_vars") == 0) + flags |= SECTION_LINKONCE; + if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl)) flags |= SECTION_TLS | SECTION_WRITE; diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 990cd492770..8a9c1123fbc 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -39,6 +39,7 @@ enable_shared = @enable_shared@ double_type_size = @double_type_size@ long_double_type_size = @long_double_type_size@ decimal_float = @decimal_float@ +enable_vtable_verify = @enable_vtable_verify@ enable_decimal_float = @enable_decimal_float@ fixed_point = @fixed_point@ @@ -969,6 +970,22 @@ crtendS$(objext): $(srcdir)/crtstuff.c # This is a version of crtbegin for -static links. crtbeginT$(objext): $(srcdir)/crtstuff.c $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O + +ifeq ($(enable_vtable_verify),yes) +# These are used in vtable verification; see comments in source files for +# more details. +vtv_start$(objext): $(srcdir)/vtv_start.c + $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_start.c + +vtv_end$(objext): $(srcdir)/vtv_end.c + $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end.c + +vtv_start_preinit$(objext): $(srcdir)/vtv_start_preinit.c + $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_start_preinit.c + +vtv_end_preinit$(objext): $(srcdir)/vtv_end_preinit.c + $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end_preinit.c +endif endif ifeq ($(CUSTOM_CRTIN),) diff --git a/libgcc/config.host b/libgcc/config.host index 0247bb0106d..65c95ba49f8 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -197,7 +197,7 @@ case ${host} in ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux" - extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" + extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o vtv_start.o vtv_end.o vtv_start_preinit.o vtv_end_preinit.o" ;; *-*-lynxos*) tmake_file="$tmake_file t-lynx $cpu_type/t-crtstuff t-crtstuff-pic t-libgcc-pic" diff --git a/libgcc/configure b/libgcc/configure index bb36889ae56..29fa46f597a 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -608,6 +608,7 @@ build_os build_vendor build_cpu build +enable_vtable_verify enable_shared libgcc_topdir target_alias @@ -655,6 +656,7 @@ with_target_subdir with_cross_host with_ld enable_shared +enable_vtable_verify enable_version_specific_runtime_libs with_slibdir enable_maintainer_mode @@ -1288,6 +1290,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-shared don't provide a shared libgcc + --enable-vtable-verify Enable vtable verification feature --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory --enable-maintainer-mode enable make rules and dependencies not useful (and @@ -2140,6 +2143,19 @@ fi +# Check whether --enable-vtable-verify was given. +if test "${enable_vtable_verify+set}" = set; then : + enableval=$enable_vtable_verify; case "$enableval" in + yes) enable_vtable_verify=yes ;; + no) enable_vtable_verify=no ;; + *) enable_vtable_verify=no;; + esac +else + enable_vtable_verify=no +fi + + + # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 diff --git a/libgcc/configure.ac b/libgcc/configure.ac index 8b7aba5823b..186cd6e9cd7 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -66,6 +66,16 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +AC_ARG_ENABLE(vtable-verify, +[ --enable-vtable-verify Enable vtable verification feature ], +[case "$enableval" in + yes) enable_vtable_verify=yes ;; + no) enable_vtable_verify=no ;; + *) enable_vtable_verify=no;; + esac], +[enable_vtable_verify=no]) +AC_SUBST(enable_vtable_verify) + GCC_PICFLAG AC_SUBST(PICFLAG) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 85e96a382ce..549498d787f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,47 @@ +2013-05-31 Caroline Tice <cmtice@google.com> + + * configure: Regenerate. + * src/Makefile.in: Regenerate. + * src/c++98/Makefile.am (EXTRA_VTV_LDFLAGS, LIBVTV_FLAGS, VTV_CXXFLAGS): + New definitions, conditioned on ENABLE_VTABLE_VERIFY. + (AM_CXXFLAGS): Add VTV_CXXFLAGS to list. + (CXXLINK): Add LIBVTV_FLAGS. + * src/c++11/Makefile.am: Ditto. + * src/c++98/Makefile.in: Regenerate. + * src/Makefile.am (libvtv__la_LIBADD): Add definition, conditioned on + ENABLE_VTABLE_VERIFY. + (LIBVTV_FLAGS): Add definition, conditioned on ENABLE_VTABLE_VERIFY. + (libstdc___la_LDFLAGS): Add 'Wl,-u_vtable_map_var_start, + -u_vtable_map_var_end' if ENABLE_VTABLE_VERIFY is true. + (AM_CXXFLAGS): Add VTV_CXXFLAGS. + (CXXLINK): Add LIBVTV_FLAGS. + * src/c++11/Makefile.in: Regenerate. + * configure.ac (predep_objects_CXX): Add libgcc/vtv_start.o, if + enable_vtable_verify is yes. + (postdep_objects_CXX): Add libgcc/vtv_end.o if enable_vtable_verify is + yes. + (GLIBCXX_ENABLE_VTABLE_VERIFY): New definition. + * libsupc++/vtv_set.h: New file. + * libsupc++/vtv_stubs.cc: New file. + * libsupc++/vtv_utils.cc: New file. + * libsupc++/vtv_utils.h: New file. + * libsupc++/vtv_init.cc: New file. + * libsupc++/vtv_malloc.cc: New file. + * libsupc++/Makefile.am (sources): Add vtv_rts.cc, vtv_malloc.cc and + vtv_utils.cc to the list. + (vtv_init_sources, vtv_stubs_soruces, libvtv_init_la_sources, + libvtv_stubs_la_sources): New definitions. + (toolexeclib_LTLIBRARIES): Add libvtv_init.la and libvtv_stubs.la + * libsupc++/Makefile.in: Regenerate. + * libsupc++/vtv_rts.cc: New file. + * libsupc++/vtv_malloc.h: New file. + * libsupc++/vtv_rts.h: New file. + * libsupc++/vtv_fail.h: New file. + * libsupc++/vtv_map.h: New file. + * config/abi/pre/gnu.ver: Add vtable verification runtime functions to + the list of globally visible symbols. + * acinclude.m4: Add GLIBCXX_ENABLE_VTABLE_VERIFY option and comments. + 2013-05-28 Jonathan Wakely <jwakely.gcc@gmail.com> * src/c++11/compatibility-chrono.cc (steady_clock::now()): If diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in index ab7caafed95..18549dc71a3 100644 --- a/libstdc++-v3/Makefile.in +++ b/libstdc++-v3/Makefile.in @@ -299,6 +299,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index d68768ed150..2fd1f1a6958 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -2285,6 +2285,25 @@ AC_DEFUN([GLIBCXX_ENABLE_EXTERN_TEMPLATE], [ ]) dnl +dnl Use vtable verification. +dnl +dnl --enable-vtable-verify defines _GLIBCXX_VTABLE_VERIFY to 1 +dnl --disable-vtable-verify defines _GLIBCXX_VTABLE_VERIFY to 0 + +dnl + Usage: GLIBCXX_ENABLE_VTABLE_VERIFY[(DEFAULT)] +dnl Where DEFAULT is `yes' or `no'. +dnl +AC_DEFUN([GLIBCXX_ENABLE_VTABLE_VERIFY], [ + + GLIBCXX_ENABLE(vtable-verify,$1,,[enable vtable verify]) + + AC_MSG_CHECKING([for vtable verify support]) + AC_MSG_RESULT([$enable_vtable_verify]) + + GLIBCXX_CONDITIONAL(ENABLE_VTABLE_VERIFY, test $enable_vtable_verify = yes) +]) + +dnl dnl Check for parallel mode pre-requisites, including OpenMP support. dnl dnl + Usage: GLIBCXX_ENABLE_PARALLEL diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 9e1f4da1589..604e061f337 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -1336,6 +1336,20 @@ GLIBCXX_3.4.18 { std::__detail::_Prime_rehash_policy::*; }; + # Virtual table verification symbols + _Z12__VLTprotectv; + _Z14__VLTunprotectv; + _Z17__VLTRegisterPair*; + _Z22__VLTRegisterPairDebug*; + _Z16__VLTRegisterSet*; + _Z21__VLTRegisterSetDebug*; + _Z24__VLTVerifyVtablePointer*; + _Z29__VLTVerifyVtablePointerDebug*; + _Z17__vtv_verify_fail*; + _Z17__vtv_really_fail*; + _Z14__VLTDumpStats*; + __VLTChangePermission; + # std::this_thread::__sleep_for _ZNSt11this_thread11__sleep_for*; diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 994fbe320e0..87186532891 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -664,6 +664,8 @@ LIBICONV OPT_LDFLAGS SECTION_LDFLAGS GLIBCXX_LIBS +ENABLE_VTABLE_VERIFY_FALSE +ENABLE_VTABLE_VERIFY_TRUE ENABLE_WERROR_FALSE ENABLE_WERROR_TRUE ENABLE_PYTHONDIR_FALSE @@ -866,6 +868,7 @@ enable_fully_dynamic_string enable_extern_template with_python_dir enable_werror +enable_vtable_verify enable_libstdcxx_time enable_tls enable_rpath @@ -1558,6 +1561,7 @@ Optional Features: --enable-extern-template enable extern template [default=yes] --enable-werror turns on -Werror [default=yes] + --enable-vtable-verify enable vtable verify [default=no] --enable-libstdcxx-time[=KIND] use KIND for check type [default=auto] --enable-tls Use thread-local storage [default=yes] @@ -11513,7 +11517,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11516 "configure" +#line 11520 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11619,7 +11623,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11622 "configure" +#line 11626 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14906,6 +14910,12 @@ esac +if test "$enable_vtable_verify" = yes; then + predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o" + postdep_objects_CXX="${postdep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_end.o" +fi + + # libtool variables for C++ shared and position-independent compiles. # # Use glibcxx_lt_pic_flag to designate the automake variable @@ -15033,7 +15043,7 @@ fi # # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. cat > conftest.$ac_ext << EOF -#line 15036 "configure" +#line 15046 "configure" struct S { ~S(); }; void bar(); void foo() @@ -15383,7 +15393,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 15386 "configure" +#line 15396 "configure" int main() { typedef bool atomic_type; @@ -15418,7 +15428,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15421 "configure" +#line 15431 "configure" int main() { typedef short atomic_type; @@ -15453,7 +15463,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15456 "configure" +#line 15466 "configure" int main() { // NB: _Atomic_word not necessarily int. @@ -15489,7 +15499,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15492 "configure" +#line 15502 "configure" int main() { typedef long long atomic_type; @@ -15568,7 +15578,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15571 "configure" +#line 15581 "configure" int main() { _Decimal32 d1; @@ -15610,7 +15620,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15613 "configure" +#line 15623 "configure" template<typename T1, typename T2> struct same { typedef T2 type; }; @@ -15644,7 +15654,7 @@ $as_echo "$enable_int128" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15647 "configure" +#line 15657 "configure" template<typename T1, typename T2> struct same { typedef T2 type; }; @@ -17379,6 +17389,29 @@ $as_echo "$enable_werror" >&6; } + + # Check whether --enable-vtable-verify was given. +if test "${enable_vtable_verify+set}" = set; then : + enableval=$enable_vtable_verify; + case "$enableval" in + yes|no) ;; + *) as_fn_error "Argument to enable/disable vtable-verify must be yes or no" "$LINENO" 5 ;; + esac + +else + enable_vtable_verify=no +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vtable verify support" >&5 +$as_echo_n "checking for vtable verify support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_vtable_verify" >&5 +$as_echo "$enable_vtable_verify" >&6; } + + + + # Checks for operating systems support that doesn't require linking. @@ -72960,6 +72993,15 @@ else fi + if test $enable_vtable_verify = yes; then + ENABLE_VTABLE_VERIFY_TRUE= + ENABLE_VTABLE_VERIFY_FALSE='#' +else + ENABLE_VTABLE_VERIFY_TRUE='#' + ENABLE_VTABLE_VERIFY_FALSE= +fi + + if test $enable_symvers != no; then ENABLE_SYMVERS_TRUE= ENABLE_SYMVERS_FALSE='#' @@ -73403,6 +73445,10 @@ if test -z "${ENABLE_WERROR_TRUE}" && test -z "${ENABLE_WERROR_FALSE}"; then as_fn_error "conditional \"ENABLE_WERROR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_VTABLE_VERIFY_TRUE}" && test -z "${ENABLE_VTABLE_VERIFY_FALSE}"; then + as_fn_error "conditional \"ENABLE_VTABLE_VERIFY\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_SYMVERS_TRUE}" && test -z "${ENABLE_SYMVERS_FALSE}"; then as_fn_error "conditional \"ENABLE_SYMVERS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index f6ba176d2a8..dd13b011f97 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -97,6 +97,12 @@ ACX_LT_HOST_FLAGS AC_SUBST(enable_shared) AC_SUBST(enable_static) +if test "$enable_vtable_verify" = yes; then + predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o" + postdep_objects_CXX="${postdep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_end.o" +fi + + # libtool variables for C++ shared and position-independent compiles. # # Use glibcxx_lt_pic_flag to designate the automake variable @@ -168,6 +174,7 @@ GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no]) GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes]) GLIBCXX_ENABLE_PYTHON GLIBCXX_ENABLE_WERROR([yes]) +GLIBCXX_ENABLE_VTABLE_VERIFY([no]) # Checks for operating systems support that doesn't require linking. GLIBCXX_CHECK_STDIO_PROTO diff --git a/libstdc++-v3/doc/Makefile.in b/libstdc++-v3/doc/Makefile.in index 9816fc80200..799bd327bd3 100644 --- a/libstdc++-v3/doc/Makefile.in +++ b/libstdc++-v3/doc/Makefile.in @@ -281,6 +281,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. diff --git a/libstdc++-v3/fragment.am b/libstdc++-v3/fragment.am index 5b1d503a6d7..79b011e80ae 100644 --- a/libstdc++-v3/fragment.am +++ b/libstdc++-v3/fragment.am @@ -19,6 +19,21 @@ else WERROR_FLAG= endif +if ENABLE_EXTERN_TEMPLATE +XTEMPLATE_FLAGS = -fno-implicit-templates +else +XTEMPLATE_FLAGS = +endif + +if ENABLE_VTABLE_VERIFY +VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +VTV_CXXFLAGS = -fvtable-verify=std \ + -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end +else +VTV_CXXLINKFLAGS = +VTV_CXXFLAGS = +endif + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. CONFIG_CXXFLAGS = \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 2ba9433bd7d..9972eeccb09 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -271,6 +271,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am index b4e86f53144..0a76e5f3986 100644 --- a/libstdc++-v3/libsupc++/Makefile.am +++ b/libstdc++-v3/libsupc++/Makefile.am @@ -25,7 +25,11 @@ include $(top_srcdir)/fragment.am # Need this library to both be part of libstdc++.a, and installed # separately too. # 1) separate libsupc++.la +if ENABLE_VTABLE_VERIFY +toolexeclib_LTLIBRARIES = libsupc++.la libvtv_init.la libvtv_stubs.la +else toolexeclib_LTLIBRARIES = libsupc++.la +endif # 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a noinst_LTLIBRARIES = libsupc++convenience.la @@ -96,6 +100,22 @@ sources = \ vmi_class_type_info.cc \ vterminate.cc +if ENABLE_VTABLE_VERIFY + sources += \ + vtv_rts.cc \ + vtv_malloc.cc \ + vtv_utils.cc + + vtv_init_sources = \ + vtv_init.cc + + vtv_stubs_sources = \ + vtv_stubs.cc + + libvtv_init_la_SOURCES = $(vtv_init_sources) + libvtv_stubs_la_SOURCES = $(vtv_stubs_sources) +endif + libsupc___la_SOURCES = $(sources) $(c_sources) libsupc__convenience_la_SOURCES = $(sources) $(c_sources) diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 0f2c1ee2637..ed5516ef866 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -38,6 +38,11 @@ host_triplet = @host@ target_triplet = @target@ DIST_COMMON = $(top_srcdir)/fragment.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(bits_HEADERS) $(std_HEADERS) +@ENABLE_VTABLE_VERIFY_TRUE@am__append_1 = \ +@ENABLE_VTABLE_VERIFY_TRUE@ vtv_rts.cc \ +@ENABLE_VTABLE_VERIFY_TRUE@ vtv_malloc.cc \ +@ENABLE_VTABLE_VERIFY_TRUE@ vtv_utils.cc + subdir = libsupc++ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ @@ -91,7 +96,9 @@ am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(bitsdir)" \ "$(DESTDIR)$(stddir)" LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES) libsupc___la_LIBADD = -am__objects_1 = array_type_info.lo atexit_arm.lo atexit_thread.lo \ +@ENABLE_VTABLE_VERIFY_TRUE@am__objects_1 = vtv_rts.lo vtv_malloc.lo \ +@ENABLE_VTABLE_VERIFY_TRUE@ vtv_utils.lo +am__objects_2 = array_type_info.lo atexit_arm.lo atexit_thread.lo \ bad_alloc.lo bad_array_length.lo bad_array_new.lo bad_cast.lo \ bad_typeid.lo class_type_info.lo del_op.lo del_opnt.lo \ del_opv.lo del_opvnt.lo dyncast.lo eh_alloc.lo eh_arm.lo \ @@ -103,14 +110,33 @@ am__objects_1 = array_type_info.lo atexit_arm.lo atexit_thread.lo \ nested_exception.lo new_handler.lo new_op.lo new_opnt.lo \ new_opv.lo new_opvnt.lo pbase_type_info.lo pmem_type_info.lo \ pointer_type_info.lo pure.lo si_class_type_info.lo tinfo.lo \ - tinfo2.lo vec.lo vmi_class_type_info.lo vterminate.lo -@GLIBCXX_HOSTED_TRUE@am__objects_2 = cp-demangle.lo -am_libsupc___la_OBJECTS = $(am__objects_1) $(am__objects_2) + tinfo2.lo vec.lo vmi_class_type_info.lo vterminate.lo \ + $(am__objects_1) +@GLIBCXX_HOSTED_TRUE@am__objects_3 = cp-demangle.lo +am_libsupc___la_OBJECTS = $(am__objects_2) $(am__objects_3) libsupc___la_OBJECTS = $(am_libsupc___la_OBJECTS) +@ENABLE_VTABLE_VERIFY_FALSE@am_libsupc___la_rpath = -rpath \ +@ENABLE_VTABLE_VERIFY_FALSE@ $(toolexeclibdir) +@ENABLE_VTABLE_VERIFY_TRUE@am_libsupc___la_rpath = -rpath \ +@ENABLE_VTABLE_VERIFY_TRUE@ $(toolexeclibdir) libsupc__convenience_la_LIBADD = -am_libsupc__convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2) +am_libsupc__convenience_la_OBJECTS = $(am__objects_2) $(am__objects_3) libsupc__convenience_la_OBJECTS = \ $(am_libsupc__convenience_la_OBJECTS) +libvtv_init_la_LIBADD = +@ENABLE_VTABLE_VERIFY_TRUE@am__objects_4 = vtv_init.lo +@ENABLE_VTABLE_VERIFY_TRUE@am_libvtv_init_la_OBJECTS = \ +@ENABLE_VTABLE_VERIFY_TRUE@ $(am__objects_4) +libvtv_init_la_OBJECTS = $(am_libvtv_init_la_OBJECTS) +@ENABLE_VTABLE_VERIFY_TRUE@am_libvtv_init_la_rpath = -rpath \ +@ENABLE_VTABLE_VERIFY_TRUE@ $(toolexeclibdir) +libvtv_stubs_la_LIBADD = +@ENABLE_VTABLE_VERIFY_TRUE@am__objects_5 = vtv_stubs.lo +@ENABLE_VTABLE_VERIFY_TRUE@am_libvtv_stubs_la_OBJECTS = \ +@ENABLE_VTABLE_VERIFY_TRUE@ $(am__objects_5) +libvtv_stubs_la_OBJECTS = $(am_libvtv_stubs_la_OBJECTS) +@ENABLE_VTABLE_VERIFY_TRUE@am_libvtv_stubs_la_rpath = -rpath \ +@ENABLE_VTABLE_VERIFY_TRUE@ $(toolexeclibdir) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = am__depfiles_maybe = @@ -123,7 +149,8 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) -SOURCES = $(libsupc___la_SOURCES) $(libsupc__convenience_la_SOURCES) +SOURCES = $(libsupc___la_SOURCES) $(libsupc__convenience_la_SOURCES) \ + $(libvtv_init_la_SOURCES) $(libvtv_stubs_la_SOURCES) HEADERS = $(bits_HEADERS) $(std_HEADERS) ETAGS = etags CTAGS = ctags @@ -331,6 +358,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. @@ -343,11 +378,12 @@ WARN_CXXFLAGS = \ # -I/-D flags to pass when compiling. AM_CPPFLAGS = $(GLIBCXX_INCLUDES) +@ENABLE_VTABLE_VERIFY_FALSE@toolexeclib_LTLIBRARIES = libsupc++.la # Need this library to both be part of libstdc++.a, and installed # separately too. # 1) separate libsupc++.la -toolexeclib_LTLIBRARIES = libsupc++.la +@ENABLE_VTABLE_VERIFY_TRUE@toolexeclib_LTLIBRARIES = libsupc++.la libvtv_init.la libvtv_stubs.la # 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a noinst_LTLIBRARIES = libsupc++convenience.la std_HEADERS = \ @@ -361,59 +397,28 @@ headers = $(std_HEADERS) $(bits_HEADERS) @GLIBCXX_HOSTED_TRUE@c_sources = \ @GLIBCXX_HOSTED_TRUE@ cp-demangle.c -sources = \ - array_type_info.cc \ - atexit_arm.cc \ - atexit_thread.cc \ - bad_alloc.cc \ - bad_array_length.cc \ - bad_array_new.cc \ - bad_cast.cc \ - bad_typeid.cc \ - class_type_info.cc \ - del_op.cc \ - del_opnt.cc \ - del_opv.cc \ - del_opvnt.cc \ - dyncast.cc \ - eh_alloc.cc \ - eh_arm.cc \ - eh_aux_runtime.cc \ - eh_call.cc \ - eh_catch.cc \ - eh_exception.cc \ - eh_globals.cc \ - eh_personality.cc \ - eh_ptr.cc \ - eh_term_handler.cc \ - eh_terminate.cc \ - eh_tm.cc \ - eh_throw.cc \ - eh_type.cc \ - eh_unex_handler.cc \ - enum_type_info.cc \ - function_type_info.cc \ - fundamental_type_info.cc \ - guard.cc \ - guard_error.cc \ - hash_bytes.cc \ - nested_exception.cc \ - new_handler.cc \ - new_op.cc \ - new_opnt.cc \ - new_opv.cc \ - new_opvnt.cc \ - pbase_type_info.cc \ - pmem_type_info.cc \ - pointer_type_info.cc \ - pure.cc \ - si_class_type_info.cc \ - tinfo.cc \ - tinfo2.cc \ - vec.cc \ - vmi_class_type_info.cc \ - vterminate.cc - +sources = array_type_info.cc atexit_arm.cc atexit_thread.cc \ + bad_alloc.cc bad_array_length.cc bad_array_new.cc bad_cast.cc \ + bad_typeid.cc class_type_info.cc del_op.cc del_opnt.cc \ + del_opv.cc del_opvnt.cc dyncast.cc eh_alloc.cc eh_arm.cc \ + eh_aux_runtime.cc eh_call.cc eh_catch.cc eh_exception.cc \ + eh_globals.cc eh_personality.cc eh_ptr.cc eh_term_handler.cc \ + eh_terminate.cc eh_tm.cc eh_throw.cc eh_type.cc \ + eh_unex_handler.cc enum_type_info.cc function_type_info.cc \ + fundamental_type_info.cc guard.cc guard_error.cc hash_bytes.cc \ + nested_exception.cc new_handler.cc new_op.cc new_opnt.cc \ + new_opv.cc new_opvnt.cc pbase_type_info.cc pmem_type_info.cc \ + pointer_type_info.cc pure.cc si_class_type_info.cc tinfo.cc \ + tinfo2.cc vec.cc vmi_class_type_info.cc vterminate.cc \ + $(am__append_1) +@ENABLE_VTABLE_VERIFY_TRUE@vtv_init_sources = \ +@ENABLE_VTABLE_VERIFY_TRUE@ vtv_init.cc + +@ENABLE_VTABLE_VERIFY_TRUE@vtv_stubs_sources = \ +@ENABLE_VTABLE_VERIFY_TRUE@ vtv_stubs.cc + +@ENABLE_VTABLE_VERIFY_TRUE@libvtv_init_la_SOURCES = $(vtv_init_sources) +@ENABLE_VTABLE_VERIFY_TRUE@libvtv_stubs_la_SOURCES = $(vtv_stubs_sources) libsupc___la_SOURCES = $(sources) $(c_sources) libsupc__convenience_la_SOURCES = $(sources) $(c_sources) @@ -574,9 +579,13 @@ clean-toolexeclibLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done libsupc++.la: $(libsupc___la_OBJECTS) $(libsupc___la_DEPENDENCIES) - $(CXXLINK) -rpath $(toolexeclibdir) $(libsupc___la_OBJECTS) $(libsupc___la_LIBADD) $(LIBS) + $(CXXLINK) $(am_libsupc___la_rpath) $(libsupc___la_OBJECTS) $(libsupc___la_LIBADD) $(LIBS) libsupc++convenience.la: $(libsupc__convenience_la_OBJECTS) $(libsupc__convenience_la_DEPENDENCIES) $(CXXLINK) $(libsupc__convenience_la_OBJECTS) $(libsupc__convenience_la_LIBADD) $(LIBS) +libvtv_init.la: $(libvtv_init_la_OBJECTS) $(libvtv_init_la_DEPENDENCIES) + $(CXXLINK) $(am_libvtv_init_la_rpath) $(libvtv_init_la_OBJECTS) $(libvtv_init_la_LIBADD) $(LIBS) +libvtv_stubs.la: $(libvtv_stubs_la_OBJECTS) $(libvtv_stubs_la_DEPENDENCIES) + $(CXXLINK) $(am_libvtv_stubs_la_rpath) $(libvtv_stubs_la_OBJECTS) $(libvtv_stubs_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in index bb0f5908436..c04a87e8071 100644 --- a/libstdc++-v3/po/Makefile.in +++ b/libstdc++-v3/po/Makefile.in @@ -271,6 +271,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in index 49f71a1175e..f69b6a75182 100644 --- a/libstdc++-v3/python/Makefile.in +++ b/libstdc++-v3/python/Makefile.in @@ -295,6 +295,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. diff --git a/libstdc++-v3/scripts/testsuite_flags.in b/libstdc++-v3/scripts/testsuite_flags.in index d7710ca70ec..a1fe07766ab 100755 --- a/libstdc++-v3/scripts/testsuite_flags.in +++ b/libstdc++-v3/scripts/testsuite_flags.in @@ -56,7 +56,8 @@ case ${query} in --cxxflags) CXXFLAGS_default="-D_GLIBCXX_ASSERT -fmessage-length=0" CXXFLAGS_config="@SECTION_FLAGS@ @CXXFLAGS@ @EXTRA_CXX_FLAGS@" - echo ${CXXFLAGS_default} ${CXXFLAGS_config} + CXXFLAGS_vtv="-Wl,--whole-archive -lvtv_init -Wl,--no-whole-archive" + echo ${CXXFLAGS_default} ${CXXFLAGS_config} ${CXXFLAGS_vtv} ;; --cxxparallelflags) CXXFLAGS_parallel="-D_GLIBCXX_PARALLEL -fopenmp diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 092fd1bd581..f817470e8cd 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -67,12 +67,25 @@ libstdc___la_DEPENDENCIES = \ $(top_builddir)/src/c++98/libc++98convenience.la \ $(top_builddir)/src/c++11/libc++11convenience.la +#if ENABLE_VTABLE_VERIFY +#libstdc___la_LDFLAGS = \ +# -version-info $(libtool_VERSION) ${version_arg} -lm -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end +# +#libvtv___la_LIBADD = \ +# $(top_builddir)/libsupc++/.libs +#LIBVTV_FLAGS = \ +# -L$(libvtv___la_LIBADD) --whole-archive -lvtv_init --no-whole-archive +#VTV_CXXFLAGS = -fvtable-verify=std +#else libstdc___la_LDFLAGS = \ -version-info $(libtool_VERSION) ${version_arg} -lm +#libvtv___la_LIBADD = +#LIBVTV_FLAGS = +#VTV_CXXFLAGS = +#endif libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) - # Use special rules for compatibility-ldbl.cc compilation, as we need to # pass -mlong-double-64. if GLIBCXX_LDBL_COMPAT @@ -132,7 +145,7 @@ compatibility-chrono.o: compatibility-chrono.cc # as the occasion calls for it. AM_CXXFLAGS = \ $(glibcxx_compiler_pic_flag) \ - $(XTEMPLATE_FLAGS) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) # Libtool notes @@ -179,8 +192,16 @@ CXXLINK = \ $(LIBTOOL) --tag CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXX) \ + $(VTV_CXXLINKFLAGS) \ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ +#CXXLINK = \ +# $(LIBTOOL) --tag CXX \ +# $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ +# --mode=link $(CXX) \ +# $(LIBVTV_FLAGS) \ +# $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + # Symbol versioning for shared libraries. if ENABLE_SYMVERS diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index a7b3404d0a6..c55e7566cc5 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -321,6 +321,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. @@ -367,9 +375,24 @@ libstdc___la_DEPENDENCIES = \ $(top_builddir)/src/c++98/libc++98convenience.la \ $(top_builddir)/src/c++11/libc++11convenience.la + +#if ENABLE_VTABLE_VERIFY +#libstdc___la_LDFLAGS = \ +# -version-info $(libtool_VERSION) ${version_arg} -lm -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end +# +#libvtv___la_LIBADD = \ +# $(top_builddir)/libsupc++/.libs +#LIBVTV_FLAGS = \ +# -L$(libvtv___la_LIBADD) --whole-archive -lvtv_init --no-whole-archive +#VTV_CXXFLAGS = -fvtable-verify=std +#else libstdc___la_LDFLAGS = \ -version-info $(libtool_VERSION) ${version_arg} -lm +#libvtv___la_LIBADD = +#LIBVTV_FLAGS = +#VTV_CXXFLAGS = +#endif libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) # A note on compatibility and static libraries. @@ -401,7 +424,7 @@ libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) # as the occasion calls for it. AM_CXXFLAGS = \ $(glibcxx_compiler_pic_flag) \ - $(XTEMPLATE_FLAGS) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) @@ -449,6 +472,7 @@ CXXLINK = \ $(LIBTOOL) --tag CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXX) \ + $(VTV_CXXLINKFLAGS) \ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ @ENABLE_SYMVERS_TRUE@CLEANFILES = libstdc++-symbols.ver $(version_dep) diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am index e7b48acef46..6dbdccd333e 100644 --- a/libstdc++-v3/src/c++11/Makefile.am +++ b/libstdc++-v3/src/c++11/Makefile.am @@ -46,13 +46,13 @@ sources = \ thread.cc if ENABLE_EXTERN_TEMPLATE -XTEMPLATE_FLAGS = -fno-implicit-templates +# XTEMPLATE_FLAGS = -fno-implicit-templates inst_sources = \ fstream-inst.cc \ string-inst.cc \ wstring-inst.cc else -XTEMPLATE_FLAGS = +# XTEMPLATE_FLAGS = inst_sources = endif @@ -60,6 +60,22 @@ vpath % $(top_srcdir)/src/c++11 libc__11convenience_la_SOURCES = $(sources) $(inst_sources) +# We need to add this here because even thought the GCC driver normally would +# add the flags below when doing a vtable-verification build, the driver +# flags do not appear to be used when building the C++ std library. + +#if ENABLE_VTABLE_VERIFY +#EXTRA_VTV_LDFLAGS = \ +# -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end +#LIBVTV_FLAGS = \ +# -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +#VTV_CXXFLAGS = -fvtable-verify=std $(EXTRA_VTV_LDFLAGS) +#else +#EXTRA_VTV_LDFLAGS = +#LIBVTV_FLAGS = +#VTV_CXXFLAGS = +#endif + # Use special rules for the hashtable.cc file so that all # the generated template functions are also instantiated. hashtable_c++0x.lo: hashtable_c++0x.cc @@ -75,7 +91,7 @@ hashtable_c++0x.o: hashtable_c++0x.cc AM_CXXFLAGS = \ -std=gnu++11 \ $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ - $(XTEMPLATE_FLAGS) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) AM_MAKEFLAGS = \ @@ -125,4 +141,5 @@ CXXLINK = \ $(LIBTOOL) --tag CXX --tag disable-shared \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXX) \ + $(VTV_CXXLINKFLAGS) \ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in index a410748a4b8..b0f3bf42570 100644 --- a/libstdc++-v3/src/c++11/Makefile.in +++ b/libstdc++-v3/src/c++11/Makefile.in @@ -288,6 +288,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. @@ -322,9 +330,10 @@ sources = \ system_error.cc \ thread.cc -@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = -@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +# XTEMPLATE_FLAGS = @ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources = + +# XTEMPLATE_FLAGS = -fno-implicit-templates @ENABLE_EXTERN_TEMPLATE_TRUE@inst_sources = \ @ENABLE_EXTERN_TEMPLATE_TRUE@ fstream-inst.cc \ @ENABLE_EXTERN_TEMPLATE_TRUE@ string-inst.cc \ @@ -340,7 +349,7 @@ libc__11convenience_la_SOURCES = $(sources) $(inst_sources) AM_CXXFLAGS = \ -std=gnu++11 \ $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ - $(XTEMPLATE_FLAGS) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) AM_MAKEFLAGS = \ @@ -391,6 +400,7 @@ CXXLINK = \ $(LIBTOOL) --tag CXX --tag disable-shared \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXX) \ + $(VTV_CXXLINKFLAGS) \ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ all: all-am @@ -627,6 +637,22 @@ uninstall-am: vpath % $(top_srcdir)/src/c++11 +# We need to add this here because even thought the GCC driver normally would +# add the flags below when doing a vtable-verification build, the driver +# flags do not appear to be used when building the C++ std library. + +#if ENABLE_VTABLE_VERIFY +#EXTRA_VTV_LDFLAGS = \ +# -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end +#LIBVTV_FLAGS = \ +# -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +#VTV_CXXFLAGS = -fvtable-verify=std $(EXTRA_VTV_LDFLAGS) +#else +#EXTRA_VTV_LDFLAGS = +#LIBVTV_FLAGS = +#VTV_CXXFLAGS = +#endif + # Use special rules for the hashtable.cc file so that all # the generated template functions are also instantiated. hashtable_c++0x.lo: hashtable_c++0x.cc diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am index 2f33b964af9..17fbca7df79 100644 --- a/libstdc++-v3/src/c++98/Makefile.am +++ b/libstdc++-v3/src/c++98/Makefile.am @@ -82,7 +82,7 @@ basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC) if ENABLE_EXTERN_TEMPLATE -XTEMPLATE_FLAGS = -fno-implicit-templates +# XTEMPLATE_FLAGS = -fno-implicit-templates inst_sources = \ allocator-inst.cc \ concept-inst.cc \ @@ -97,7 +97,7 @@ inst_sources = \ streambuf-inst.cc \ wlocale-inst.cc else -XTEMPLATE_FLAGS = +# XTEMPLATE_FLAGS = inst_sources = endif @@ -142,6 +142,22 @@ vpath % $(top_srcdir)/src/c++98 libc__98convenience_la_SOURCES = $(sources) +# We need to add this here because even thought the GCC driver normally would +# add the flags below when doing a vtable-verification build, the driver +# flags do not appear to be used when building the C++ std library. + +#if ENABLE_VTABLE_VERIFY +#EXTRA_VTV_LDFLAGS = \ +# -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end +#LIBVTV_FLAGS = \ +# -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +#VTV_CXXFLAGS = -fvtable-verify=std $(EXTRA_VTV_LDFLAGS) +#else +#EXTRA_VTV_LDFLAGS = +#LIBVTV_FLAGS = +#VTV_CXXFLAGS = +#endif + # Use special rules for the deprecated source files so that they find # deprecated include files. GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include @@ -172,7 +188,7 @@ parallel_settings.o: parallel_settings.cc # as the occasion calls for it. AM_CXXFLAGS = \ $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ - $(XTEMPLATE_FLAGS) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) AM_MAKEFLAGS = \ @@ -222,4 +238,5 @@ CXXLINK = \ $(LIBTOOL) --tag CXX --tag disable-shared \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXX) \ + $(VTV_CXXLINKFLAGS) \ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in index d154b983922..a6af8002619 100644 --- a/libstdc++-v3/src/c++98/Makefile.in +++ b/libstdc++-v3/src/c++98/Makefile.in @@ -304,6 +304,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. @@ -342,9 +350,10 @@ host_sources_extra = \ basic_file.cc c++locale.cc \ ${inst_sources} ${parallel_sources} -@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = -@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +# XTEMPLATE_FLAGS = @ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources = + +# XTEMPLATE_FLAGS = -fno-implicit-templates @ENABLE_EXTERN_TEMPLATE_TRUE@inst_sources = \ @ENABLE_EXTERN_TEMPLATE_TRUE@ allocator-inst.cc \ @ENABLE_EXTERN_TEMPLATE_TRUE@ concept-inst.cc \ @@ -398,6 +407,22 @@ sources = \ libc__98convenience_la_SOURCES = $(sources) +# We need to add this here because even thought the GCC driver normally would +# add the flags below when doing a vtable-verification build, the driver +# flags do not appear to be used when building the C++ std library. + +#if ENABLE_VTABLE_VERIFY +#EXTRA_VTV_LDFLAGS = \ +# -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end +#LIBVTV_FLAGS = \ +# -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +#VTV_CXXFLAGS = -fvtable-verify=std $(EXTRA_VTV_LDFLAGS) +#else +#EXTRA_VTV_LDFLAGS = +#LIBVTV_FLAGS = +#VTV_CXXFLAGS = +#endif + # Use special rules for the deprecated source files so that they find # deprecated include files. GLIBCXX_INCLUDE_DIR = $(glibcxx_builddir)/include @@ -412,7 +437,7 @@ PARALLEL_FLAGS = -D_GLIBCXX_PARALLEL # as the occasion calls for it. AM_CXXFLAGS = \ $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \ - $(XTEMPLATE_FLAGS) \ + $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) AM_MAKEFLAGS = \ @@ -463,6 +488,7 @@ CXXLINK = \ $(LIBTOOL) --tag CXX --tag disable-shared \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXX) \ + $(VTV_CXXLINKFLAGS) \ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ all: all-am diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in index 96b3f9f4b1a..7678f7b139d 100644 --- a/libstdc++-v3/testsuite/Makefile.in +++ b/libstdc++-v3/testsuite/Makefile.in @@ -274,6 +274,14 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) @ENABLE_WERROR_FALSE@WERROR_FLAG = @ENABLE_WERROR_TRUE@WERROR_FLAG = $(WERROR) +@ENABLE_EXTERN_TEMPLATE_FALSE@XTEMPLATE_FLAGS = +@ENABLE_EXTERN_TEMPLATE_TRUE@XTEMPLATE_FLAGS = -fno-implicit-templates +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXLINKFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXLINKFLAGS = -L$(top_builddir)/libsupc++/.libs --whole-archive -lvtv_init --no-whole-archive +@ENABLE_VTABLE_VERIFY_FALSE@VTV_CXXFLAGS = +@ENABLE_VTABLE_VERIFY_TRUE@VTV_CXXFLAGS = -fvtable-verify=std \ +@ENABLE_VTABLE_VERIFY_TRUE@ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end + # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. |