platform/upstream/linaro-gcc.git
6 years agouse-after-scope fallout 82/189282/2
marxin [Tue, 8 Nov 2016 12:28:33 +0000 (12:28 +0000)]
use-after-scope fallout

PR testsuite/78242
* g++.dg/asan/use-after-scope-4.C: New test.
* g++.dg/asan/use-after-scope-types-4.C: Update scanned pattern.
* gcc.dg/asan/use-after-scope-8.c: Remove.
PR testsuite/78242
* dbgcnt.def: Add new debug counter asan_use_after_scope.
* gimplify.c (gimplify_decl_expr): Do not sanitize vars
with a value expr.  Do not add artificial variables to
live_switch_vars.  Use the debug counter.
(gimplify_target_expr): Use the debug counter.
* internal-fn.def: Remove ECF_TM_PURE from ASAN_MARK builtin.
* sanitizer.def: Set ATTR_NOTHROW_LEAF_LIST to
BUILT_IN_ASAN_CLOBBER_N and BUILT_IN_ASAN_UNCLOBBER_N.

upstream hash: d71fcb4d6c78c38912a87df7e0aa09407b691f79
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241961 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I9e5609ee7f9015cfd0951ad8aedd1437d90dca9d

6 years agoIntroduce tests for -fsanitize-address-use-after-scope 81/189281/2
marxin [Mon, 7 Nov 2016 10:25:18 +0000 (10:25 +0000)]
Introduce tests for -fsanitize-address-use-after-scope

* c-c++-common/asan/force-inline-opt0-1.c: Disable
-f-sanitize-address-use-after-scope.
* c-c++-common/asan/inc.c: Change number of expected ASAN_CHECK
internal fn calls.
* g++.dg/asan/use-after-scope-1.C: New test.
* g++.dg/asan/use-after-scope-2.C: Likewise.
* g++.dg/asan/use-after-scope-3.C: Likewise.
* g++.dg/asan/use-after-scope-types-1.C: Likewise.
* g++.dg/asan/use-after-scope-types-2.C: Likewise.
* g++.dg/asan/use-after-scope-types-3.C: Likewise.
* g++.dg/asan/use-after-scope-types-4.C: Likewise.
* g++.dg/asan/use-after-scope-types-5.C: Likewise.
* g++.dg/asan/use-after-scope-types.h: Likewise.
* gcc.dg/asan/use-after-scope-1.c: Likewise.
* gcc.dg/asan/use-after-scope-2.c: Likewise.
* gcc.dg/asan/use-after-scope-3.c: Likewise.
* gcc.dg/asan/use-after-scope-4.c: Likewise.
* gcc.dg/asan/use-after-scope-5.c: Likewise.
* gcc.dg/asan/use-after-scope-6.c: Likewise.
* gcc.dg/asan/use-after-scope-7.c: Likewise.
* gcc.dg/asan/use-after-scope-8.c: Likewise.
* gcc.dg/asan/use-after-scope-9.c: Likewise.
* gcc.dg/asan/use-after-scope-switch-1.c: Likewise.
* gcc.dg/asan/use-after-scope-switch-2.c: Likewise.
* gcc.dg/asan/use-after-scope-switch-3.c: Likewise.
* gcc.dg/asan/use-after-scope-goto-1.c: Likewise.
* gcc.dg/asan/use-after-scope-goto-2.c: Likewise.

upstream hash: ea86011c3ffb79f3a8ce8f1ffe0f89abfb8d7ace
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241897 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: Ibab662fa2a192a856c195377cb08796bcad7112f

6 years agoIntroduce -fsanitize-address-use-after-scope 80/189280/2
marxin [Mon, 7 Nov 2016 10:23:38 +0000 (10:23 +0000)]
Introduce -fsanitize-address-use-after-scope

* c-warn.c (warn_for_unused_label): Save all labels used
in goto or in &label.
* asan.c (enum asan_check_flags): Move the enum to header file.
(asan_init_shadow_ptr_types): Make type creation more generic.
(shadow_mem_size): New function.
(asan_emit_stack_protection): Use newly added ASAN_SHADOW_GRANULARITY.
Rewritten stack unpoisoning code.
(build_shadow_mem_access): Add new argument return_address.
(instrument_derefs): Instrument local variables if use after scope
sanitization is enabled.
(asan_store_shadow_bytes): New function.
(asan_expand_mark_ifn): Likewise.
(asan_sanitize_stack_p): Moved from asan_sanitize_stack_p.
* asan.h (enum asan_mark_flags): Moved here from asan.c
(asan_protect_stack_decl): Protect all declaration that need
to live in memory.
(asan_sanitize_use_after_scope): New function.
(asan_no_sanitize_address_p): Likewise.
* cfgexpand.c (partition_stack_vars): Consider
asan_sanitize_use_after_scope in condition.
(expand_stack_vars): Likewise.
* common.opt (-fsanitize-address-use-after-scope): New option.
* doc/invoke.texi (use-after-scope-direct-emission-threshold):
Explain the parameter.
* flag-types.h (enum sanitize_code): Define SANITIZE_USE_AFTER_SCOPE.
* gimplify.c (build_asan_poison_call_expr): New function.
(asan_poison_variable): Likewise.
(gimplify_bind_expr): Generate poisoning/unpoisoning for local
variables that have address taken.
(gimplify_decl_expr): Likewise.
(gimplify_target_expr): Likewise for C++ temporaries.
(sort_by_decl_uid): New function.
(gimplify_expr): Unpoison all variables for a label we can jump
from outside of a scope.
(gimplify_switch_expr): Unpoison variables defined in the switch
context.
(gimplify_function_tree): Clear asan_poisoned_variables.
(asan_poison_variables): New function.
(warn_switch_unreachable_r): Handle IFN_ASAN_MARK.
* internal-fn.c (expand_ASAN_MARK): New function.
* internal-fn.def (ASAN_MARK): Declare.
* opts.c (finish_options): Handle -fstack-reuse if
-fsanitize-address-use-after-scope is enabled.
(common_handle_option): Enable address sanitization if
-fsanitize-address-use-after-scope is enabled.
* params.def (PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD):
New parameter.
* params.h: Likewise.
* sancov.c (pass_sanopt::execute): Handle IFN_ASAN_MARK.
* sanitizer.def: Define __asan_poison_stack_memory and
__asan_unpoison_stack_memory functions.
* asan.c (asan_mark_poison_p): New function.
(transform_statements): Handle asan_mark_poison_p calls.
* gimple.c (nonfreeing_call_p): Handle IFN_ASAN_MARK.

With fixes for tizen linaro-gcc by Dmitriy Gonzha

Change-Id: Ia39cbdfadac97f339dceb973872e15ee0d67ea19
upstream hash: 629b6abce95170a3ee8417479e82615fa1e4b67e
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241896 138bc75d-0d04-0410-961f-82ee72b054a4

6 years agoImplement -Wimplicit-fallthrough. 79/189279/2
mpolacek [Mon, 26 Sep 2016 09:42:50 +0000 (09:42 +0000)]
Implement -Wimplicit-fallthrough.

With fixes for tizen linaro-gcc by Dmitriy Gonzha.
Not fully implement implicit-fallthrough. Some tests are fail.
Because of possible errors turned off from -Wextra and renamed to
"-Wimplicit-fallthrough-disabled".
Required for -fsanitize-address-use-after-scope

Change-Id: I088b82dce350c017ecb3933c1cba3b2b01dde3f7
upstream hash: 3c77f69c50d3377491c917808fbfc4b9787acd6f
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240485 138bc75d-0d04-0410-961f-82ee72b054a4

6 years ago PR c/7652 78/189278/2
mpolacek [Fri, 12 Aug 2016 10:30:47 +0000 (10:30 +0000)]
PR c/7652
gcc/
* alias.c (find_base_value): Adjust fall through comment.
* cfgexpand.c (expand_debug_expr): Likewise.
* combine.c (find_split_point): Likewise.
(expand_compound_operation): Likewise.  Add FALLTHRU.
(make_compound_operation): Adjust fall through comment.
(canon_reg_for_combine): Add FALLTHRU.
(force_to_mode): Adjust fall through comment.
(simplify_shift_const_1): Likewise.
(simplify_comparison): Likewise.
* config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): Add
FALLTHRU.
* config/aarch64/predicates.md: Likewise.
* config/i386/i386.c (function_arg_advance_32): Likewise.
(ix86_gimplify_va_arg): Likewise.
(print_reg): Likewise.
(ix86_print_operand): Likewise.
(ix86_build_const_vector): Likewise.
(ix86_expand_branch): Likewise.
(ix86_sched_init_global): Adjust fall through comment.
(ix86_expand_args_builtin): Add FALLTHRU.
(ix86_expand_builtin): Likewise.
(ix86_expand_vector_init_one_var): Likewise.
* config/rs6000/rs6000.c (rs6000_emit_vector_compare_inner): Likewise.
(rs6000_adjust_cost): Likewise.
(insn_must_be_first_in_group): Likewise.
* config/rs6000/rs6000.md: Likewise.  Adjust fall through comment.
* dbxout.c (dbxout_symbol): Adjust fall through comment.
* df-scan.c (df_uses_record): Likewise.
* dojump.c (do_jump): Add FALLTHRU.
* dwarf2out.c (mem_loc_descriptor): Likewise.  Adjust fall through
comment.
(resolve_args_picking_1): Adjust fall through comment.
(loc_list_from_tree_1): Likewise.
* expmed.c (make_tree): Likewise.
* expr.c (expand_expr_real_2): Add FALLTHRU.
(expand_expr_real_1): Likewise.  Adjust fall through comment.
* fold-const.c (const_binop): Adjust fall through comment.
(fold_truth_not_expr): Likewise.
(fold_cond_expr_with_comparison): Add FALLTHRU.
(fold_binary_loc): Likewise.
(contains_label_1): Adjust fall through comment.
(multiple_of_p): Likewise.
* gcov-tool.c (process_args): Add FALLTHRU.
* genattrtab.c (check_attr_test): Likewise.
(write_test_expr): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genpreds.c (validate_exp): Adjust fall through comment.
(needs_variable): Likewise.
* gensupport.c (get_alternatives_number): Add FALLTHRU.
(subst_dup): Likewise.
* gimple-pretty-print.c (dump_gimple_assign): Likewise.
* gimplify.c (gimplify_addr_expr): Adjust fall through comment.
(gimplify_scan_omp_clauses): Add FALLTHRU.
(goa_stabilize_expr): Likewise.
* graphite-isl-ast-to-gimple.c (substitute_ssa_name): Adjust fall
through comment.
* hsa-gen.c (get_address_from_value): Likewise.
* ipa-icf.c (sem_function::hash_stmt): Likewise.
* ira.c (ira_setup_alts): Add FALLTHRU.
* lra-eliminations.c (lra_eliminate_regs_1): Adjust fall through
comment.
* lto-streamer-out.c (lto_output_tree_ref): Add FALLTHRU.
* opts.c (common_handle_option): Likewise.
* read-rtl.c (read_rtx_code): Likewise.
* real.c (round_for_format): Likewise.
* recog.c (asm_operand_ok): Likewise.
* reginfo.c (reg_scan_mark_refs): Adjust fall through comment.
* reload1.c (set_label_offsets): Likewise.
(eliminate_regs_1): Likewise.
(reload_reg_reaches_end_p): Likewise.
* rtlanal.c (commutative_operand_precedence): Add FALLTHRU.
(rtx_cost): Likewise.
* sched-rgn.c (is_exception_free): Likewise.
* simplify-rtx.c (simplify_rtx): Adjust fall through comment.
* stor-layout.c (int_mode_for_mode): Likewise.
* toplev.c (print_to_asm_out_file): Likewise.
(print_to_stderr): Likewise.
* tree-cfg.c (gimple_verify_flow_info): Likewise.
* tree-chrec.c (chrec_fold_plus_1): Add FALLTHRU.
(chrec_fold_multiply): Likewise.
(evolution_function_is_invariant_rec_p): Likewise.
(for_each_scev_op): Likewise.
* tree-data-ref.c (siv_subscript_p): Likewise.
(get_references_in_stmt): Likewise.
* tree.c (find_placeholder_in_expr): Adjust fall through comment.
(substitute_in_expr): Likewise.
(type_cache_hasher::equal): Likewise.
(walk_type_fields): Likewise.
* var-tracking.c (adjust_mems): Add FALLTHRU.
(set_dv_changed): Adjust fall through comment.
* varasm.c (default_function_section): Add FALLTHRU.
gcc/c-family/
* c-common.c (scalar_to_vector): Adjust fall through comment.
* c-opts.c (c_common_handle_option): Likewise.
* c-pragma.c (handle_pragma_pack): Add FALLTHRU.
* c-pretty-print.c (c_pretty_printer::postfix_expression): Adjust
fall through comment.
* cilk.c (extract_free_variables): Add FALLTHRU.
gcc/c/
* c-parser.c (c_parser_external_declaration): Add FALLTHRU.
(c_parser_postfix_expression): Likewise.
* c-typeck.c (build_unary_op): Adjust fall through comment.
(c_mark_addressable): Likewise.
gcc/cp/
* call.c (add_builtin_candidate): Add FALLTHRU.
(build_integral_nontype_arg_conv): Adjust fall through comment.
(build_new_op_1): Add FALLTHRU.
(convert_like_real): Adjust fall through comment.
* class.c (fixed_type_or_null): Likewise.
* constexpr.c (cxx_eval_constant_expression): Likewise.
(potential_constant_expression_1): Likewise.  Add FALLTHRU.
* cp-gimplify.c (cp_gimplify_expr): Adjust fall through comment.
(cp_fold): Add FALLTHRU.
* cvt.c (build_expr_type_conversion): Adjust fall through comment.
* cxx-pretty-print.c (pp_cxx_unqualified_id): Add FALLTHRU.
(pp_cxx_qualified_id): Likewise.
(cxx_pretty_printer::constant): Adjust fall through comment.
(cxx_pretty_printer::primary_expression): Add FALLTHRU.
(pp_cxx_pm_expression): Adjust fall through comment.
(cxx_pretty_printer::expression): Add FALLTHRU.
(cxx_pretty_printer::declaration_specifiers): Reformat code.
(pp_cxx_type_specifier_seq): Adjust fall through comment.
(pp_cxx_ptr_operator): Likewise.  Add FALLTHRU.
* error.c (dump_type): Adjust fall through comment.
(dump_decl): Likewise.
* mangle.c (write_type): Likewise.
* method.c (synthesized_method_walk): Add FALLTHRU.
* name-lookup.c (arg_assoc_type): Likewise.
* parser.c (cp_lexer_print_token): Adjust fall through comment.
(cp_parser_primary_expression): Add FALLTHRU.
(cp_parser_operator): Likewise.
* pt.c (find_parameter_packs_r): Likewise.
(tsubst_aggr_type): Adjust fall through comment.
* semantics.c (finish_omp_clauses): Add FALLTHRU.
* tree.c (lvalue_kind): Likewise.
gcc/fortran/
* decl.c (match_attr_spec): Add FALLTHRU.
* primary.c (match_arg_list_function): Likewise.
* resolve.c (resolve_operator): Adjust fall through comment.
(fixup_charlen): Add FALLTHRU.
(resolve_allocate_expr): Adjust fall through comment.
* trans-array.c (gfc_conv_ss_startstride): Add FALLTHRU.
* trans-intrinsic.c (gfc_conv_intrinsic_len): Adjust fall through
comment.
gcc/java/
* expr.c (java_truthvalue_conversion): Adjust fall through comment.
* jcf-io.c (verify_constant_pool): Likewise.
* typeck.c (promote_type): Likewise.
gcc/objc/
* objc-encoding.c (encode_type): Add FALLTHRU.
libcpp/
* lex.c (search_line_fast): Add FALLTHRU.
(_cpp_lex_direct): Likewise.
(cpp_token_val_index): Adjust fall through comment.
* macro.c (parse_params): Add FALLTHRU.
* pch.c (count_defs): Adjust fall through comment.
(write_defs): Likewise.
libiberty/
* cp-demangle.c (d_print_mod): Add FALLTHRU.

upstream hash: e3533433b8efa642ea08f2704b1dd7b7f741fbc3
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239410 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I4ebe40df8514b8ec4a6d5c701b2b672107fcc40c

6 years ago * tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount. 77/189277/2
matz [Mon, 18 Apr 2016 20:36:27 +0000 (20:36 +0000)]
* tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount.
(SET_TYPE_ALIGN, SET_DECL_ALIGN): New.
* tree-core.h (tree_type_common.align): Use bit-field.
(tree_type_common.spare): New.
(tree_decl_common.off_align): Make smaller.
(tree_decl_common.align): Use bit-field.

* expr.c (expand_expr_addr_expr_1): Use SET_TYPE_ALIGN.
* omp-low.c (install_var_field): Use SET_DECL_ALIGN.
(scan_sharing_clauses): Ditto.
(finish_taskreg_scan): Use SET_DECL_ALIGN and SET_TYPE_ALIGN.
(omp_finish_file): Ditto.
* stor-layout.c (do_type_align): Use SET_DECL_ALIGN.
(layout_decl): Ditto.
(relayout_decl): Ditto.
(finalize_record_size): Use SET_TYPE_ALIGN.
(finalize_type_size): Ditto.
(finish_builtin_struct): Ditto.
(layout_type): Ditto.
(initialize_sizetypes): Ditto.
* targhooks.c (std_gimplify_va_arg_expr): Use SET_TYPE_ALIGN.
* tree-nested.c (insert_field_into_struct): Use SET_TYPE_ALIGN.
(lookup_field_for_decl): Use SET_DECL_ALIGN.
(get_chain_field): Ditto.
(get_trampoline_type): Ditto.
(get_nl_goto_field): Ditto.
* tree-streamer-in.c (unpack_ts_decl_common_value_fields): Use
SET_DECL_ALIGN.
(unpack_ts_type_common_value_fields): Use SET_TYPE_ALIGN.
* gimple-expr.c (copy_var_decl): Use SET_DECL_ALIGN.
* tree.c (make_node_stat): Use SET_DECL_ALIGN and SET_TYPE_ALIGN.
(build_qualified_type): Use SET_TYPE_ALIGN.
(build_aligned_type, build_range_type_1): Ditto.
(build_atomic_base): Ditto.
(build_common_tree_nodes): Ditto.
* cfgexpand.c (align_local_variable): Use SET_DECL_ALIGN.
(expand_one_stack_var_at): Ditto.
* coverage.c (build_var): Use SET_DECL_ALIGN.
* except.c (init_eh): Ditto.
* function.c (assign_parm_setup_block): Ditto.
* symtab.c (increase_alignment_1): Ditto.
* tree-ssa-ccp.c (fold_builtin_alloca_with_align): Ditto.
* tree-vect-stmts.c (ensure_base_align): Ditto.
* varasm.c (align_variable): Ditto.
(assemble_variable): Ditto.
(build_constant_desc): Ditto.
(output_constant_def_contents): Ditto.

* config/arm/arm.c (arm_relayout_function): Use SET_DECL_ALIGN.
* config/avr/avr.c (avr_adjust_type_node): Use SET_TYPE_ALIGN.
* config/mips/mips.c (mips_std_gimplify_va_arg_expr): Ditto.
* config/msp430/msp430.c (msp430_gimplify_va_arg_expr): Ditto.
* config/spu/spu.c (spu_build_builtin_va_list): Use SET_DECL_ALIGN.

ada/
* gcc-interface/decl.c (gnat_to_gnu_entity): Use SET_TYPE_ALIGN.
(gnat_to_gnu_field): Ditto.
(components_to_record): Ditto.
(create_variant_part_from): Ditto.
(copy_and_substitute_in_size): Ditto.
(substitute_in_type): Ditto.
* gcc-interface/utils.c (make_aligning_type): Use SET_TYPE_ALIGN.
(make_packable_type): Ditto.
(maybe_pad_type): Ditto.
(finish_fat_pointer_type): Ditto.
(finish_record_type): Ditto and use SET_DECL_ALIGN.
(rest_of_record_type_compilation): Use SET_TYPE_ALIGN.
(create_field_decl): Use SET_DECL_ALIGN.

c-family/
* c-common.c (handle_aligned_attribute): Use SET_TYPE_ALIGN
and SET_DECL_ALIGN.

c/
* c-decl.c (merge_decls): Use SET_DECL_ALIGN and SET_TYPE_ALIGN.
(grokdeclarator, parser_xref_tag, finish_enum): Use SET_TYPE_ALIGN.

cp/
* class.c (build_vtable): Use SET_DECL_ALIGN and SET_TYPE_ALIGN.
(layout_class_type): Ditto.
(build_base_field): Use SET_DECL_ALIGN.
(fixup_attribute_variants): Use SET_TYPE_ALIGN.
* decl.c (duplicate_decls): Use SET_DECL_ALIGN.
(record_unknown_type): Use SET_TYPE_ALIGN.
(cxx_init_decl_processing): Ditto.
(copy_type_enum): Ditto.
(grokfndecl): Use SET_DECL_ALIGN.
(copy_type_enum): Use SET_TYPE_ALIGN.
* pt.c (instantiate_class_template_1): Use SET_TYPE_ALIGN.
(tsubst): Ditto.
* tree.c (cp_build_qualified_type_real): Use SET_TYPE_ALIGN.
* lambda.c (maybe_add_lambda_conv_op): Use SET_DECL_ALIGN.
* method.c (implicitly_declare_fn): Use SET_DECL_ALIGN.
* rtti.c (emit_tinfo_decl): Ditto.

fortran/
* trans-io.c (gfc_build_io_library_fndecls): Use SET_TYPE_ALIGN.
* trans-common.c (build_common_decl): Use SET_DECL_ALIGN.
* trans-types.c (gfc_add_field_to_struct): Use SET_DECL_ALIGN.

go/
* go-gcc.cc (Gcc_backend::implicit_variable): Use SET_DECL_ALIGN.

java/
* class.c (add_method_1): Use SET_DECL_ALIGN.
(make_class_data): Ditto.
(emit_register_classes_in_jcr_section): Ditto.
* typeck.c (build_java_array_type): Ditto.

objc/
* objc-act.c (objc_build_struct): Use SET_DECL_ALIGN.

libcc1/
* plugin.cc (plugin_finish_record_or_union): Use SET_TYPE_ALIGN.

upstream hash: 5d4b30ea56c1733a9149b59105b9645c115cc123
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235172 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: Ia135e37556ac5bc0e2db4cc2a940d8d31e243ade

6 years agoC/C++: Simplify handling of location information for OpenACC routine directives 76/189276/2
tschwinge [Thu, 4 Aug 2016 13:35:19 +0000 (13:35 +0000)]
C/C++: Simplify handling of location information for OpenACC routine directives

gcc/c/
* c-parser.c (struct oacc_routine_data): New.
(c_parser_declaration_or_fndef, c_parser_oacc_routine): Use it.
Simplify code.
(c_finish_oacc_routine): Likewise.  Don't attach clauses to "omp
declare target" attribute.
gcc/cp/
* parser.h (struct cp_omp_declare_simd_data): New.
(struct cp_parser): Use it for oacc_routine member.
* parser.c (cp_ensure_no_oacc_routine, cp_parser_oacc_routine)
(cp_parser_late_parsing_oacc_routine, cp_finalize_oacc_routine):
Use it.  Simplify code.
(cp_parser_new): Initialize all members pointing to special
parsing data structures.
(cp_parser_cilk_simd_fn_vector_attrs): Initialize
parser->cilk_simd_fn_info->clauses.
(cp_parser_omp_declare_simd): Initialize
parser->omp_declare_simd->clauses.
(cp_parser_late_parsing_omp_declare_simd): Simplify code.

upstream hash: 5f429ee2993ea1795d88c5589251c500e6e9062a
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239127 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I6e8b2ad2102b50798fd0fb7b373e6c4ccb17acd7

6 years ago PR middle-end/71476 75/189275/2
mpolacek [Mon, 13 Jun 2016 08:57:02 +0000 (08:57 +0000)]
PR middle-end/71476
* gimplify.c (maybe_warn_switch_unreachable): Factored out of
gimplify_switch_expr.
(warn_switch_unreachable_r): New function.

* c-c++-common/Wswitch-unreachable-4.c: New test.
* gcc.dg/Wswitch-unreachable-2.c: New test.
* g++.dg/tm/jump1.C: Move dg-warning.

upstream hash: 1a54d3bee5c40687c53b2680d0b110f23a193713
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237367 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: Ie8bc6fb965fdb08c7e76ee02fe01eec4707336b0

6 years ago * gimplify.c (gimplify_switch_expr): Also handle GIMPLE_TRY. 74/189274/2
mpolacek [Tue, 31 May 2016 14:55:05 +0000 (14:55 +0000)]
* gimplify.c (gimplify_switch_expr): Also handle GIMPLE_TRY.

* c-c++-common/Wswitch-unreachable-3.c: New test.
* g++.dg/warn/Wswitch-unreachable-1.C: New test.

upstream hash: 4ff7bd215d121cbec262600e2b4bcbff93b8affb
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236924 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: Ic1e69ef6931e9f4051060cc37bd33c9a86ad2df3

6 years ago PR c/71249 73/189273/2
mpolacek [Tue, 24 May 2016 16:22:31 +0000 (16:22 +0000)]
PR c/71249
* gimplify.c (gimplify_switch_expr): Look into the innermost lexical
scope.

* c-c++-common/Wswitch-unreachable-2.c: New test.

upstream hash: 6ef0143d8a1ce423db0ae0da55760b4fb82f3bdf
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236649 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I1270c2aea4e4561f72a9801607bcdfc5edab9a03

6 years ago PR c/49859 72/189272/2
mpolacek [Mon, 23 May 2016 15:37:09 +0000 (15:37 +0000)]
PR c/49859
* common.opt (Wswitch-unreachable): New option.
* doc/invoke.texi: Document -Wswitch-unreachable.
* gimplify.c (gimplify_switch_expr): Implement the -Wswitch-unreachable warning.

* c-c++-common/Wswitch-unreachable-1.c: New test.
* gcc.dg/Wswitch-unreachable-1.c: New test.
* c-c++-common/goacc/sb-2.c (void foo): Add dg-warning.
* g++.dg/cpp0x/lambda/lambda-switch.C (main): Likewise.
* g++.dg/gomp/block-10.C: Likewise.
* gcc.dg/gomp/block-10.c: Likewise.
* g++.dg/gomp/block-9.C: Likewise.
* gcc.dg/gomp/block-9.c: Likewise.
* g++.dg/gomp/target-1.C: Likewise.
* g++.dg/gomp/target-2.C: Likewise.
* gcc.dg/gomp/target-1.c: Likewise.
* gcc.dg/gomp/target-2.c: Likewise.
* g++.dg/gomp/taskgroup-1.C: Likewise.
* gcc.dg/gomp/taskgroup-1.c: Likewise.
* gcc.dg/gomp/teams-1.c: Likewise.
* g++.dg/gomp/teams-1.C: Likewise.
* g++.dg/overload/error3.C: Likewise.
* g++.dg/tm/jump1.C: Likewise.
* g++.dg/torture/pr40335.C: Likewise.
* gcc.dg/c99-vla-jump-5.c: Likewise.
* gcc.dg/switch-warn-1.c: Likewise.
* gcc.dg/Wjump-misses-init-1.c: Use -Wno-switch-unreachable.
* gcc.dg/nested-func-1.c: Likewise.
* gcc.dg/pr67784-4.c: Likewise.

upstream hash: 1398da0f786e120bb0b407e84f412aa9fc6d80ee
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236597 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I8f3be300f4bbb9695c6a4257cf47851241c19fe7

6 years ago PR c/67784 71/189271/2
mpolacek [Tue, 26 Apr 2016 14:59:40 +0000 (14:59 +0000)]
PR c/67784
* c-parser.c (c_parser_maybe_reclassify_token): New function factored out of ...
(c_parser_for_statement): ... here.
(c_parser_if_statement): Use it.
(c_parser_switch_statement): Use it.
(c_parser_while_statement): Use it.

* gcc.dg/pr67784-3.c: New test.
* gcc.dg/pr67784-4.c: New test.
* gcc.dg/pr67784-5.c: New test.

upstream hash: fa20ebd39e4a6947f82bdc0f6ab7f68acd65bca8
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235446 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I3f6bb239a239135d2e498842b6de8390fc9eeaa5

6 years ago[THUMB2] Frame pointer for arm with THUMB2 mode. 52/188052/2 accepted/tizen/base/20181102.125713 submit/tizen_base/20181018.065945 submit/tizen_base/20181101.054916
Denis Khalikov [Thu, 30 Aug 2018 15:57:41 +0000 (18:57 +0300)]
[THUMB2] Frame pointer for arm with THUMB2 mode.

Set frame pointer to the predictable location in the stack frame
for arm with THUMB2 mode.

Denis Khalikov  <d.khalikov@partner.samsung.com>

  * config/arm/arm.c (arm_emit_multi_reg_pop_no_return): New function.
  (arm_compute_initial_elimination_offset): Add support for
  TARGET_THUMB_STACK_UNWIND.
  (arm_expand_prologue): Emit function prologue related to
  TARGET_THUMB_STACK_UNWIND.
  (thumb2_expand_return): Emit function epilogue related to
  TARGET_THUMB_STACK_UNWIND.
  (arm_expand_epilogue): Emit function epilogue related to
  TARGET_THUMB_STACK_UNWIND.
  * config/arm/arm.h (TARGET_THUMB_STACK_UNWIND): New define.
  (INITIAL_ELIMINATION_OFFSET): Add support for
  TARGET_THUMB_STACK_UNWIND.
  * config/arm/arm.opt: Add compile-time option THUMB_FP.
  * gcc/testsuite/c-c++-common/asan/fast-unwind-thumb.c: New tests.

Change-Id: I45a68a1216f3115c5199e5cea14c344fabe11fc1

6 years ago[ASan] Add support for lsan background leak checking thread. 01/160901/4 accepted/tizen_5.0_base tizen_5.0_base accepted/tizen/5.0/base/20181101.090602 accepted/tizen/base/20180924.142600 submit/tizen_5.0_base/20181101.000001 submit/tizen_base/20180921.104459
Michail Kashkarov [Wed, 15 Nov 2017 17:50:30 +0000 (20:50 +0300)]
[ASan] Add support for lsan background leak checking thread.

Change-Id: I61dbebdecd0f608736e8a1649595868cc119a8e4

6 years ago[LSan] Add new experimental option for checking long-running processes. 80/159380/9
Michail Kashkarov [Thu, 19 Oct 2017 19:02:41 +0000 (22:02 +0300)]
[LSan] Add new experimental option for checking long-running processes.

New LSan option: leak_check_interval_s:
Spawns a background thread at startup which periodically do recoverable
leak check with given interval.

Report files (if log_path option != stderr|stdout) are appended with
prefix "in-progress" and for the DoLeakCheck() call at exit -
are restores back.

System daemons can be leak sanitized right after system startup by adding
"Environment=LSAN_OPTIONS=...:leak_check_interval_s=60"
field in the systemd service file for leak checking every 60 seconds.

Change-Id: Ia78044ec45092f0de96818bd0114d4c7a49cb7e1

6 years ago[Test] Switch off cilkplus testing 98/185298/2 accepted/tizen/base/20180908.052105 submit/tizen_base/20180906.130734
Slava Barinov [Fri, 27 Jul 2018 09:13:41 +0000 (12:13 +0300)]
[Test] Switch off cilkplus testing

Intel-only proprietary cilkplus is not needed in Tizen and is not support, we
don't need to run the tests.

      gcc/testsuite/g++.dg/dg.exp: remove cilk-plus.exp running

Change-Id: Iccb0153f76ec0eceb7afade0dbf5e43d3c9dd6b3
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
6 years agopackaging: Add macroses to test linaro-gcc on target device 14/188014/3
Mikhail Kashkarov [Thu, 30 Aug 2018 09:20:25 +0000 (12:20 +0300)]
packaging: Add macroses to test linaro-gcc on target device

- run_tests_on_device:
  1. Turn on linaro-gcc tests.
  2. Do not remove 'obj/' directory.
  3. Skip configure/make commands in the %build stage.

- exit_on_make_finish:
  Exit right after "make BOOT_CFLAGS=..." step.

Change-Id: I77a85befa7756922963b63488aaf8cdc431fec0f

6 years ago[Sanitizers] GCC fails to build libasan with -mthumb and -fno-omit-frame-pointer 88/187288/1
Denis Khalikov [Tue, 21 Aug 2018 13:17:34 +0000 (16:17 +0300)]
[Sanitizers] GCC fails to build libasan with -mthumb and -fno-omit-frame-pointer

GCC does not allow to have frame pointer register as a clobber register
for inline assembler, when flag -fno-omit-frame-pointer is added.
By default, arm with mthumb mode uses r7 as a frame pointer register.

https://reviews.llvm.org/D50180

Change-Id: I5f5a3c695353ba2fe4195fd6054aedb7ee11e1af

6 years agoRepair collecting files for testresults rpm package. 99/184099/2 accepted/tizen/base/20180720.112000 submit/tizen_base/20180719.091532
Mikhail Kashkarov [Fri, 13 Jul 2018 14:05:21 +0000 (17:05 +0300)]
Repair collecting files for testresults rpm package.

Different .log files with the same name from gmp/mpfr are overwriting on copy,
put the in the separate directories.

Change-Id: I77761f1ff589252b4e8816dc12e9025d360fc5a0

6 years agopackaging: Add -Wformat options to disable warnings and tests FAIL. 98/179398/2
Mikhail Kashkarov [Thu, 17 May 2018 13:32:19 +0000 (16:32 +0300)]
packaging: Add -Wformat options to disable warnings and tests FAIL.

"-Wformat-..." options generate warnings like:

  cc1: warning: -Wformat-security ignored without -Wformat [-Wformat-security]

that makes a lot of unexpected failures in testsuite while checking produced
output (FAIL: .. test for excess errors) and also results comparison is messed
up for the new tests.
Insert -Wformat if it's missing.

Change-Id: Ia61f256b1f8c3fe5b3ee3c02d363eb901c68adbe

6 years ago[ASan] Add FORTIFY_SOURCE interceptors 80/162380/5
Denis Khalikov [Wed, 29 Nov 2017 11:21:07 +0000 (14:21 +0300)]
[ASan] Add FORTIFY_SOURCE interceptors

List of interceptors:
__strcat_chk,
__strncat_chk,
__strcpy_chk,
__strncpy_chk.
__poll_chk,
__ppoll_chk,
__read_chk,
__recv_chk,
__recvfrom_chk,
__pread_chk,
__pread64_chk.
__getgroups_chk,
__getcwd_chk,
__realpath_chk,
__confstr_chk.
__mbstowcs_chk,
__mbsrtowcs_chk,
__mbsnrtowcs_chk,
__wcstombs_chk,
__wcsrtombs_chk,
__wcsnrtombs_chk,
__wcrtomb_chk,
__ttyname_r_chk.

Change-Id: I16ef4d2d80089b96e5c51ea5160b706b35f9ce18

6 years ago[asan] Use linker initialization for the allocator 47/182747/2
Kuba Mracek [Fri, 22 Jun 2018 12:56:46 +0000 (15:56 +0300)]
[asan] Use linker initialization for the allocator

This saves ~2 MB of dirty memory footprint. Can be a big deal on mobile devices especially when running multiple processes with ASan.

Differential Revision: https://reviews.llvm.org/D40627

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320660 91177308-0d34-0410-b5e6-96231b3b80d8

Change-Id: I409b9dc7f73e13248987dd38d96a074ffc2ff044

6 years ago[Sanitizers] Move cached allocator_may_return_null flag to sanitizer_allocator 46/182746/2
Alex Shlyapnikov [Fri, 22 Jun 2018 12:33:11 +0000 (15:33 +0300)]
[Sanitizers] Move cached allocator_may_return_null flag to sanitizer_allocator

Summary:
Move cached allocator_may_return_null flag to sanitizer_allocator.cc and
provide API to consolidate and unify the behavior of all specific allocators.

Make all sanitizers using CombinedAllocator to follow
AllocatorReturnNullOrDieOnOOM() rules to behave the same way when OOM
happens.

When OOM happens, turn allocator_out_of_memory flag on regardless of
allocator_may_return_null flag value (it used to not to be set when
allocator_may_return_null == true).

release_to_os_interval_ms and rss_limit_exceeded will likely be moved to
sanitizer_allocator.cc too (later).

Reviewers: eugenis

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34310

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305858 91177308-0d34-0410-b5e6-96231b3b80d8

Change-Id: I29ae28a1f9c569d69666936111e307c3aecf9314

6 years ago[Sanitizer] Remove CombinedAllocator::Allocate's 'cleared' parameter 45/182745/2
Alex Shlyapnikov [Fri, 22 Jun 2018 12:30:32 +0000 (15:30 +0300)]
[Sanitizer] Remove CombinedAllocator::Allocate's 'cleared' parameter

Summary:
CombinedAllocator::Allocate cleared parameter is not used anywhere and
seem to be obsolete.

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D34289

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305590 91177308-0d34-0410-b5e6-96231b3b80d8

Change-Id: I57958f6ea291bb31027070f93ad652598c69d1fe

6 years ago[ASan] Move rss_limit_is_exceeded_ flag to ASan. 44/182744/2
Alex Shlyapnikov [Fri, 22 Jun 2018 12:27:29 +0000 (15:27 +0300)]
[ASan] Move rss_limit_is_exceeded_ flag to ASan.

Summary:
Move the OOM decision based on RSS limits out of generic allocator to
ASan allocator, where it makes more sense at the moment.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34180

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305342 91177308-0d34-0410-b5e6-96231b3b80d8

Change-Id: I2c7ccdfbfd420b74cbc5c96a50933bace9b88ccf

6 years agoCorrected D27428: Do not use the alignment-rounded-up size with secondary 43/182743/2
Kostya Kortchinsky [Fri, 22 Jun 2018 12:26:11 +0000 (15:26 +0300)]
Corrected D27428: Do not use the alignment-rounded-up size with secondary

Summary:
I atually had an integer overflow on 32-bit with D27428 that didn't reproduce
locally, as the test servers would manage allocate addresses in the 0xffffxxxx
range, which led to some issues when rounding addresses.

At this point, I feel that Scudo could benefit from having its own combined
allocator, as we don't get any benefit from the current one, but have to work
around some hurdles (alignment checks, rounding up that is no longer needed,
extraneous code).

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D27681

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289572 91177308-0d34-0410-b5e6-96231b3b80d8

Change-Id: If9f3b384566cffa0bdd1740ef2266a6a9d5f6fa4

6 years agoReturn memory to OS right after free (not in the async thread). 42/182742/2
Evgeniy Stepanov [Fri, 22 Jun 2018 12:21:18 +0000 (15:21 +0300)]
Return memory to OS right after free (not in the async thread).

Summary:
In order to avoid starting a separate thread to return unused memory to
the system (the thread interferes with process startup on Android,
Zygota waits for all threads to exit before fork, but this thread never
exits), try to return it right after free.

Reviewers: eugenis

Subscribers: cryptoad, filcab, danalbert, kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

Differential Revision: https://reviews.llvm.org/D27003

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288091 91177308-0d34-0410-b5e6-96231b3b80d8

Change-Id: I2e01818bbdf3a0b9f0855b28d963b8016000abc8

6 years agoPR other/86198 10/182010/2
Denis Khalikov [Tue, 19 Jun 2018 10:12:36 +0000 (13:12 +0300)]
PR other/86198

* elf.c (elf_add): Increase ".note.gnu.build-id" section size
checking up to 36 bytes.

Change-Id: I5a6046a551395ad61c8013a347c875ad22b33599

6 years agoPR sanitizer/86090 32/181532/3
Denis Khalikov [Thu, 14 Jun 2018 12:59:00 +0000 (15:59 +0300)]
PR sanitizer/86090

  libsanitizer/
  * configure.ac: Check for lstat and readlink.
  * configure, config.h.in: Rebuild.

Change-Id: I3c81a03c34828604f3be9db3906c4ecffafc360c

6 years agoPR other/67165 54/181154/2
Denis Khalikov [Thu, 7 Jun 2018 12:36:22 +0000 (15:36 +0300)]
PR other/67165

* elf.c (__builtin_prefetch): Define if not __GNUC__.
(unlikely): Define.
(SHF_UNCOMPRESSED, ELFCOMPRESS_ZLIB): Define.
(b_elf_chdr): Define type.
(enum debug_section): Add ZDEBUG_xxx values.
(debug_section_names): Add names for new sections.
(struct debug_section_info): Add compressed field.
(elf_zlib_failed, elf_zlib_fetch): New static functions.
(HUFFMAN_TABLE_SIZE, HUFFMAN_VALUE_MASK): Define.
(HUFFMAN_BITS_SHIFT, HUFFMAN_BITS_MASK): Define.
(HUFFMAN_SECONDARY_SHIFT): Define.
(ZDEBUG_TABLE_SIZE): Define.
(ZDEBUG_TABLE_CODELEN_OFFSET, ZDEBUG_TABLE_WORK_OFFSET): Define.
(final_next_secondary): New static variable if
BACKTRACE_GENERATE_FIXED_HUFFMAN_TABLE.
(elf_zlib_inflate_table): New static function.
(BACKTRACE_GENERATE_FIXED_HUFFMAN_TABLE): If define, define main
function to produce fixed Huffman table.
(elf_zlib_default_table): New static variable.
(elf_zlib_inflate): New static function.
(elf_zlib_verify_checksum): Likewise.
(elf_zlib_inflate_and_verify): Likewise.
(elf_uncompress_zdebug): Likewise.
(elf_uncompress_chdr): Likewise.
(backtrace_uncompress_zdebug): New extern function.
(elf_add): Look for .zdebug sections and SHF_COMPRESSED debug
sections, and uncompress them.
* internal.h (backtrace_compress_zdebug): Declare.
* ztest.c: New file.
* configure.ac: Check for -lz and check whether the linker
supports --compress-debug-sections.
* Makefile.am (ztest_SOURCES): New variable.
(ztest_CFLAGS, ztest_LDADD): New variables.
(check_PROGRAMS): Add ztest.
(ctestg_SOURCES): New variable.
(ctestg_CFLAGS, ctestg_LDFLAGS, ctestg_LDADD): New variables.
(ctesta_SOURCES): New variable.
(ctesta_CFLAGS, ctesta_LDFLAGS, ctesta_LDADD): New variables.
(check_PROGRAMS): Add ctestg and ctesta.
* configure, config.h.in, Makefile.in: Rebuild.
* xcoff.c: Initial support for DWARF debug sections in XCOFF.
(STYP_DWARF, SSUBTYP_DW*): Define.
(enum dwarf_section): Define.
(struct dwsect_info): Define.
(xcoff_add): Look for DWARF sections, pass them to
backtrace_dwarf_add.
* configure.ac: Check for clock_gettime.
* config.h.in: Regenerate.
* configure: Likewise.
* ztest.c (average_time, test_large): Conditionalize test timing
on clock_gettime availability.
* Makefile.am: Append the content of clock_gettime_link to
ztest_LDADD.
* configure.ac: Test for the case that clock_gettime is in librt.
* Makefile.in: Regenerate.
* configure: Likewise.
* ztest.c: #include <errno.h>.
(TEST_TIMING): Don't define, don't test.
(xclock_gettime, xclockid_t): Define if !HAVE_CLOCK_GETTIME.
(clockid_t, clock_gettime, CLOCK_REALTIME): Likewise.
(ZLIB_CLOCK_GETTIME_ARG): Define.
* configure.ac: Change clock_gettime_link to CLOCK_GETTIME_LINK.
* Makefile.am: Likewise.
* configure, Makefile.in: Rebuild.
* elf.c (elf_zlib_fetch): Change pval argument to uint64_t *.
Read a four byte integer.
(elf_zlib_inflate): Change val to uint64_t.  Align pin to a 32-bit
boundary before ever calling elf_zlib_fetch.
* ztest.c (test_large): Simplify print statements a bit.
* ztest.c (test_large): Pass unsigned long *, not size_t *, to
zlib uncompress function.
* configure.ac: Add CET_FLAGS to EXTRA_FLAGS.
* aclocal.m4: Regenerate.
* Makefile.in: Likewise.
* configure: Likewise.
* elf.c (codes) [GENERATE_FIXED_HUFFMAN_TABLE]: Fix size to be
288.
(main) [GENERATE_FIXED_HUFFMAN_TABLE]: Pass 288 to
elf_zlib_inflate_table.  Generate elf_zlib_default_dist_table.
(elf_zlib_default_table): Update.
(elf_zlib_default_dist_table): New static array.
(elf_zlib_inflate): Use elf_zlib_default_dist_table for dist table
for block type 1.
* ztest.c (struct zlib_test): Add uncompressed_len.
(tests): Initialize uncompressed_len field.  Add new test case.
(test_samples): Use uncompressed_len field.

Change-Id: I1dd4780768695f66177983c50942001365ff75ed

6 years agoPR sanitizer/77631 53/181153/2
Denis Khalikov [Thu, 7 Jun 2018 11:24:16 +0000 (14:24 +0300)]
PR sanitizer/77631

Support for external debug info.
* elf.c: Include <errno.h>, <sys/stat.h>, <unistd.h>.
(S_ISLNK): Define if not defined.
(xstrnlen): Define if strnlen is not available.
(b_elf_note): Define type.
(NT_GNU_BUILD_ID): Define macro.
(elf_crc32, elf_crc32_file): New static functions.
(elf_is_symlink, elf_readlink): New static functions.
(elf_open_debugfile_by_buildid): New static function.
(elf_try_debugfile): New static function.
(elf_find_debugfile_by_debuglink): New static function.
(elf_open_debugfile_by_debuglink): New static function.
(elf_add): Add filename and debuginfo parameters.  Adjust all
callers.  Look for external debug info notes, and try to fetch
debug info from external file.
(struct phdr_data): Add exe_filename field.
(phdr_callback): Pass filename to elf_add.
(backtrace_initialize): Add filename parameter.
* internal.h (backtrace_initialize): Add filename parameter.
* fileline.c (fileline_initialize): Pass filename to
backtrace_initialize.
* pecoff.c (fileline_initialize): Add unused filename parameter.
* unknown.c (fileline_initialize): Likewise.
* xcoff.c (fileline_initialize): Likewise.
* configure.ac: Check for objcopy --add-gnu-debuglink.
* Makefile.am (dtest): New test target.
* configure, Makefile.in: Rebuild.
* elf.c (backtrace_initialize): Set pd.exe_filename.
* configure.ac: Check for lstat and readlink.
* elf.c (lstat, readlink): Provide dummy versions if real versions
are not available.
* configure, config.h.in: Rebuild.

Change-Id: Ia723266f2d1a9d075202c0b6904e62fa18b75123

6 years agolibbacktrace: backport from mainline. 52/181152/2
Denis Khalikov [Thu, 7 Jun 2018 10:20:04 +0000 (13:20 +0300)]
libbacktrace: backport from mainline.

* btest.c (test5): Replace #ifdef guard with 'unused' attribute
to fix compile warning when BACKTRACE_SUPPORTED isn't defined.
* dwarf.c (free_line_header): Don't free dirs if dirs_count == 0.
(read_line_header): Don't allocate dirs if dirs_count == 0.
* edtest.c: New file.
* edtest2.c: New file.
* Makefile.am (edtest_SOURCES, edtest_LDADD): Define.
(check_PROGRAMS): Add edtest.
(edtest2_build.c, gen_edtest2_build): New targets.
* Makefile.in: Rebuild.
* elf.c (backtrace_initialize): Always set *fileline_fn.
* ttest.c: New file.
* btest.c: Move support functions into testlib.c.  Change calls to
check to pass file name.
* testlib.c: New file, copied from (part of) btest.c.
* testlib.h: New file, declarations for testlib.c.
* edtest.c: Use testlib.h and testlib.c.
* configure.ac: Test for -pthread, set HAVE_PTHREAD conditional.
* Makefile.am (btest_SOURCES): Add testlib.c.
(edtest_SOURCES): Likewise.
(CHECK_PROGRAMS): Add ttest if HAVE_PTHREAD.
(ttest_SOURCES, ttest_CFLAGS, ttest_LDADD): Define.
* configure, Makefile.in: Rebuild.
* configure.ac: Add AC_SYS_LARGEFILE.
* config.h.in: Regenerate.
* configure: Likewise.
* filetype.awk: Add AIX XCOFF type detection.
* configure.ac: Recognize xcoff format.
* Makefile.am (FORMAT_FILES): Add xcoff.c.
* fileline.c: Include <unistd.h>.
(fileline_initialize): Add case for AIX procfs.
* xcoff.c: New file.
* configure, Makefile.in: Rebuild.
* configure.ac: Check for XCOFF32/XCOFF64.  Check for loadquery.
* filetype.awk: Separate AIX XCOFF32 and XCOFF64.
* xcoff.c: Add support for AIX XCOFF32 and XCOFF64 formats.
* configure, config.h.in: Regenerate.
* fileline.c (fileline_initialize): Print pid_t as long.
* xcoff.c: Don't leak a file descriptor if an archive is malformed.
* xcoff.c (xcoff_process_linenos): Initialize incl to NULL.
* libbacktrace/Makefile.in
(HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ttest_CFLAGS): Add $(AM_CFLAGS)
* Makefile.am (ttest_CFLAGS): Add $(AM_CFLAGS)
* Makefile.in: Regenerate.

Change-Id: Ib61ad222b79b9c3a38d35705608f74041acc767a

6 years agoRevert Tizen version of PR sanitizer/77631. 51/181151/3
Denis Khalikov [Wed, 6 Jun 2018 16:40:01 +0000 (19:40 +0300)]
Revert Tizen version of PR sanitizer/77631.

Revert commit related to PR sanitizer/77631 implementation
for the Tizen GCC. The feature should has an upstream
implementation.

Change-Id: I1ddf629e229d667877a69d80dd0d6295400b533a

6 years ago[ESan] EfficiencySanitizer implementation. 59/174159/9
Denis Khalikov [Wed, 24 Jan 2018 10:55:22 +0000 (13:55 +0300)]
[ESan] EfficiencySanitizer implementation.

EfficiencySanitizer (WorkingSet tool and CacheFragmentation tool)
implementation for X86_64 and armv7l.

The ESan is a set of compiler-based tools for analyzing targeted
performance problems.

This patch includes:

1. GCC pass.

1.1. GCC pass for WorkingSet tool.
Special compiler pass instruments every memory access in the program.
Memory accesses are simply prepended with a function call like
__esan_aligned_load(addr), __esan_aligned_store(addr).

1.2. GCC pass for CacheFragmentation tool.
Special compiler pass instruments every memory access to the struct
field. Creates fields counter array, each cell of that array
counts memory access to the special field. Creates array of
struct, where every instance of the struct represetnts meta info
of the real struct and so on.

A call to __esan_init is inserted to the static constructor.
A call to __esan_exit is inserted to the static destructor.

2. Runtime library.

2.1. WorkingSet tool.
The runtime library simply manages shadow memory and computes statistic
of the program efficiency. The tool maps one cashe line (64 bytes) of
the program to the one byte of the shadow memory. Runtime library measures
the data working set size of an application at each snapshot during
execution. It can help understand phased behavior as well as providing basic
direction for futher effort by the developer: e.g., knowing whether the working
set is close to fitting in current L3 cashes or is many times larger can help
to determine where to spend effort.

2.2. CacheFragmentation tool.
The runtime part prints statistics about an amount of field accesses and
detailed information about which field was actually accessed.

3. Testsuite.
Simple testsuite.

4. HOW TO USE:

4.1. WorkingSet tool.
To measure the working set size, you should build your binary or shared library
with compile time flag -fsanitize=efficiency-working-set and
set runtime options ESAN_OPTIONS=process_range_access=1:record_snapshots=1

4.2. CacheFragmentation tool.
To enable CacheFragmentation tool you should compile your binary or
shared library with compile time flag -fsanitize=efficiency-cache-frag
and set runtime options ESAN_OPTIONS=build_mode=0:verbosity=1

Change-Id: Ie3231d3defa183712997e6fca39b1e8b4586e9b7

6 years agopackaging: Add -marm and -fno-omit-frame-pointer 48/183448/2
Denis Khalikov [Thu, 5 Jul 2018 10:04:58 +0000 (13:04 +0300)]
packaging: Add -marm and -fno-omit-frame-pointer

To enable "fastunwinder" work on armv7l we should explicitly
build libasan with -marm and -fno-omit-frame-pointer.

Change-Id: I28e763fa7b088aa26a81e7bb6d3a7fa9ba7a714b

6 years ago[ASan] Intercept mcheck and mprobe on Linux 67/175667/3 accepted/tizen/base/20180413.181204 accepted/tizen/base/20180420.170848 submit/tizen_base/20180412.024656 submit/tizen_base/20180417.073401
Slava Barinov [Wed, 11 Apr 2018 09:57:23 +0000 (12:57 +0300)]
[ASan] Intercept mcheck and mprobe on Linux

This patch addresses https://github.com/google/sanitizers/issues/804.

Users can use mcheck and mprobe functions to verify heap state so we should
intercept them to avoid breakage of valid code.

Differential Revision: https://reviews.llvm.org/D32589
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302001 91177308-0d34-0410-b5e6-96231b

Change-Id: I310e0e06d0ad4450acf779630acfb71cde9ea1d2
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
6 years agopackaging: Bootstrap compiler optimization 52/162552/7 submit/tizen_base/20180411.052502
Oleg Ogurtsov [Thu, 11 Jan 2018 09:53:42 +0000 (12:53 +0300)]
packaging: Bootstrap compiler optimization

Change-Id: Ie1e12ff3ae5c0550254f58da4750830e5739d3f5

6 years ago[ASan] Fix for TTC-5 (PR sanitizer/81697). 31/173031/1 accepted/tizen/base/20180406.180244 accepted/tizen/base/20180416.213938 submit/tizen_base/20180330.064117 submit/tizen_base/20180416.141938
Denis Khalikov [Mon, 19 Mar 2018 06:43:09 +0000 (09:43 +0300)]
[ASan] Fix for TTC-5 (PR sanitizer/81697).

gcc/

2017-11-30  Maxim Ostapenko  <m.ostapenko@samsung.com>

PR sanitizer/81697
* asan.c (asan_protect_global): Add new ignore_decl_rtl_set_p
parameter. Return true if ignore_decl_rtl_set_p is true and other
conditions are satisfied.
* asan.h (asan_protect_global): Add new parameter.
* varasm.c (categorize_decl_for_section): Pass true as second parameter
to asan_protect_global calls.

gcc/testsuite/

2017-11-30  Maxim Ostapenko  <m.ostapenko@samsung.com>

PR sanitizer/81697
* c-c++-common/asan/pr81697.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255283 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I4568c3d228286d2a372c1e5c3a1dde62561ace74

6 years ago[ASan] Revert commit related to TTC-5 (PR sanitizer/81697). 30/173030/1
Denis Khalikov [Mon, 19 Mar 2018 06:08:53 +0000 (09:08 +0300)]
[ASan] Revert commit related to TTC-5 (PR sanitizer/81697).

We might have a strange situation with ASan and TLS,
when TLS_index struct should be defined as
.word   .LANCHOR0(tlsldm),
but patch for TTC-5 assumes that is no ANCHOR sections
with ASan at all. So, in this specific case we pass TLS_index
struct with wrong alignment to __tls_get_addr () function
which cause a SEGV.

Next commit fix sanitizer/81697 with patch from upstream.

Change-Id: I9ee35ade027d246870bf57387f40217226efb7cc

6 years ago[Sanitizers] Revert commit related to SUMMARY report 98/163498/3
Denis Khalikov [Mon, 11 Dec 2017 14:01:48 +0000 (17:01 +0300)]
[Sanitizers] Revert commit related to SUMMARY report

The commit with Change-Id: Ia258f1e3906bb095ca0d33d3354dd9b1f640c89f
adds SanitizerToolName to the report buffer, but the same name
is adding later at the line 200, so as result we will get
SanitzerToolName twice at the same buffer, therefore this
patch breaks thread_leaks1.c test, because the test expects
that report includes SanitizerToolname only once.

Change-Id: Ia98811936e4845e12cdde7a7f1286058a0766ada

6 years agoMerge "[asan_build] Enable asaned glibc work." into tizen_base accepted/tizen/base/20180126.040727 submit/tizen_base/20180124.094033
Jaehun Jeong [Wed, 24 Jan 2018 09:31:10 +0000 (09:31 +0000)]
Merge "[asan_build] Enable asaned glibc work." into tizen_base

6 years agoMerge "[ASAN] Add interceptor for __longjmp_chk" into tizen_base
Jaehun Jeong [Wed, 24 Jan 2018 09:30:17 +0000 (09:30 +0000)]
Merge "[ASAN] Add interceptor for __longjmp_chk" into tizen_base

6 years ago[ASan] Add interceptor for printf_chk 07/164507/1
Denis Khalikov [Tue, 19 Dec 2017 09:47:55 +0000 (12:47 +0300)]
[ASan] Add interceptor for printf_chk

Differential Revision: https://reviews.llvm.org/D40951

Change-Id: I7c32945659da4cf80e995370cb26fb063bb7930c

6 years ago[TTC-11] Embed UBSan into ASan runtime 63/158063/5 accepted/tizen/base/20171215.171112 submit/tizen_base/20171208.084018
Maxim Ostapenko [Fri, 27 Oct 2017 12:14:27 +0000 (15:14 +0300)]
[TTC-11] Embed UBSan into ASan runtime

Change the way we use ASan and UBSan together. Instead of keeping two
separate runtimes (libasan.so and libubsan.so), embed UBSan into ASan.
UBSan initialization code (e.g. flag parsing) is directly called
from ASan initialization, so we are able to enforce correct
initialization order.

This mirrors the approach we already use for ASan+LSan. This change
doesn't modify the way we use standalone UBSan.

gcc/
* config/gnu-user.h: append -lstdc++ if we link against ASan
runtime.
* gcc.c: Do not link against libubsan.so if
-fsanitize=address,undefined is used.

gcc/testsuite/
* c-c++-common/asan/asan_and_ubsan-1.c: New test.

libsanitizer/

* Makefile.am: Build UBSan strictly before ASan.
* Makefile.in: Regenerate.
* asan/Makefile.am: Embed UBSan into ASan runtime.
* asan/Makefile.in: Regenerate.
* configure.ac: Configure UBSan strictly before ASan.
* configure: Regenerate.
ubsan/ubsan_diag.cc (__sanitizer_print_stack_trace): Move to ...
ubsan/ubsan_diag_standalone.cc: ... here.
* ubsan/Makefile.am: Create a "plugin" library to be embedded
into ASan runtime.
* ubsan/Makefile.in: Regenerate.

Change-Id: Ia848a93929effb4b0ec057243c7343c1bd94fbfb
Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
6 years agoUpdate ChangeLog.Tizen 19/163119/1 accepted/tizen/base/20171208.204010 submit/tizen_base/20171207.085008
Dongkyun Son [Thu, 7 Dec 2017 08:46:37 +0000 (17:46 +0900)]
Update ChangeLog.Tizen

Change-Id: If40d54536b967f821dc54eb15d71d81600df7395
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
6 years ago[TSan] Support cross building. 20/159920/5
Denis Khalikov [Fri, 17 Nov 2017 12:37:07 +0000 (15:37 +0300)]
[TSan] Support cross building.

In case we want to build binary with TSan for aarch64
CPU under qemu-user on x86_64 CPU, we should make sure
that we don't make any architecture dependent checks at
the runtime.
To support this, new flag "run_under_qemu" was added and
now available under TSAN_OPTIONS.

Change-Id: Ifad929d284d30b720afd60a60a88fa129f37d4a6

6 years ago[TSan] TSan options. 68/155968/3
Denis Khalikov [Mon, 16 Oct 2017 16:03:16 +0000 (19:03 +0300)]
[TSan] TSan options.

Enable TSan to read options from file.

Change-Id: I86286365a72ba1b1f9971018125140b9d7e518e4

6 years ago[TSan] Fix TSan initializaion. 89/152589/3
Denis Khalikov [Tue, 26 Sep 2017 09:34:21 +0000 (12:34 +0300)]
[TSan] Fix TSan initializaion.

TSan uses procfs for every ThreadContext.
We should ensure that procfs is mounted, to
avoid an error when TSan is initializing.

Change-Id: I8e9a3ec6f8920c95b5246bda56f5c55ef9fffb0e

6 years agopackaging: Add tsan_interface_atomic header. 76/155276/2
Denis Khalikov [Thu, 12 Oct 2017 14:19:17 +0000 (17:19 +0300)]
packaging: Add tsan_interface_atomic header.

Change-Id: I8f51690ede737591606612f674f6c7729113d587

6 years agoAdd a runtime flag Wprint-abs-path 34/161434/3
Oleg Ogurtsov [Thu, 23 Nov 2017 09:30:36 +0000 (12:30 +0300)]
Add a runtime flag Wprint-abs-path

A runtime flag for printing a real path to the source file on warning.

gcc/
* Makefile.in: added dependencies of linking.
* common.opt: added a flag description.
* diagnostic.c: added the dependence of the runtime flag and
implementation.

Change-Id: I3eb9178892f3c230845dc8e5c9ab4e1b1613f6f0

6 years ago[ASAN] Add interceptor for __longjmp_chk 77/162177/1
Peter Wu [Wed, 29 Nov 2017 10:35:54 +0000 (13:35 +0300)]
[ASAN] Add interceptor for __longjmp_chk

Summary:
glibc on Linux calls __longjmp_chk instead of longjmp (or _longjmp) when
_FORTIFY_SOURCE is defined. Ensure that an ASAN-instrumented program
intercepts this function when a system library calls it, otherwise the
stack might remain poisoned and result in CHECK failures and false
positives.

Fixes https://github.com/google/sanitizers/issues/721

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D32408

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302152 91177308-0d34-0410-b5e6-96231b3b80d8
Change-Id: I756e6a66139bc4ee95d3af1be792b025efe39ce0

6 years ago[UBSan] Add __sanitizer_print_stack_trace() for UBSan 81/157681/5 submit/tizen_base/20171123.084139
Dmitriy Nikiforov [Wed, 25 Oct 2017 17:31:52 +0000 (20:31 +0300)]
[UBSan] Add __sanitizer_print_stack_trace() for UBSan

libsanitizer/
* ubsan/ubsan_diag.cc (__sanitizer_print_stack_trace): New function.
* ubsan/ubsan_diag.cc (PrintStackTrace): New function.

Change-Id: I270b3765a571381fcf400b8e54f66dfa291e4862

7 years agoUpdate Commit Date and Hash on ChangeLog.Tizen 74/160174/1
Dongkyun Son [Tue, 14 Nov 2017 23:33:51 +0000 (08:33 +0900)]
Update Commit Date and Hash on ChangeLog.Tizen

Change-Id: If32843d528c75e302fd7b749412164a3dd4b6520
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
7 years agoUpdate ChangeLog.Tizen 70/160070/1 accepted/tizen/base/20171117.154048 submit/tizen_base/20171114.100800
Dongkyun Son [Tue, 14 Nov 2017 09:51:27 +0000 (18:51 +0900)]
Update ChangeLog.Tizen

Change-Id: I3033eda2a4765879ed889935b17cbc6600944474
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
7 years ago[asan_build] Enable asaned glibc work. 01/152901/6
Denis Khalikov [Tue, 26 Sep 2017 18:51:35 +0000 (21:51 +0300)]
[asan_build] Enable asaned glibc work.

Modify GetPageSize () function to return
4096 for arm and arch64 architectures. We can
not call sysconf from libc befor libc is inited.

Mark libasan as initfirst, in this case "patched" rtld
will be able to initiazlie libasan before libc.so

Change-Id: I56a582fdeafcf55b9dbab8fcd1b39be850cccc04

7 years ago[ISan] Fix ICE with ISan and -ftree-loop-vectorize 53/159253/3
Denis Khalikov [Tue, 7 Nov 2017 16:10:03 +0000 (19:10 +0300)]
[ISan] Fix ICE with ISan and -ftree-loop-vectorize

In case we want to vectorize the loop, we can not
rely only on TREE_OVERFLOW flag, while folding the INTEGER_CST,
which represents the step of vectorization.
We still should check TYPE_OVERFLOW_WRAPS flag instead
TYPE_OVERFLOW_SANITIZED flag, because the step could
be already marked as TREE_OVERFLOW == 1.

Change-Id: I1288b7e3b587c5773b184636bdfdada168b8941f

7 years ago[ISan] Fix issue with constexpr. 84/158084/8
Denis Khalikov [Mon, 30 Oct 2017 16:12:50 +0000 (19:12 +0300)]
[ISan] Fix issue with constexpr.

The semantic of the constexpr does not allow us
to convert POINTER type to INTERGER type inside constexpr.
All ISAN instrumentation should be folded, but it's
little bit tricky, in case we should convert INTEGER
type back to POINTER type, because INTEGER type could
not be assigned to POINTER type.
Another issue is that some actual value of PARM_DECL
could not be getting by "constexpr context" and
could not be folded.
So, just disable ISAN insrumentation and pointer
conversions for constexpr semantic. In this case we
can rely on current_function_decl while processing function,
but also should handle constexpr with pointers:
constexpr unsigned *pointer = ptr + index;

Change-Id: I68eb660438a1acd881207219c3d72045c445dcb7

7 years agoImplement suppression list support for ISan. 18/158718/2 sandbox/ibaravy/isan
Ivan Baravy [Thu, 2 Nov 2017 13:02:53 +0000 (16:02 +0300)]
Implement suppression list support for ISan.

Change-Id: I41a8c572d30626caa45acf30758e00219b40bf03

7 years agoImplement ISan: unsigned integer overflow checker. 17/158717/1
Maxim Ostapenko [Thu, 1 Jun 2017 13:21:11 +0000 (16:21 +0300)]
Implement ISan: unsigned integer overflow checker.

ISan in FE.
Handle all s and u cases.
Add unit and regression tests.

Change-Id: I3f60f751598d904683264372541c2d3be0076768

7 years agopackaging: add %arm to lsan_arch 25/157225/2
Dongkyun Son [Tue, 24 Oct 2017 01:22:21 +0000 (10:22 +0900)]
packaging: add %arm to lsan_arch

libasan.so.* are installed, but unpackaged in armv7hl.

Change-Id: I713fdcc3b157f3578995fa26b9d8d4754f937bfa
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
7 years ago[TTC-8][Sanitizers] Add tests for allocator_may_return_null=1 flag 38/149938/2 accepted/tizen/base/20171027.152140 submit/tizen_base/20171024.003248
Slava Barinov [Wed, 13 Sep 2017 15:13:49 +0000 (18:13 +0300)]
[TTC-8][Sanitizers] Add tests for allocator_may_return_null=1 flag

The LLVM test has been rewritten to be able to run inside GCC test suite.

Change-Id: Ifaf9e3681ddacfaad73a314a01ab3c6c7704d40b
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years ago[TTC-8][Sanitizers] 64 bit allocator respects allocator_may_return_null flag 37/149937/3
Alex Shlyapnikov [Wed, 13 Sep 2017 13:22:49 +0000 (16:22 +0300)]
[TTC-8][Sanitizers] 64 bit allocator respects allocator_may_return_null flag

Summary:
Make SizeClassAllocator64 return nullptr when it encounters OOM, which
allows the entire sanitizer's allocator to follow
allocator_may_return_null=1 policy
(LargeMmapAllocator: D34243, SizeClassAllocator64: D34433).

Reviewers: eugenis

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34540

Change-Id: I0e72b4b22a440eb644dcc370da0ba9aa0e71c2d5
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306342 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TTC-8][Sanitizers] 32 bit allocator respects allocator_may_return_null flag 36/149936/2
Alex Shlyapnikov [Wed, 13 Sep 2017 12:57:12 +0000 (15:57 +0300)]
[TTC-8][Sanitizers] 32 bit allocator respects allocator_may_return_null flag

Summary:
Make SizeClassAllocator32 return nullptr when it encounters OOM, which
allows the entire sanitizer's allocator to follow allocator_may_return_null=1
policy, even for small allocations (LargeMmapAllocator is already fixed
by D34243).

Will add a test for OOM in primary allocator later, when
SizeClassAllocator64 can gracefully handle OOM too.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34433

Change-Id: I2853a00cff5202189c5d4b15b1934c63d5206708
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305972 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TTC-8][Sanitizers] Secondary allocator respects allocator_may_return_null=1. 35/149935/2
Alex Shlyapnikov [Wed, 13 Sep 2017 12:50:25 +0000 (15:50 +0300)]
[TTC-8][Sanitizers] Secondary allocator respects allocator_may_return_null=1.

Summary:
Context: https://github.com/google/sanitizers/issues/740.

Making secondary allocator to respect allocator_may_return_null=1 flag
and return nullptr when "out of memory" happens.

More changes in primary allocator and operator new will follow.

Reviewers: eugenis

Subscribers: kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34243

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305569 91177308-0d34-0410-b5e6-96231b3b80d8

Change-Id: I534117600099ec8953a6d83c559da0cf3bdfb5ad

7 years ago[TTC-9] Make LSan compliant with recovery mode when running on top of ASan 63/150163/4
Slava Barinov [Thu, 14 Sep 2017 09:42:17 +0000 (12:42 +0300)]
[TTC-9] Make LSan compliant with recovery mode when running on top of ASan

Don't overwrite exit code in LSan when running on top of ASan in recovery mode
to avoid breakage of users code due to found leaks.

Change-Id: I172f59734837d3df350c9e586ace2547ae9f3f23
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years agoAdd armv7hl support. 10/129010/5
Mikhail Kashkarov [Fri, 5 May 2017 14:00:49 +0000 (17:00 +0300)]
Add armv7hl support.

Change-Id: Ib611ee4659af5e30b2a9c46ded7588b5a5c139fa

7 years agopackaging: clean-up sanitizer macros. 37/151137/2
Dongkyun Son [Tue, 19 Sep 2017 05:33:20 +0000 (14:33 +0900)]
packaging: clean-up sanitizer macros.

sanitizer related macros moved to 'gcc-contrib' package.

Change-Id: Ic8ed52aac4a502f2bf44053225b2e29e721699d6
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
7 years agopackaging: provide libasan(64bit) on 32bit build env 89/147289/5 accepted/tizen/base/20170915.204826 submit/tizen_base/20170914.121419
Dongkyun Son [Fri, 1 Sep 2017 15:35:56 +0000 (00:35 +0900)]
packaging: provide libasan(64bit) on 32bit build env

This is needed as it requires 64bit libs into i586 repo, sometimes.
(e.g, .NET toolchain asan build).

Change-Id: Ia18f132b19e8552b347132531f3e12000aa34514
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
7 years agoFixed aarch64 build. 25/149625/1
jakub [Tue, 24 Jan 2017 00:18:36 +0000 (00:18 +0000)]
Fixed aarch64 build.

PR sanitizer/79168
   * merge.sh (change_comment_headers): Don't remove 2nd and 3rd line
  if the 3rd line doesn't contain 'The LLVM Compiler Infrastructure'
  text.
  * sanitizer_common/sanitizer_linux_mips64.S: Regenerated.
  * sanitizer_common/sanitizer_linux_x86_64.S: Likewise.
  * tsan/tsan_ppc_regs.h: Likewise.
  * tsan/tsan_rtl_aarch64.S: Likewise.
  * tsan/tsan_rtl_mips64.S: Likewise.
  * tsan/tsan_rtl_ppc64.S: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244844 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I384d6d121d2e0fcd2947400c14082f7b83e8cb20
Signed-off-by: Michail Kashkarov <m.kashkarov@partner.samsung.com>
7 years ago[TTC-6] packaging: Support for gcc-contrib. 51/145951/5 submit/tizen_base/20170911.070012
Denis Khalikov [Fri, 18 Aug 2017 15:07:28 +0000 (18:07 +0300)]
[TTC-6] packaging: Support for gcc-contrib.

This patch deletes all scripts from gcc *spec files.
All scripts moved to gcc-contrib package.

Change-Id: I847a5c61b69cc74aadf59c31e3b04a404a4d13b0

7 years ago[TTC-5] Forbid section anchors for ASan build (PR sanitizer/81697) 36/143336/3 accepted/tizen/base/20170908.223910 submit/tizen_base/20170905.003244 submit/tizen_base/20170907.223110
Slava Barinov [Thu, 3 Aug 2017 13:14:59 +0000 (16:14 +0300)]
[TTC-5] Forbid section anchors for ASan build (PR sanitizer/81697)

       gcc/
       * varasm.c (use_object_blocks_p): Forbid section anchors for ASan

       gcc/testsuite/
       * g++.dg/asan/global-alignment.C: New test to test global
       variables alignment.

Change-Id: I3887e356397c599ec74793de6d60bc285a2c872b
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years agoAdd ChangeLog.Tizen 74/138574/5 accepted/tizen/base/20170908.223816 submit/tizen_base/20170830.083645
Sangmin Seo [Wed, 9 Aug 2017 05:18:33 +0000 (14:18 +0900)]
Add ChangeLog.Tizen

ChangeLog.Tizen is to keep track of private patches for Tizen GCC.

Change-Id: I2fbde58d410ab4a7ddbda361be86a48de9d891e3

7 years agopackaging: Add libasan as requires for asan-runtime-env 83/145083/3
Hoyub Lee [Mon, 21 Aug 2017 07:10:12 +0000 (16:10 +0900)]
packaging: Add libasan as requires for asan-runtime-env

Installing asan-runtime-env without libasan invokes error from ld.so.
Therefore, it is correct to add libasan as requires.

Change-Id: I9d2e2a3f60369b1332d7280b6cc6253a73e36439
Signed-off-by: Hoyub Lee <hoyub.lee@samsung.com>
7 years agopackaging: Set shadow address space to unlimited for ASan 09/146109/3
Chan Lee [Fri, 25 Aug 2017 01:46:44 +0000 (10:46 +0900)]
packaging: Set shadow address space to unlimited for ASan

Currently, at the beginning of gbs build, shadow address space is set
according to the environment of the host machine. It makes ASan build
fail because ASan needs a whole shadow address space.

Actually ASan tries to set the value to unlimited at init time( ASanInitInternal() )
but it failes because of lack of permission like below.

[   39s] ==6800==ERROR: AddressSanitizer setrlimit() failed 1

The value could be set at package install time because the user
is 'root' at this time.
Using ulimit can only set the value for current user('root') not 'abuild'
which is the user at build time so we need to set /etc/security/limits.conf directly.

Change-Id: Ia03911a37a689c186d0e028d01b665cf6a0c3073
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
7 years agopackaging: Force options for native compiler only 55/143555/2
Slava Barinov [Thu, 10 Aug 2017 08:05:46 +0000 (11:05 +0300)]
packaging: Force options for native compiler only

If both native and cross-compiler are installed (e. g. in qemu-accel build) the
gcc-force-options should only accelerate native compiler in order to keep
gcc-unforce-options work.

Change-Id: I1454fb199e6f849b89f7b16129e005894d800cbc
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years agopackaging: remain ld.so.preload.org 28/145728/2
Chan Lee [Wed, 23 Aug 2017 11:28:57 +0000 (20:28 +0900)]
packaging: remain ld.so.preload.org

Original file should be remained to restore when uninstalling rpm.

Change-Id: Id5e5b82ff327e14db966b142248d6a5a3e17917c
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
7 years agoPR sanitizer/77631 56/134256/16
Denis Khalikov [Sat, 29 Jul 2017 19:18:59 +0000 (22:18 +0300)]
PR sanitizer/77631

    * Makefile.am: Updated.
    * configure.ac: Updated.
    * configure: Regenerated.
    * Makefile.in: Regenerated.
    * elf.c (enum type_of_file): New enum.
    (enum type_of_elf): New enum.
    (enum debug_path): New enum.
    (get_uint32): New function.
    (get_crc32): New function.
    (base_name_len): New function.
    (check_sum): New function. Verify sum.
    (process_elf_header): New function. Process elf header.
    (elf_get_section_by_name): New function. Get section by name.
    (backtrace_readlink): New function. Get type of file from filename.
    (resolve_realname): New function. Resolve real name if file is link.
    (backtrace_resolve_realname): New function. Resolve real name for any
    file type.
    (search_for_debugfile): New function. Search for debug file in known
    paths.
    (open_debugfile_by_gnulink): New function. Open debug file with
    gnulink.
    (hex): New function. Convert to hex.
    (get_build_id_name): New function. Generate build-id name.
    (open_debugfile_by_build_id): New function. Open debug file with
    build-id.
    (backtrace_open_debugfile): New function. Open debug file.
    (get_exec_filename): New function. Get pathname of the executable.
    (elf_add): Move code which reads elf header, headers section and names
    section to process_elf_header.
    Call backtrace_open_debugfile_file for executable.
    (phdr_callback): Call backtrace_open_debugfile function for shared
    library.
    * crc32.c: New file.
    (gnu_debuglink_crc32): New function. Generate crc32 sum.

Change-Id: I30d9fbcfa24b3aadf3b7c54525dccedd60cd1a5d

7 years ago[ubsan] Fix ICE 79/136679/7 accepted/tizen/base/20170901.225743 submit/tizen_base/20170823.100418
Denis Khalikov [Sun, 2 Jul 2017 15:47:03 +0000 (18:47 +0300)]
[ubsan] Fix ICE

   While we have a current_function_decl in this case,
   still create_tmp_var's called gimple_add_tmp_var and
   mark_addressable don't work too well when the current
   function is a C++ ctor or dtor that the FE then duplicates

   2017-06-27  Jakub Jelinek  <jakub@redhat.com>

   PR sanitizer/81209
   * ubsan.c (ubsan_encode_value): Initialize DECL_CONTEXT on var.
   * g++.dg/ubsan/pr81209.C: New test.

   2017-06-20  Jakub Jelinek  <jakub@redhat.com>

   PR sanitizer/81125
   * ubsan.h (ubsan_encode_value): Workaround buggy clang++ parser
   by removing enum keyword.
   (ubsan_type_descriptor): Likewise.  Formatting fix.

   2017-06-19  Jakub Jelinek  <jakub@redhat.com>

   PR sanitizer/81125
   * ubsan.h (enum ubsan_encode_value_phase): New.
   (ubsan_encode_value): Change second argument to
   enum ubsan_encode_value_phase with default value of
   UBSAN_ENCODE_VALUE_GENERIC.
   * ubsan.c (ubsan_encode_value): Change second argument to
   enum ubsan_encode_value_phase PHASE from bool IN_EXPAND_P,
   adjust uses, for UBSAN_ENCODE_VALUE_GENERIC use just
   create_tmp_var_raw instead of create_tmp_var and use a
   TARGET_EXPR.
   (ubsan_expand_bounds_ifn, ubsan_build_overflow_builtin,
   instrument_bool_enum_load, ubsan_instrument_float_cast): Adjust
   ubsan_encode_value callers.

   PR sanitizer/81111
   * ubsan.c (ubsan_encode_value): If current_function_decl is NULL,
   use create_tmp_var_raw instead of create_tmp_var, mark it addressable
   just by setting TREE_ADDRESSABLE on the result and use a TARGET_EXPR.

   PR sanitizer/81125
   * g++.dg/ubsan/pr81125.C: New test.

   PR sanitizer/81111
   * g++.dg/ubsan/pr81111.C: New test.

   git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@249480 138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: I3b7816b4f9b1bb5916adf3684dcbcc5284e50954

7 years ago[UBSAN] Fix systemd initialization with UBSan. 27/143127/1
Denis Khalikov [Tue, 8 Aug 2017 13:35:33 +0000 (16:35 +0300)]
[UBSAN] Fix systemd initialization with UBSan.

In case systemd was build with UBSan we should
ensure that /proc is mounted, to prevent booting
error.

Change-Id: I52016a5e440f311c85f6fe2cad1dfd7966976651
Signed-off-by: Denis Khalikov <d.khalikov@partner.samsung.com>
7 years ago[asan] Revert ABI changes after ASan patches backporting 65/138565/3 accepted/tizen/4.0/base/20170811.092812 accepted/tizen/4.0/base/20170828.221138 accepted/tizen/base/20170804.132713 submit/tizen_4.0_base/20170811.071500 submit/tizen_4.0_base/20170828.000000 submit/tizen_4.0_base/20170828.000001 submit/tizen_base/20170804.023302
Slava Barinov [Wed, 12 Jul 2017 08:21:11 +0000 (11:21 +0300)]
[asan] Revert ABI changes after ASan patches backporting

       gcc/
       * asan.c: Remove __odr_indicator usage.
       * asan_globals.cc: Likewise.
       libsanitizer/
       * asan/asan_init_version.h: Revert asan version to 6.
       * asan/asan_interface_internal.h: Remove __odr_indicator.
       * asan/libtool-version: Revert shared object version to 3.

Change-Id: I9f1c1766b7d00d659f9f47468f9293aeb52a0faf
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years agogcc/ 64/138564/5
chefmax [Tue, 8 Nov 2016 22:16:58 +0000 (22:16 +0000)]
gcc/

* asan.h (asan_intercepted_p): Handle BUILT_IN_STRCSPN,
BUILT_IN_STRPBRK, BUILT_IN_STRSPN and BUILT_IN_STRSTR.

Change-Id: I1560e575cd81bbe1c732f696bed559abe0f4ed9c
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241984 138bc75d-0d04-0410-961f-82ee72b054a4

7 years agogcc/ 63/138563/3
chefmax [Tue, 8 Nov 2016 22:15:35 +0000 (22:15 +0000)]
gcc/

* asan.h (ASAN_STACK_MAGIC_PARTIAL): Remove.
* asan.c (ASAN_STACK_MAGIC_PARTIAL): Replace with
ASAN_STACK_MAGIC_MIDDLE.

gcc/testsuite/

* c-c++-common/asan/null-deref-1.c: Adjust testcase.

Change-Id: I348a6339d17a2cb7faf293cefdc615d1d53d237a
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241983 138bc75d-0d04-0410-961f-82ee72b054a4

7 years agolibsanitizer/ 62/138562/3
chefmax [Tue, 8 Nov 2016 22:07:50 +0000 (22:07 +0000)]
libsanitizer/

* sanitizer_common/sanitizer_stacktrace.cc (GetCanonicFrame): Assume we
compiled code with GCC when extracting the caller PC for ARM if no
valid frame pointer is available.

Change-Id: Ic974dcb0800c15eabf74a2c78f791c6cedc1aa44
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241980 138bc75d-0d04-0410-961f-82ee72b054a4

7 years agoPR sanitizer/63958 61/138561/4
chefmax [Tue, 8 Nov 2016 22:06:02 +0000 (22:06 +0000)]
PR sanitizer/63958

Reapply:
2014-10-14  David S. Miller  <davem@davemloft.net>

* sanitizer_common/sanitizer_platform_limits_linux.cc (time_t):
Define at __kernel_time_t, as needed for sparc.
(struct __old_kernel_stat): Don't check if __sparc__ is defined.
* libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
(__sanitizer): Define struct___old_kernel_stat_sz,
struct_kernel_stat_sz, and struct_kernel_stat64_sz for sparc.
(__sanitizer_ipc_perm): Adjust for sparc targets.
(__sanitizer_shmid_ds): Likewsie.
(__sanitizer_sigaction): Likewise.
(IOC_SIZE): Likewsie.

Change-Id: Iccdb7e974d8cb8fe5f6581da6b74b33c5bae7a9b
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241978 138bc75d-0d04-0410-961f-82ee72b054a4

7 years agolibsanitizer/ 60/138560/5
chefmax [Tue, 8 Nov 2016 22:04:09 +0000 (22:04 +0000)]
libsanitizer/

* All source files: Merge from upstream 285547.
* configure.tgt (SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS): New
variable.
* configure.ac (SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS): Handle it.
* asan/Makefile.am (asan_files): Add new files.
* asan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Likewise.
* lsan/Makefile.in: Likewise.
* tsan/Makefile.am (tsan_files): Add new files.
* tsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add new files.
(EXTRA_libsanitizer_common_la_SOURCES): Define.
(libsanitizer_common_la_LIBADD): Likewise.
(libsanitizer_common_la_DEPENDENCIES): Likewise.
* sanitizer_common/Makefile.in: Regenerate.
* interception/Makefile.in: Likewise.
* libbacktace/Makefile.in: Likewise.
* Makefile.in: Likewise.
* configure: Likewise.
* merge.sh: Handle builtins/assembly.h merging.
* builtins/assembly.h: New file.
* asan/libtool-version: Bump the libasan SONAME.

Change-Id: I47a2591215c7529613d22a117644607b20db065b
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241977 138bc75d-0d04-0410-961f-82ee72b054a4

7 years agoFix cleanup location for try_finally_expr. 59/138559/4
Slava Barinov [Thu, 6 Jul 2017 13:14:58 +0000 (16:14 +0300)]
Fix cleanup location for try_finally_expr.

        gcc/
        * tree.def: Add STATEMENT_LIST_END tree code.
        * tree.c: Add STATEMENT_LIST_END handling as TS_COMMON.
        * gimplify.c (gimplify_expr): Use STATEMENT_LIST_END location to
        provide right information for try_finally_expr.
        * tree-eh.c (lower_try_finally_onedest): Set finally location
        * c-family/c-semantics.c (pop_stmt_list): Support single-statement
        lists extraction with STATEMENT_LIST_END in the end.
        * fold-const.c (operand_equal_p): Add STATEMENT_LIST_END support.
        gcc/cp/
        * parser.c (cp_parser_compound_statement): Use STATEMENT_LIST_END
        to keep the location of closing brace.
        * pt.c: Handle STATEMENT_LIST_END.
        * constraint.cc (check_function_concept): Handle concept definitions
        with STATEMENT_LIST_END.
        * error.c (dump_expr): Add STATEMENT_LIST_END support.
        gcc/testsuite/
        * g++.dg/ext/statement-list-end.C: New.

Change-Id: Id22e953b97b52d0f2a2ba44065337a59639578db
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years agopackaging: Enable ASan bootstrap for ASan projects 50/141350/3
Slava Barinov [Tue, 25 Jul 2017 08:44:17 +0000 (11:44 +0300)]
packaging: Enable ASan bootstrap for ASan projects

GCC will be built in ASan projects.

To test the GCC package the rpm macro `asanbootstrap' should be defined in
project config.

Change-Id: Id91425e2895f63ec92c8e83fb96f93aaade67728
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years agoPR libstdc++/77356 07/141007/3
timshen [Sat, 27 Aug 2016 02:03:23 +0000 (02:03 +0000)]
PR libstdc++/77356

* include/bits/regex_compiler.tcc(_M_insert_bracket_matcher,
_M_expression_term): Modify to support dash literal.
* include/bits/regex_scanner.h: Add dash as a token type to make
a different from the mandated dash literal by escaping.
* include/bits/regex_scanner.tcc(_M_scan_in_bracket): Emit dash
token in bracket expression parsing.
* testsuite/28_regex/regression.cc: Add new testcases.

(cherry-picked from commit 6f2116bed6e87668a914dc27fff34c7a68576d4e)

Change-Id: I8f516ef995f0fb7db479c441c9e7714bab518806
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239794 138bc75d-0d04-0410-961f-82ee72b054a4

7 years agoPR libstdc++/70745 06/141006/3
timshen [Sat, 23 Apr 2016 03:58:37 +0000 (03:58 +0000)]
PR libstdc++/70745

* include/bits/regex_executor.tcc (_Executor<>::_M_word_boundary):
Fix the match_not_bow and match_not_eow behavior.
* testsuite/28_regex/regression.cc: Add testcase.

(cherry-picked from commit 566d49d6947f4590609562dd5f33d0e6b24a4267)

Change-Id: Ie38f6f857575432c90f9ae17576ddff4c7bc021a
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235382 138bc75d-0d04-0410-961f-82ee72b054a4

7 years agoRemove target-libgfortran from default targets 67/138767/3
Slava Barinov [Thu, 13 Jul 2017 12:59:38 +0000 (15:59 +0300)]
Remove target-libgfortran from default targets

       * configure.ac: Make target-libgfortran a configure option.
       * configure: Regenerate.

This fixes on-host build broken by 58909fae.

Now OBS build works as usual since it provides --enable-libgfortran explicitly
and on-host test builds are not broken with error
`GNU Fortran compiler is not working'

Change-Id: I39ea37ddb0e52c1e2b43e3d304da1389ce615010
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years agoSwitch on detect_leaks on 64-bit platforms by default 27/138927/2
Slava Barinov [Fri, 14 Jul 2017 08:25:35 +0000 (11:25 +0300)]
Switch on detect_leaks on 64-bit platforms by default

       libsanitizer/
       * asan/asan_flags.cc: Switch on leak detection for 64-bit target.
       * lsan/lsan.cc: Likewise.
       * sanitizer_common/sanitizer_flags.inc: Likewise.

Neither the OBS build nor sanitized firmware build are affected.

When Tizen application developer enables ASan for his own package only and run
it in 64-bit emulator (without any additional setup) ASan will report leaks
additionally to all other error messages.

Change-Id: Id16017e9bbe5221778330287c707bdf1846f0760
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
7 years ago[TTC-3] Fix asan_symbolize.py output frame numbers. 08/139808/8
Mikhail Kashkarov [Thu, 20 Jul 2017 11:19:13 +0000 (14:19 +0300)]
[TTC-3] Fix asan_symbolize.py output frame numbers.

If input line already symbolized and has format
'#0 0x7f6e35cf2e45 in func foo:46' - fix internal frame number.

packaging/
    * asan_symbolized.py (have_line_to_symbolized): New function.

Change-Id: I2c52c58f9e2d6dfce709e87dee2abd62b642bcad

7 years ago[TTC-2] Fix asan_symbolize.py for C++ function prototypes detection. 77/138777/3
Mikhail Kashkarov [Thu, 13 Jul 2017 14:02:39 +0000 (17:02 +0300)]
[TTC-2] Fix asan_symbolize.py for C++ function prototypes detection.

Change-Id: Iffa30dce19f99506312a93b79cc8deb05404a82a

7 years agopackaging: append -ldl -lpthread to ASan force options. 96/138496/8
Sangmin Seo [Wed, 12 Jul 2017 09:37:50 +0000 (18:37 +0900)]
packaging: append -ldl -lpthread to ASan force options.

When building for address sanitization, some packages complain about
missing symbols due to omitted -ldl or -pthread.  This patch appends
-ldl and -lpthread to the ASan force options in order to resolve this
kind of issue.  Note that since -ldl and -lpthread are already needed
by libasan, adding them to the ASan force options should not cause any
problems.

This patch also adds -Wl,--as-needed before -ldl -lpthread in the
force options to prevent libdl or libpthread from being linked when
unnecessary.

Change-Id: Ic50059d4684e15773f56c589cfacda0bc944d955
Signed-off-by: Sangmin Seo <sangmin7.seo@samsung.com>
7 years agopackaging: create a wrapper for collect2 in gcc-force-options 55/139255/6
Sangmin Seo [Tue, 18 Jul 2017 05:01:23 +0000 (14:01 +0900)]
packaging: create a wrapper for collect2 in gcc-force-options

gcc-force-options used to prepend/append all force options to the
gcc/g++ wrappers.  This approach worked well for most packages but
caused some configure scripts to behave differently when linker flags
are included in the force options.  For example, if g++ is called with
-ldl appended, it always goes to the linking phase.  As a result, when
configure has expanded AC_PROG_CXXCPP macro, variables related to
preprocessor are not properly set and actual build ends up using
incorrect compile and link flags.

Since prepending or appending linker flags to the linker makes more
sense than carrying them from the compilation phase, this patch
basically divides the force options into compiler flags and linker
ones, and inserts them to corresponding wrappers.  Consequently, a
wrapper for collect2 is created, as we did for gcc and g++, in order
to pass the linker flags to the linker.  Note that collect2 bridges
the compiler and the actual linker, and thus creating a wrapper for
collect2 is more portable and succinct than doing so for linkers.

Change-Id: I8733bf14c5a2c04bfebe38a339c94e7a738cf17c
Signed-off-by: Sangmin Seo <sangmin7.seo@samsung.com>
7 years agopackaging: Add %gcc_force_options and %gcc_unforce_options macros 61/138761/5
Slava Barinov [Thu, 13 Jul 2017 10:35:02 +0000 (13:35 +0300)]
packaging: Add %gcc_force_options and %gcc_unforce_options macros

The macros can be used in certain .spec files to switch off sanitization of
parts or modules without hard-coding sanitizer flags into packages.

Change-Id: I1643a3bdd64a3d48855f02622feb064d482e3655
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Signed-off-by: Sangmin Seo <sangmin7.seo@samsung.com>
7 years agoDo not emit the -Wpsabi note for PR target/77728 16/136916/1 accepted/tizen/base/20170707.183909 submit/tizen_base/20170705.085733
Sangmin Seo [Thu, 29 Jun 2017 07:56:39 +0000 (16:56 +0900)]
Do not emit the -Wpsabi note for PR target/77728

Since PR target/77728 issue did not exist in Tizen/Linaro GCC 4.9.2
and has been resolved with the upstream patches, it does not make
sense to print the -Wpsabi note, which is "parameter passing for
argument of type ... changed in GCC 7.1." This patch removes the
-Wpsabi note generated by the commit
6da83d4adc857ba1c4370b2b8f32825d5cb13ebe
and dg-message comments from the test code.

gcc/config/
    * arm/arm.c (aapcs_layout_arg): Remove code emitting -Wpsabi note.
    (arm_function_arg): Likewise.
    (arm_function_arg_boundary): Likewise.
    (arm_setup_incoming_varargs): Likewise.

gcc/testsuite/
    * g++.dg/abi/pr77728-1.C: Remove dg-message comments.

Change-Id: I5432536052bf9d534e21157ddfd2ac57d25da59f
Signed-off-by: Sangmin Seo <sangmin7.seo@samsung.com>
7 years ago Tests of AAPCS64 updates for alignment attribute 85/134285/2
Mikhail Kashkarov [Thu, 15 Jun 2017 16:47:33 +0000 (19:47 +0300)]
Tests of AAPCS64 updates for alignment attribute

    gcc/testsuite/

        * gcc.target/aarch64/aapcs64/aapcs64.exp: Also execute rec_*.c
        * gcc.target/aarch64/aapcs64/rec_align-5.c: New.
        * gcc.target/aarch64/aapcs64/rec_align-6.c: New.
        * gcc.target/aarch64/aapcs64/rec_align-7.c: New.
        * gcc.target/aarch64/aapcs64/rec_align-8.c: New.
        * gcc.target/aarch64/aapcs64/rec_align-9.c: New.
        * gcc.target/aarch64/aapcs64/test_align-5.c: New.
        * gcc.target/aarch64/aapcs64/test_align-6.c: New.
        * gcc.target/aarch64/aapcs64/test_align-7.c: New.
        * gcc.target/aarch64/aapcs64/test_align-8.c: New.
        * gcc.target/aarch64/aapcs64/test_align-9.c: New.
        * gcc.target/aarch64/aapcs64/rec_vaarg-1.c: New.
        * gcc.target/aarch64/aapcs64/rec_vaarg-2.c: New.

        Backported from trunk:
        84ee090575f413f92377812d277b705d023a4b0b

Change-Id: Idf931ee8b3b5f556b7341734eb940f9a0926a03f

7 years agoImplement AAPCS64 updates for alignment attribute. 84/134284/3
Mikhail Kashkarov [Thu, 15 Jun 2017 14:03:07 +0000 (17:03 +0300)]
Implement AAPCS64 updates for alignment attribute.

        PR target/77728
         gcc/
        * config/aarch64/aarch64.c(aarch64_function_arg_alignmentq):
        Rewrite, looking one level down for records and arrays.
        Ignore TYPE_FIELDS chain decls other than FIELD_DECLs.
        (aarch64_layout_arg): Adjust aarch64_function_arg_alignment caller.
        (aarch64_function_arg_boundary): Likewise.  Simplify using MIN/MAX.
        (aarch64_gimplify_va_arg_expr): Adjust aarch64_function_arg_alignment
         caller.
        testsuite/
        * g++.dg/abi/pr77728-2.C: New test.

        Backported from trunk:
        be35fa06e8f976e1cb880988d5c82813106922fd
        32cb614ad1f60267f914e38da26a73259299d720
        26312b0ea5f3dfc6e3d8d8d18c76d464d6fa328e

Change-Id: I4293167468353e9730dc918b87edda4484af8315

7 years agoPR target/77728 11/134411/3
jakub [Tue, 25 Apr 2017 16:47:32 +0000 (16:47 +0000)]
PR target/77728
* config/arm/arm.c: Include gimple.h.
(aapcs_layout_arg): Emit -Wpsabi note if arm_needs_doubleword_align
returns negative, increment ncrn only if it returned positive.
(arm_needs_doubleword_align): Return int instead of bool,
ignore DECL_ALIGN of non-FIELD_DECL TYPE_FIELDS chain
members, but if there is any such non-FIELD_DECL
> PARM_BOUNDARY aligned decl, return -1 instead of false.
(arm_function_arg): Emit -Wpsabi note if arm_needs_doubleword_align
returns negative, increment nregs only if it returned positive.
(arm_setup_incoming_varargs): Likewise.
(arm_function_arg_boundary): Emit -Wpsabi note if
arm_needs_doubleword_align returns negative, return
DOUBLEWORD_ALIGNMENT only if it returned positive.
testsuite/
* g++.dg/abi/pr77728-1.C: New test.

Backported from trunk:
0e6ba620ce829dbde3ece9cefdbe09355ddfbb74

Change-Id: Ia454a63c3ebb930e546188ded5f339a967d81754
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@247259 138bc75d-0d04-0410-961f-82ee72b054a4