aboutsummaryrefslogtreecommitdiff
path: root/libiberty
AgeCommit message (Collapse)AuthorFilesLines
2017-10-18re PR lto/82598 (lto debugobj lacks .note.GNU-stack)Jakub Jelinek3-1/+21
PR lto/82598 * simple-object.c (handle_lto_debug_sections): Copy over also .note.GNU-stack section with unchanged name. * simple-object-elf.c (SHF_EXECINSTR): Define. (simple_object_elf_copy_lto_debug_section): Drop SHF_EXECINSTR bit on .note.GNU-stack section. From-SVN: r253851
2017-09-26re PR demangler/82195 (Undemangleable lambda)Nathan Sidwell3-22/+56
PR demangler/82195 * cp-demangle.c (d_encoding): Strip return type when name is a LOCAL_NAME. (d_local_name): Strip return type of enclosing TYPED_NAME. * testsuite/demangle-expected: Add and adjust tests. From-SVN: r253186
2017-09-21[demangler PATCH]: Revert and update generic lambda demanglingNathan Sidwell3-77/+85
https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01482.html PR demangler/82195 * cp-demangle.c (d_name): Revert addition of 'toplevel' parm. (has_return_type): Recurse for DEMANGLE_COMPONENT_LOCAL_NAME. (d_encoding): Revert d_name change. Use is_fnqual_component_type to strip modifiers that do not belong. (d_special_name, d_class_enum_type): Revert d_name call change. (d_expresion_1): Commonize DEMANGLE_COMPONENT_UNARY building. (d_local_name): Revert parsing of a function type. (d_print_comp_inner): An inner LOCAL_NAME might contain a TEMPLATE. * testsuite/demangle-expected: Add & adjust tests From-SVN: r253075
2017-09-15[demangler] Fix nested generic lambdaNathan Sidwell3-17/+59
https://gcc.gnu.org/ml/gcc-patches/2017-09/msg00994.html PR demangler/82195 * cp-demangle.c (d_name): Add 'toplevel' parm. Pass to ... (d_local_name): ... here. Parse trailing function args on nested local_name. (d_encoding, d_special_name, d_class_enum_type): Adjust d_name calls. * testsuite/demangle-expected: Add tests. From-SVN: r252815
2017-09-15re PR lto/81968 (early lto debug objects make Solaris ld SEGV)Richard Biener2-54/+74
2017-09-15 Richard Biener <rguenther@suse.de> PR lto/81968 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Iterate marking dependent sections necessary. From-SVN: r252807
2017-09-15[Demangle PATCH] Some pre-fix cleanupsNathan Sidwell3-40/+45
https://gcc.gnu.org/ml/gcc-patches/2017-09/msg00983.html * cp-demangle.c (is_fnqual_component_type): Reimplement using FNQUAL_COMPONENT_CASE. (d_encoding): Hold bare_function_type in local var. (d_local_name): Build name in both cases and build result once. Collapse switch-if to single conditional. * testsuite/demangle-expected: Realign blank lines with tests. From-SVN: r252802
2017-09-12Add DW_CFA_AARCH64_negate_ra_state to dwarf2.def/h and dwarfnames.cJiong Wang2-0/+6
A new vendor CFA DW_CFA_AARCH64_negate_ra_state was introduced for ARMv8.3-A return address signing, it is multiplexing DW_CFA_GNU_window_save in CFA vendor extension space. This patch adds necessary code to make it available to external, the GDB patch (https://sourceware.org/ml/gdb-patches/2017-08/msg00215.html) is intended to use it. A new DW_CFA_DUP for it is added in dwarf2.def. The use of DW_CFA_DUP is to avoid duplicated case value issue when included in libiberty/dwarfnames. Native x86 builds OK to make sure no macro expanding errors. Committed on behalf of Jiong Wang. include/ * dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP. * dwarf2.h (DW_CFA_DUP): New define. libiberty/ * dwarfnames.c (DW_CFA_DUP): New define. From-SVN: r252037
2017-09-01Fix warning for simple-object-elf.c.Martin Liska2-1/+5
2017-09-01 Martin Liska <mliska@suse.cz> * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Remove duplicite declaration. From-SVN: r251584
2017-08-31re PR lto/81968 (early lto debug objects make Solaris ld SEGV)Richard Biener2-3/+11
2017-08-31 Richard Biener <rguenther@suse.de> PR lto/81968 * simple-object-elf.c (simple_object_elf_copy_lto_debug_section): Keep names of removed global symbols. From-SVN: r251560
2017-08-30simple-object-xcoff.c (simple_object_xcoff_find_sections): Improve ↵Tony Reix2-45/+93
.go_export csect handling. * simple-object-xcoff.c (simple_object_xcoff_find_sections): Improve .go_export csect handling. Don't make assumptions on containing section or number of auxiliary entries. From-SVN: r251533
2017-08-28re PR lto/81968 (early lto debug objects make Solaris ld SEGV)Richard Biener2-2/+9
2017-08-28 Richard Biener <rguenther@suse.de> PR lto/81968 * simple-object-elf.c (simple_object_elf_copy_lto_debug_section): Adjust field with for sh_type write, set SHF_EXCLUDE only for removed sections. From-SVN: r251384
2017-08-22re PR lto/81925 (early lto debug link failure on aarch64_be)Richard Biener2-6/+14
2017-08-22 Richard Biener <rguenther@suse.de> PR lto/81925 * simple-object-elf.c (simple_object_elf_write_shdr): Adjust type of sh_addralign and sh_entsize and properly write sh_entsize as Elf_Addr. (simple_object_elf_write_to_file): Read sh_entsize as Elf_Addr. From-SVN: r251276
2017-08-21re PR go/78628 (GO fails to build a translation unit decl)Richard Biener7-21/+592
2017-08-21 Richard Biener <rguenther@suse.de> include/ * simple-object.h (simple_object_copy_lto_debug_sections): New function. libiberty/ * simple-object-common.h (struct simple_object_functions): Add copy_lto_debug_sections hook. * simple-object.c: Include fcntl.h. (handle_lto_debug_sections): New helper function. (simple_object_copy_lto_debug_sections): New function copying early LTO debug sections to regular debug sections in a new file. (simple_object_start_write): Handle NULL segment_name. * simple-object-coff.c (simple_object_coff_functions): Adjust for not implemented copy_lto_debug_sections hook. * simple-object-mach-o.c (simple_object_mach_o_functions): Likewise. * simple-object-xcoff.c (simple_object_xcoff_functions): Likewise. * simple-object-elf.c (SHT_NULL, SHT_SYMTAB, SHT_RELA, SHT_REL, SHT_GROUP): Add various sectopn header types. (SHF_EXCLUDE): Add flag. (Elf32_External_Sym, Elf64_External_Sym): Add symbol struct. (ELF_ST_BIND, ELF_ST_TYPE, ELF_ST_INFO): Add accessors. (STT_OBJECT, STT_FUNC, STT_TLS, STT_GNU_IFUNC): Add Symbol types. (STV_DEFAULT): Add symbol visibility. (SHN_COMMON): Add special section index name. (struct simple_object_elf_write): New. (simple_object_elf_start_write): Adjust for new private data. (simple_object_elf_write_shdr): Pass in values for all fields we write. (simple_object_elf_write_to_file): Adjust. Copy from recorded section headers if requested. (simple_object_elf_release_write): Release private data. (simple_object_elf_copy_lto_debug_sections): Copy and rename sections as denoted by PFN and all their dependences, symbols and relocations to the empty destination file. (simple_object_elf_functions): Adjust for copy_lto_debug_sections hook. gcc/ * debug.h (struct gcc_debug_hooks): Add die_ref_for_decl and register_external_die hooks. (debug_false_tree_charstarstar_uhwistar): Declare. (debug_nothing_tree_charstar_uhwi): Likewise. * debug.c (do_nothing_debug_hooks): Adjust. (debug_false_tree_charstarstar_uhwistar): New do nothing. (debug_nothing_tree_charstar_uhwi): Likewise. * dbxout.c (dbx_debug_hooks): Adjust. (xcoff_debug_hooks): Likewise. * sdbout.c (sdb_debug_hooks): Likewise. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. * dwarf2out.c (macinfo_label_base): New global. (dwarf2out_register_external_die): New function for the register_external_die hook. (dwarf2out_die_ref_for_decl): Likewise for die_ref_for_decl. (dwarf2_debug_hooks): Use them. (dwarf2_lineno_debug_hooks): Adjust. (struct die_struct): Add with_offset flag. (DEBUG_LTO_DWO_INFO_SECTION, DEBUG_LTO_INFO_SECTION, DEBUG_LTO_DWO_ABBREV_SECTION, DEBUG_LTO_ABBREV_SECTION, DEBUG_LTO_DWO_MACINFO_SECTION, DEBUG_LTO_MACINFO_SECTION, DEBUG_LTO_DWO_MACRO_SECTION, DEBUG_LTO_MACRO_SECTION, DEBUG_LTO_LINE_SECTION, DEBUG_LTO_DWO_STR_OFFSETS_SECTION, DEBUG_LTO_STR_DWO_SECTION, DEBUG_STR_LTO_SECTION): New macros defining section names for the early LTO debug variants. (reset_indirect_string): New helper. (add_AT_external_die_ref): Helper for dwarf2out_register_external_die. (print_dw_val): Add support for offsetted symbol references. (get_ultimate_context): Split out from is_cxx. (is_cxx): Use get_ultimate_context. (is_fortran): Add decl overload. (compute_comp_unit_symbol): Split out worker from compute_section_prefix. (compute_section_prefix): Call compute_comp_unit_symbol and set comdat_type_p here. (output_die): Skip DIE symbol output for the LTO added one. Handle DIE symbol references with offset. (output_comp_unit): Guard section name mangling properly. For LTO debug sections emit a symbol at the section beginning which we use to refer to its DIEs. (add_abstract_origin_attribute): For DIEs registered via dwarf2out_register_external_die directly refer to the early DIE rather than indirectly through the shadow one we created. Remove obsolete call to dwarf2out_abstract_function for non-function/block origins. (gen_array_type_die): When generating early LTO debug do not emit DW_AT_string_length. (gen_formal_parameter_die): Do not re-create DIEs for PARM_DECLs late when in LTO. As suggested place a gcc_unreachable for the DECL_ABSTRACT_P case. (gen_subprogram_die): Avoid another specification DIE for early built declarations/definitions for the late LTO case. (gen_variable_die): Add type references for late duplicated VLA dies when in late LTO. (gen_inlined_subroutine_die): Do not call dwarf2out_abstract_function, we have the abstract instance already. (process_scope_var): Adjust decl DIE contexts in LTO which first puts them in limbo. (gen_decl_die): Do not generate type DIEs late apart from types for VLAs or for decls we do not yet have a DIE. Do not call dwarf2out_abstract_function late. (dwarf2out_early_global_decl): Make sure to create DIEs for abstract instances of a decl first. (dwarf2out_late_global_decl): Adjust comment. (output_macinfo_op): With multiple macro sections use macinfo_label_base to distinguish labels. (output_macinfo): Likewise. Update macinfo_label_base. Pass in the line info label. (note_variable_value_in_expr): When generating LTO resolve all variable values here by generating DIEs as needed. (init_sections_and_labels): Add early LTO debug flag parameter and generate different sections and names if set. Add generation counter for the labels so we can have multiple of them. (reset_dies): Helper to allow DIEs to be output multiple times. (dwarf2out_finish): When outputting DIEs to the fat part of an LTO object first reset DIEs. (dwarf2out_early_finish): Output early DIEs when generating LTO. (modified_type_die): Check for decl_ultimate_origin being self before recursing. (gen_type_die_with_usage): Likewise. (gen_typedef_die): Allow decl_ultimate_origin being self. (set_decl_abstract_flags): Remove. (set_block_abstract_flags): Likewise. (dwarf2out_abstract_function): Treat the early generated DIEs as the abstract copy and only add DW_AT_inline and DW_AT_artificial here and call set_decl_origin_self. If the DIE has an abstract origin don't do anything. * tree.c (free_lang_data): Build a dummy TRANSLATION_UNIT_DECL if we have none yet (Go fails to build one, PR78628). (variably_modified_type_p): Prevent endless recursion for Ada cyclic pointer types. * lto-streamer-in.c: Include debug.h. (dref_queue): New global. (lto_read_tree_1): Stream in DIE references. (lto_input_tree): Register DIE references. (input_function): Stream DECL_DEBUG_ARGS. * lto-streamer-out.c: Include debug.h. (lto_write_tree_1): Output DIE references. (DFS::DFS_write_tree_body): Follow DECL_ABSTRACT_ORIGIN. Force a TRANSLATION_UNIT_DECL DECL_CONTEXT for file-scope decls. (output_function): Stream DECL_DEBUG_ARGS. * tree-streamer-in.c (lto_input_ts_decl_common_tree_pointers): Stream DECL_ABSTRACT_ORIGIN. * tree-streamer-out.c (write_ts_decl_common_tree_pointers): Likewise. (write_ts_decl_minimal_tree_pointers): Force a TRANSLATION_UNIT_DECL DECL_CONTEXT for file-scope decls. * lto-streamer.h (struct dref_entry): Declare. (dref_queue): Likewise. * cfgexpand.c (pass_expand::execute): Do not call the outlining_inline_function hook here. * lto-wrapper.c (debug_obj): New global. (tool_cleanup): Unlink it if required. (debug_objcopy): New function. (run_gcc): Handle early debug sections in the IL files by extracting them to separate files, partially linkin them and feeding the result back as result to the linker. * config/darwin.h (DEBUG_LTO_INFO_SECTION, DEBUG_LTO_ABBREV_SECTION, DEBUG_LTO_MACINFO_SECTION, DEBUG_LTO_LINE_SECTION, DEBUG_STR_LTO_SECTION, DEBUG_LTO_MACRO_SECTION): Put early debug sections into a separate segment. * config/darwin.c (darwin_asm_named_section): Handle __GNU_DWARF_LTO segments. (darwin_asm_dwarf_section): Likewise. (darwin_asm_output_dwarf_offset): Likewise. * config/i386/i386.c (make_resolver_func): Set DECL_IGNORED_P. lto/ * lto.c (unify_scc): Truncate DIE reference queue for dropped SCCs. (lto_read_decls): Process TRANSLATION_UNIT_DECLs. Remove TYPE_DECL debug processing, register DIE references from prevailing SCCs with the debug machinery. (lto_section_with_id): Handle LTO debug sections. libstdc++/ * testsuite/libstdc++-prettyprinters/prettyprinters.exp: Run all tests with -flto as well if supported. testsuite/ * c-c++-common/asan/global-overflow-1.c: Adjust diagnostic location regex to handle the LTO case. * c-c++-common/asan/heap-overflow-1.c: Likewise. * c-c++-common/asan/misalign-1.c: Likewise. * c-c++-common/asan/misalign-2.c: Likewise. * c-c++-common/asan/null-deref-1.c: Likewise. * c-c++-common/asan/stack-overflow-1.c: Likewise. * c-c++-common/asan/strncpy-overflow-1.c: Likewise. * c-c++-common/asan/use-after-free-1.c: Likewise. * c-c++-common/asan/alloca_big_alignment.c: Likewise. * c-c++-common/asan/alloca_detect_custom_size.c: Likewise. * c-c++-common/asan/alloca_overflow_partial.c: Likewise. * c-c++-common/asan/alloca_overflow_right.c: Likewise. * c-c++-common/asan/alloca_underflow_left.c: Likewise. * g++.dg/asan/large-func-test-1.C: Likewise. * gfortran.dg/save_6.f90: Add -flto -g variant of save_5.f90. From-SVN: r251220
2017-07-02include/ChangeLogJan Kratochvil2-0/+15
2017-07-02 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarf2.def (DW_IDX_compile_unit, DW_IDX_type_unit, DW_IDX_die_offset) (DW_IDX_parent, DW_IDX_type_hash, DW_IDX_lo_user, DW_IDX_hi_user) (DW_IDX_GNU_internal, DW_IDX_GNU_external): New. * dwarf2.h (DW_IDX, DW_IDX_DUP, DW_FIRST_IDX, DW_END_IDX): New. (enum dwarf_name_index_attribute): Remove. (get_DW_IDX_name): New declaration. libiberty/ChangeLog 2017-07-02 Jan Kratochvil <jan.kratochvil@redhat.com> * dwarfnames.c (DW_FIRST_IDX, DW_END_IDX, DW_IDX, DW_IDX_DUP): New. From-SVN: r249883
2017-06-07simple-object-xcoff.c (simple_object_xcoff_find_sections): Search symbol ↵Tony Reix2-9/+128
table for .go_export symbol and apply pfn if found. 2017-06-07 Tony Reix <tony.reix@atos.net> Matthieu Sarter <matthieu.sarter.external@atos.net> David Edelsohn <dje.gcc@gmail.com> * simple-object-xcoff.c (simple_object_xcoff_find_sections): Search symbol table for .go_export symbol and apply pfn if found. Co-Authored-By: David Edelsohn <dje.gcc@gmail.com> Co-Authored-By: Matthieu Sarter <matthieu.sarter.external@atos.net> From-SVN: r248999
2017-05-31configure.ac (strnlen): Add to AC_CHECK_DECLS.DJ Delorie4-1/+33
* configure.ac (strnlen): Add to AC_CHECK_DECLS. * configure: Likewise. * config.in: Add HACE_DECL_STRNLEN. From-SVN: r248721
2017-05-27d-demangle.c (dlang_identifier): Prefix mangled init symbols with ↵Iain Buclaw3-2/+9
`initializer for'. libiberty/ChangeLog: * d-demangle.c (dlang_identifier): Prefix mangled init symbols with `initializer for'. * testsuite/demangle-expected: Update tests. From-SVN: r248539
2017-05-27d-demangle.c (dlang_call_convention_p): Move declaration before dlang_type.Iain Buclaw3-24/+44
libiberty/ChangeLog: * d-demangle.c (dlang_call_convention_p): Move declaration before dlang_type. (dlang_type): Handle function types. * testsuite/d-demangle-expected: Add tests. From-SVN: r248538
2017-05-27d-demangle.c (dlang_parse_real): Remove stack buffer, write the demangled ↵Iain Buclaw3-17/+18
hexadecimal directly to string. libiberty/ChangeLog: * d-demangle.c (dlang_parse_real): Remove stack buffer, write the demangled hexadecimal directly to string. * testsuite/d-demangle-expected: Add tests. From-SVN: r248537
2017-05-24waitpid.c (wait): Define as a macro that calls _cwait, so that this function ↵Eli Zaretskii2-0/+10
works on MinGW. 2017-05-24 Eli Zaretskii <eliz@gnu.org> * libiberty/waitpid.c (wait) [__MINGW32__]: Define as a macro that calls _cwait, so that this function works on MinGW. From-SVN: r248430
2017-05-01d-demangle.c (dlang_hexdigit): New function.Iain Buclaw3-54/+86
libiberty/ChangeLog: * d-demangle.c (dlang_hexdigit): New function. (ascii2hex): Remove function. (dlang_parse_string): Update to call dlang_hexdigit. * testsuite/d-demangle-expected: Add tests. From-SVN: r247455
2017-05-01d-demangle.c (strtol): Remove declaration.Iain Buclaw3-47/+185
libiberty/ChangeLog: * d-demangle.c (strtol): Remove declaration. Updated all callers to use dlang_number. (dlang_number): New function. (dlang_value): Moved check for ISDIGIT into dlang_parse_integer. * testsuite/d-demangle-expected: Add tests. From-SVN: r247453
2017-05-01d-demangle.c (dlang_parse_symbol): Remove function.Iain Buclaw3-98/+142
libiberty/ChangeLog: * d-demangle.c (dlang_parse_symbol): Remove function. (dlang_parse_qualified): New function. (dlang_parse_mangle): New function. (dlang_type): Update to call dlang_parse_qualified. (dlang_identifier): Update to call either dlang_parse_qualified or dlang_parse_mangle. (dlang_type_modifier_p): Remove function. (dlang_call_convention_p): Don't allow type modifiers in mangle. (dlang_template_args): Update to call dlang_identifier. (dlang_demangle): Update to call dlang_parse_mangle. * testsuite/d-demangle-expected: Add tests. From-SVN: r247450
2017-05-01d-demangle.c (dlang_value): Add comment explaining why cases for digits are ↵Iain Buclaw3-17/+27
required. libiberty/ChangeLog: * d-demangle.c (dlang_value): Add comment explaining why cases for digits are required. * testsuite/d-demangle-expected: Update integer value tests. From-SVN: r247436
2017-05-01d-demangle.c (dlang_parse_symbol): Skip over anonymous symbols.Iain Buclaw3-1/+18
libiberty/ChangeLog: * d-demangle.c (dlang_parse_symbol): Skip over anonymous symbols. * testsuite/d-demangle-expected: Add tests. From-SVN: r247434
2017-05-01d-demangle.c (dlang_identifier): Handle template constraint symbols.Iain Buclaw3-9/+18
libiberty/ChangeLog: * d-demangle.c (dlang_identifier): Handle template constraint symbols. (dlang_parse_template): Only advance if template symbol prefix is followed by a digit. * testsuite/d-demangle-expected: Add tests. From-SVN: r247433
2017-05-01d-demangle.c (dlang_attributes): Handle scope attributes.Iain Buclaw3-0/+53
libiberty/ChangeLog: * d-demangle.c (dlang_attributes): Handle scope attributes. * testsuite/d-demangle-expected: Add tests. From-SVN: r247432
2017-04-27PR demangler/80513 check for overflows and invalid characters in thunksJonathan Wakely4-9/+33
PR demangler/80513 * cp-demangle.c (d_number): Check for overflow. * cplus-dem.c (consume_count): Fix overflow check. (gnu_special): Check for underscore after thunk delta. * testsuite/demangle-expected: Add tests for overflows and invalid characters in thunks. From-SVN: r247300
2017-04-21libiberty: Limit demangler maximum d_print_comp recursion call depth.Mark Wielaard2-3/+19
The fix for PR demangler/70909 and 67264 (endless demangler recursion) catches when a demangle_component is printed in a cycle. But that doesn't protect the call stack blowing up from non-cyclic nested types printed recursively through d_print_comp. This can happen by a (very) long mangled string that simply creates a very deep pointer or qualifier chain. Limit the recursive d_print_comp call depth for a d_print_info to 1K nested types. libiberty/ChangeLog: * cp-demangle.c (MAX_RECURSION_COUNT): New constant. (struct d_print_info): Add recursion field. (d_print_init): Initialize recursion. (d_print_comp): Check and update d_print_info recursion depth. From-SVN: r247056
2017-04-21libiberty: Always return NULL if d_add_substitution fails.Mark Wielaard2-1/+7
d_add_substitution can fail for various reasons, like when the subs array is full. If d_add_substitution fails d_substitution should return NULL early and not try to continue. Every other call of d_add_substitution is handled in the same way. libiberty/ChangeLog: * cp-demangle.c (d_substitution): Return NULL if d_add_substitution fails. From-SVN: r247055
2017-04-21libiberty: Don't update and remove did_subs field from demangler structs.Mark Wielaard3-12/+10
The d_info field did_subs was used for estimating the string output size. It was no longer used when the malloc-less callback interface was introduced in 2007 (svn r121305). But the field was still updated. When backtracking was introduced in 2013 (svn r205292) did_subs was also added to the d_info_checkpoint struct. But except for updating the field it was still not used. Since it is never used just stop updating the field and remove it from the two structs. libiberty/ChangeLog: * cp-demangle.h (struct d_info): Remove did_subs field. * cp-demangle.c (struct d_info_checkpoint): Likewise. (d_template_param): Don't update did_subs. (d_substitution): Likewise. (d_checkpoint): Don't assign did_subs. (d_backtrack): Likewise. (cplus_demangle_init_info): Don't initialize did_subs. From-SVN: r247054
2017-03-27cplus_demangle_fill_component: Handle DEMANGLE_COMPONENT_RVALUE_REFERENCEPedro Alves2-0/+6
This patch almost a decade ago: ... 2007-08-31 Douglas Gregor <doug.gregor@gmail.com> * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_RVALUE_REFERENCE. (d_make_comp): Ditto. ... ... missed doing the same change to cplus_demangle_fill_component that was done to d_make_comp. I.e., teach it to only validate that we're not passing in a "right" subtree. GDB has recently (finally) learned about rvalue references, and a change to make it use cplus_demangle_fill_component more ran into an assertion because of this. (GDB is the only user of cplus_demangle_fill_component in both the gcc and binutils-gdb trees.) libiberty/ChangeLog: 2017-03-27 Pedro Alves <palves@redhat.com> * cp-demint.c (cplus_demangle_fill_component): Handle DEMANGLE_COMPONENT_RVALUE_REFERENCE. From-SVN: r246502
2017-03-13libiberty: Initialize d_printing in all cplus_demangle_fill_* functions.Mark Wielaard2-0/+12
While integrating the d_printing recursion guard change into gdb I noticed we forgot to initialize the demangle_component d_printing field in cplus_demangle_fill_{name,extended_operator,ctor,dtor}. As is done in cplus_demangle_fill_{component,builtin_type,operator}. It happened to work because in gcc all demangle_components were allocated through d_make_empty. But gdb has its own allocation mechanism (as might other users). libiberty/ChangeLog: * cp-demangle.c (cplus_demangle_fill_name): Initialize demangle_component d_printing. (cplus_demangle_fill_extended_operator): Likewise. (cplus_demangle_fill_ctor): Likewise. (cplus_demangle_fill_dtor): Likewise. From-SVN: r246105
2017-03-08Fix PR demangler/70909 and 67264 (endless demangler recursion)Mark Wielaard4-25/+83
ChangeLog: PR demangler/70909 PR demangler/67264 * include/demangle.h: Add d_printing to struct demangle_component and pass struct demangle_component as non const. libiberty/ChangeLog: PR demangler/70909 PR demangler/67264 * cp-demangle.c: Fix endless recursion. Pass struct demangle_component as non const. (d_make_empty): Initialize variable. (d_print_comp_inner): Limit recursion. (d_print_comp): Decrement variable. * cp-demint.c (cplus_demangle_fill_component): Initialize variable. (cplus_demangle_fill_builtin_type): Likewise. (cplus_demangle_fill_operator): Likewise. * testsuite/demangle-expected: Add tests. From-SVN: r245978
2017-01-18Fix PR70182 -- missing "on" in mangling of unresolved operatorsMarkus Trippelsdorf3-0/+16
The ABI says: <unresolved-name> ::= [gs] <base-unresolved-name> ::= sr <unresolved-type> <base-unresolved-name> ::= srN <unresolved-type> <unresolved-qualifier-level>+ E <base-unresolved-name> ::= [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name> <base-unresolved-name> ::= <simple-id> ::= on <operator-name> ::= on <operator-name> <template-args> ::= dn <destructor-name libiberty: PR c++/70182 * cp-demangle.c (d_unqualified_name): Handle "on" for operator names. * testsuite/demangle-expected: Add tests. gcc/cp: PR c++/70182 * mangle.c (write_template_args): Add "on" for operator names. gcc: PR c++/70182 * doc/invoke.texi (fabi-version): Mention mangling fix for operator names. From-SVN: r244567
2017-01-18Fix PR77489 -- mangling of discriminator >= 1Markus Trippelsdorf3-2/+42
libiberty: PR c++/77489 * cp-demangle.c (d_discriminator): Handle discriminator >= 10. * testsuite/demangle-expected: Add tests for discriminator. gcc: PR c++/77489 * doc/invoke.texi (fabi-version): Document discriminator mangling. gcc/cp: PR c++/77489 * mangle.c (write_discriminator): Handle discriminator >= 10. From-SVN: r244566
2017-01-04Update copyright years.Jakub Jelinek93-120/+97
From-SVN: r244052
2017-01-04Update configure deps, remove stray \xA0 in picflag.m4, regenerateAlan Modra3-3/+10
Also fix a stray changelog entry. Some of the regen here is due to previous changes not being regenerated properly, in part due to the missing configure dependencies. * configure: Regenerate. config/ * picflag.m4: Remove stray \xA0 in comment. gcc/ * Makefile.in (aclocal_deps): Update and order as per aclocal.m4. * configure: Regenerate. * config.in: Regenerate. libada/ * Makefile.in (configure_deps): Update and order as per configure.ac sinclude. * configure: Regenerate. libgcc/ * Makefile.in (configure_deps): Update. * configure: Regenerate. libiberty/ * Makefile.in (configure_deps): Update. * configure: Regenerate. libitm/ * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. From-SVN: r244049
2016-12-13re PR c++/78761 (C++14, compiler generate mangled name that can not be ↵Jakub Jelinek3-1/+14
demangled) PR c++/78761 * cp-demangle.c (cplus_demangle_type): Demangle Dc as decltype(auto). * testsuite/demangle-expected: Add test for decltype(auto). From-SVN: r243593
2016-12-12re PR other/78252 (C++ demangler crashes with infinite recursion with lambda ↵Nathan Sidwell3-22/+82
(auto)) libiberty/ PR c++/78252 * cp-demangle.c (struct d_print_info): Add is_lambda_arg field. (d_print_init): Initialize it. (d_print_comp_inner) <DEMANGLE_COMPONENT_TEMPLATE_PARAM>: Check is_lambda_arg for auto. <DEMANGLE_COMPONENT_REFERENCE, DEMANGLE_COMPONENT_RVALUE_REFERENCE>: Skip smashing check when is_lambda_arg. <DEMANGLE_COMPONENT_LAMBDA>: Increment is_lambda_arg around arg printing. * testsuite/demangle-expected: Add lambda auto mangling cases. gcc/testsuite/ PR c++/78252 * g++.dg/cpp1y/lambda-mangle-1.C: New. From-SVN: r243566
2016-12-06Oops, fix dateDJ Delorie1-1/+1
From-SVN: r243281
2016-12-06* argv.c (expandargv): Check for directories passed as @-files.DJ Delorie2-0/+23
From-SVN: r243280
2016-11-30libiberty: avoid reading past end of buffer in strndup/xstrndup (PR c/78498)David Malcolm3-9/+11
gcc/ChangeLog: PR c/78498 * selftest.c (selftest::assert_strndup_eq): New function. (selftest::test_strndup): New function. (selftest::test_libiberty): New function. (selftest::selftest_c_tests): Call test_libiberty. gcc/testsuite/ChangeLog: PR c/78498 * gcc.dg/format/pr78494.c: New test case. libiberty/ChangeLog: PR c/78498 * strndup.c (strlen): Delete decl. (strnlen): Add decl. (strndup): Call strnlen rather than strlen. * xstrndup.c (xstrndup): Likewise. From-SVN: r243030
2016-11-29* cp-demangle.c (d_print_comp_inner): Fix parameter indentation.Nathan Sidwell2-1/+5
From-SVN: r242963
2016-11-16libiberty: Add Rust symbol demangling.David Tolnay6-4/+585
Adds Rust symbol demangler. Rust mangles symbols using GNU_V3 style, adding a hash and various special character subtitutions. This adds a new rust style to cplus_demangle and adds 3 helper functions rust_demangle, rust_demangle_sym and rust_is_mangled. rust-demangle.c was written by David. Mark did the code formatting to GNU style and integration into the gcc/libiberty build system and testsuite. include/ChangeLog: 2016-11-03 David Tolnay <dtolnay@gmail.com> Mark Wielaard <mark@klomp.org> * demangle.h (DMGL_RUST): New macro. (DMGL_STYLE_MASK): Add DMGL_RUST. (demangling_styles): Add dlang_rust. (RUST_DEMANGLING_STYLE_STRING): New macro. (RUST_DEMANGLING): New macro. (rust_demangle): New prototype. (rust_is_mangled): Likewise. (rust_demangle_sym): Likewise. libiberty/ChangeLog: 2016-11-03 David Tolnay <dtolnay@gmail.com> Mark Wielaard <mark@klomp.org> * Makefile.in (CFILES): Add rust-demangle.c. (REQUIRED_OFILES): Add rust-demangle.o. * cplus-dem.c (libiberty_demanglers): Add rust_demangling case. (cplus_demangle): Handle RUST_DEMANGLING. (rust_demangle): New function. * rust-demangle.c: New file. * testsuite/Makefile.in (really-check): Add check-rust-demangle. (check-rust-demangle): New rule. * testsuite/rust-demangle-expected: New file. Co-Authored-By: Mark Wielaard <mark@klomp.org> From-SVN: r242524
2016-11-15libiberty: demangler crash with missing :? or fold expression component.Mark Wielaard3-0/+19
When constructing an :? or fold expression that requires a third expression only the first and second were explicitly checked to not be NULL. Since the third expression is also required in these constructs it needs to be explicitly checked and rejected when missing. Otherwise the demangler will crash once it tries to d_print the NULL component. Added two examples to demangle-expected of strings that would crash before this fix. Found by American Fuzzy Lop (afl) fuzzer. From-SVN: r242451
2016-11-15libiberty: Fix some demangler crashes caused by reading past end of input.Mark Wielaard3-4/+41
In various situations the cplus_demangle () function could read past the end of input causing crashes. Add checks in various places to not advance the demangle string location and fail early when end of string is reached. Add various examples of input strings to the testsuite that would crash test-demangle before the fixes. Found by using the American Fuzzy Lop (afl) fuzzer. libiberty/ChangeLog: * cplus-dem.c (demangle_signature): After 'H', template function, no success and don't advance position if end of string reached. (demangle_template): After 'z', template name, return zero on premature end of string. (gnu_special): Guard strchr against searching for zero characters. (do_type): If member, only advance mangled string when 'F' found. * testsuite/demangle-expected: Add examples of strings that could crash the demangler by reading past end of input. From-SVN: r242450
2016-11-15- Revert last commit, restore the regenerated files aclocal.m4 and configureMatthias Klose2-23/+625
From-SVN: r242438
2016-11-15config-ml.in: Remove references to GCJ.Matthias Klose2-625/+23
<toplevel> 2016-11-15 Matthias Klose <doko@ubuntu.com> * config-ml.in: Remove references to GCJ. * configure.ac: Likewise. * configure: Regenerate. config/ 2016-11-15 Matthias Klose <doko@ubuntu.com> multi.m4: Don't set GCJ. gcc/ 2016-11-15 Matthias Klose <doko@ubuntu.com> * doc/install.texi: Remove references to gcj/libjava. * doc/invoke.texi: Likewise. */ (where necessary) 2016-11-15 Matthias Klose <doko@ubuntu.com> * configure: Regenerate. From-SVN: r242433
2016-11-14libiberty: Add -Wshadow=local to warning flags (if supported).Mark Wielaard3-2/+9
libiberty/ChangeLog: * configure.ac (ac_libiberty_warn_cflags): Add -Wshadow=local. * configure: Regenerated. From-SVN: r242396