aboutsummaryrefslogtreecommitdiff
path: root/libiberty
AgeCommit message (Collapse)AuthorFilesLines
2022-01-16Daily bump.GCC Administrator1-0/+4
2022-01-15Add -Wuse-after-free [PR80532].Martin Sebor1-0/+4
gcc/c-family/ChangeLog PR tree-optimization/80532 * c.opt (-Wuse-after-free): New options. gcc/ChangeLog: PR tree-optimization/80532 * common.opt (-Wuse-after-free): New options. * diagnostic-spec.c (nowarn_spec_t::nowarn_spec_t): Handle OPT_Wreturn_local_addr and OPT_Wuse_after_free_. * diagnostic-spec.h (NW_DANGLING): New enumerator. * doc/invoke.texi (-Wuse-after-free): Document new option. * gimple-ssa-warn-access.cc (pass_waccess::check_call): Rename... (pass_waccess::check_call_access): ...to this. (pass_waccess::check): Rename... (pass_waccess::check_block): ...to this. (pass_waccess::check_pointer_uses): New function. (pass_waccess::gimple_call_return_arg): New function. (pass_waccess::warn_invalid_pointer): New function. (pass_waccess::check_builtin): Handle free and realloc. (gimple_use_after_inval_p): New function. (get_realloc_lhs): New function. (maybe_warn_mismatched_realloc): New function. (pointers_related_p): New function. (pass_waccess::check_call): Call check_pointer_uses. (pass_waccess::execute): Compute and free dominance info. libcpp/ChangeLog: * files.c (_cpp_find_file): Substitute a valid pointer for an invalid one to avoid -Wuse-after-free. libiberty/ChangeLog: * regex.c: Suppress -Wuse-after-free. gcc/testsuite/ChangeLog: PR tree-optimization/80532 * gcc.dg/Wmismatched-dealloc-2.c: Avoid -Wuse-after-free. * gcc.dg/Wmismatched-dealloc-3.c: Same. * gcc.dg/analyzer/file-1.c: Prune expected warning. * gcc.dg/analyzer/file-2.c: Same. * gcc.dg/attr-alloc_size-6.c: Disable -Wuse-after-free. * gcc.dg/attr-alloc_size-7.c: Same. * c-c++-common/Wuse-after-free-2.c: New test. * c-c++-common/Wuse-after-free-3.c: New test. * c-c++-common/Wuse-after-free-4.c: New test. * c-c++-common/Wuse-after-free-5.c: New test. * c-c++-common/Wuse-after-free-6.c: New test. * c-c++-common/Wuse-after-free-7.c: New test. * c-c++-common/Wuse-after-free.c: New test. * g++.dg/warn/Wmismatched-dealloc-3.C: New test. * g++.dg/warn/Wuse-after-free.C: New test.
2022-01-03Update copyright years.Jakub Jelinek94-95/+95
2021-12-31Daily bump.GCC Administrator1-0/+7
2021-12-30libiberty: support digits in cpp mangled clone namesLancelot SIX2-2/+8
Currently libiberty fails to demangle the name of cloned functions if the clone-type-identifier contains numbers. This can be observed with the following example: $ cat > ex.cc <<EOT void foo (float *, float *) __attribute__((target_clones("avx2,avx,sse4.1,default"))); void foo (float *, float *) {} EOT $ gcc -c ex.cc $ nm -C ex.o | grep foo 0000000000000000 i foo(float*, float*) 0000000000000026 t foo(float*, float*) [clone .avx.1] 0000000000000013 t _Z3fooPfS_.avx2.0 0000000000000000 t foo(float*, float*) [clone .default.3] 0000000000000000 W foo(float*, float*) [clone .resolver] 0000000000000039 t _Z3fooPfS_.sse4_1.2 In this example, gcc creates clones for the FOO function, each matching one of the specified targets. When inspecting the binary, nm (and other libiberty-based tools, including gdb) fails to demangle the symbol names if the clone identifier contains numbers. Form my understanding of the mangling convention[1], clone names are part of vendor-specific suffixes and do not have rule preventing them from containing digits. This commit proposes to fix the demangling. With this commit (ported to binutils), nm gives the following output: $ nm-new -C ex.o | grep foo 0000000000000000 i foo(float*, float*) 0000000000000026 t foo(float*, float*) [clone .avx.1] 0000000000000013 t foo(float*, float*) [clone .avx2.0] 0000000000000000 t foo(float*, float*) [clone .default.3] 0000000000000000 W foo(float*, float*) [clone .resolver] 0000000000000039 t foo(float*, float*) [clone .sse4_1.2] Tested on x86_86-linux with 'make check-libiberty'. [1] https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling libiberty/ChangeLog: * cp-demangle.c (d_clone_suffix): Support digits in clone tag names. * testsuite/demangle-expected: Check demangling of clone symbols with digits in name.
2021-12-17Daily bump.GCC Administrator1-0/+13
2021-12-15Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB"H.J. Lu4-53/+2
This reverts commit bf8cdd35117dea2049abbeebcdf14de11b323ef7.
2021-12-16Daily bump.GCC Administrator1-0/+10
2021-12-15Sync with binutils: GCC: Pass --plugin to AR and RANLIBH.J. Lu4-2/+53
Sync with binutils for building binutils with LTO: 50ad1254d50 GCC: Pass --plugin to AR and RANLIB Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO build. ChangeLog: * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@ (RANLIB): Add @RANLIB_PLUGIN_OPTION@. * configure.ac: Include config/gcc-plugin.m4. AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION. * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and RANLIB if possible. * Makefile.in: Regenerated. * configure: Likewise. config/ * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New. libiberty/ * Makefile.in (AR): Add @AR_PLUGIN_OPTION@ (RANLIB): Add @RANLIB_PLUGIN_OPTION@. (configure_deps): Depend on ../config/gcc-plugin.m4. * configure.ac: AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION. * aclocal.m4: Regenerated. * configure: Likewise. zlib/ * configure: Regenerated.
2021-11-30Daily bump.GCC Administrator1-0/+12
2021-11-29Make etags path used by build system configurableEric Gallager3-1/+14
This commit allows users to specify a path to their "etags" executable for use when doing "make tags". I based this patch off of this one from upstream automake: https://git.savannah.gnu.org/cgit/automake.git/commit/m4?id=d2ccbd7eb38d6a4277d6f42b994eb5a29b1edf29 This means that I just supplied variables that the user can override for the tags programs, rather than having the configure scripts actually check for them. I handle etags and ctags separately because the intl subdirectory has separate targets for them. This commit only affects the subdirectories that use handwritten Makefiles; the ones that use automake will have to wait until we update the version of automake used to be 1.16.4 or newer before they'll be fixed. Addresses #103021 gcc/ChangeLog: PR other/103021 * Makefile.in: Substitute CTAGS, ETAGS, and CSCOPE variables. Use ETAGS variable in TAGS target. * configure: Regenerate. * configure.ac: Allow CTAGS, ETAGS, and CSCOPE variables to be overridden. gcc/ada/ChangeLog: PR other/103021 * gcc-interface/Make-lang.in: Use ETAGS variable in TAGS target. gcc/c/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/cp/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/d/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/fortran/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/go/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/objc/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/objcp/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. intl/ChangeLog: PR other/103021 * Makefile.in: Use ETAGS variable in TAGS target, CTAGS variable in CTAGS target, and MKID variable in ID target. * configure: Regenerate. * configure.ac: Allow CTAGS, ETAGS, and MKID variables to be overridden. libcpp/ChangeLog: PR other/103021 * Makefile.in: Use ETAGS variable in TAGS target. * configure: Regenerate. * configure.ac: Allow ETAGS variable to be overridden. libiberty/ChangeLog: PR other/103021 * Makefile.in: Use ETAGS variable in TAGS target. * configure: Regenerate. * configure.ac: Allow ETAGS variable to be overridden.
2021-11-29Fix PR 19089: Environment variable TMP may yield gcc: abortAndrew Pinski1-1/+15
Even though I cannot reproduce the ICE any more, this is still a bug. We check already to see if we can access the directory but never check to see if the path is actually a directory. This adds the check and now we reject the file as not usable as a tmp directory. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. libiberty/ChangeLog: * make-temp-file.c (try_dir): Check to see if the dir is actually a directory.
2021-10-23Daily bump.GCC Administrator1-0/+6
2021-10-22Add install-dvi Makefile targets.Eric Gallager1-1/+19
Closes #102663 ChangeLog: PR other/102663 * Makefile.def: Handle install-dvi target. * Makefile.tpl: Likewise. * Makefile.in: Regenerate. c++tools/ChangeLog: PR other/102663 * Makefile.in: Add dummy install-dvi target. gcc/ChangeLog: PR other/102663 * Makefile.in: Handle dvidir and install-dvi target. * configure: Regenerate. * configure.ac: Add install-dvi to target_list. gcc/ada/ChangeLog: PR other/102663 * gcc-interface/Make-lang.in: Allow dvi-formatted documentation to be installed. gcc/c/ChangeLog: PR other/102663 * Make-lang.in: Add dummy c.install-dvi target. gcc/cp/ChangeLog: PR other/102663 * Make-lang.in: Add dummy c++.install-dvi target. gcc/d/ChangeLog: PR other/102663 * Make-lang.in: Allow dvi-formatted documentation to be installed. gcc/fortran/ChangeLog: PR other/102663 * Make-lang.in: Allow dvi-formatted documentation to be installed. gcc/lto/ChangeLog: PR other/102663 * Make-lang.in: Add dummy lto.install-dvi target. gcc/objc/ChangeLog: PR other/102663 * Make-lang.in: Add dummy objc.install-dvi target. gcc/objcp/ChangeLog: PR other/102663 * Make-lang.in: Add dummy objc++.install-dvi target. gnattools/ChangeLog: PR other/102663 * Makefile.in: Add dummy install-dvi target. libada/ChangeLog: PR other/102663 * Makefile.in: Add dummy install-dvi target. libcpp/ChangeLog: PR other/102663 * Makefile.in: Add dummy install-dvi target. libdecnumber/ChangeLog: PR other/102663 * Makefile.in: Add dummy install-dvi target. libiberty/ChangeLog: PR other/102663 * Makefile.in: Allow dvi-formatted documentation to be installed.
2021-10-18Daily bump.GCC Administrator1-0/+8
2021-10-17[PATCH] d-demangle: properly skip anonymous symbolsLuís Ferreira2-4/+18
libiberty/ PR d/102618 * d-demangle.c (dlang_parse_qualified): Handle anonymous symbols correctly. * testsuite/d-demangle-expected: New tests to cover anonymous symbols.
2021-10-15Daily bump.GCC Administrator1-0/+9
2021-10-14libiberty: d-demangle: Add test case for function literalsLuís Ferreira1-0/+4
libiberty/ChangeLog: * testsuite/d-demangle-expected: Add test case for function literals.
2021-10-14libiberty: d-demangle: add test cases for simple special manglesLuís Ferreira1-0/+8
libiberty/ChangeLog: * testsuite/d-demangle-expected: Add test cases for simple special mangles.
2021-10-13Daily bump.GCC Administrator1-0/+5
2021-10-12[PATCH v2] libiberty: d-demangle: remove parenthesis where it is not neededLuís Ferreira1-6/+6
libiberty/ * d-demangle.c (dlang_parse_qualified): Remove redudant parenthesis around lhs and rhs of assignments.
2021-10-02Daily bump.GCC Administrator1-0/+4
2021-10-01libiberty: testsuite: add missing format on d-demangle-expectedLuís Ferreira1-0/+1
libiberty * testsuite/d-demangle-expected: Add missing format for new test
2021-09-24Daily bump.GCC Administrator1-0/+10
2021-09-23libiberty: prevent null dereferencing on dlang_typeLuís Ferreira2-2/+5
libiberty/ * d-demangle.c (dlang_Type): Validate MANGLED is nonnull. * testsuite/d-demangle-expected: New test.
2021-09-23libiberty: prevent buffer overflow when decoding user inputLuís Ferreira1-1/+1
libiberty/ * d-demangle.c (dlang_symbol_backref): Ensure strlen of string is less than length computed by dlang_number.
2021-09-02Daily bump.GCC Administrator1-0/+7
2021-09-01libiberty, configure, Darwin: Avoid detecting deprecated sbrk.Iain Sandoe3-25/+35
Darwin provides an implementation of sbrk, which is detected by the configuration process. However, it is deprecated which leads to build warnings. The malloc-based implementation is more suitable. This patch removes sbrk from the functions searched for Darwin. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> libiberty/ChangeLog: * configure: Regenerate. * configure.ac: Do not search for sbrk on Darwin. * xmalloc.c: Do not declare sbrk unless it has been found by configure.
2021-08-30Daily bump.GCC Administrator1-0/+20
2021-08-30libiberty: Add support for demangling local D template declarationsIain Buclaw2-0/+43
The D language now allows multiple different template declarations in the same function that have the same mangled name. To make the mangled names unique, a fake parent in the form `__Sddd' is added to the symbol. This information is not important for the user, so the demangler now handles and ignores it. libiberty/ChangeLog: * d-demangle.c (dlang_identifier): Skip over fake parent manglings. * testsuite/d-demangle-expected: Add tests.
2021-08-30libiberty: Add support for demangling D function literals as template value ↵Iain Buclaw2-13/+31
parameters The D language now allows instantiating templates using struct literals that have function literal fields as a value argument. libiberty/ChangeLog: * d-demangle.c (dlang_parse_arrayliteral): Add 'info' parameter. (dlang_parse_assocarray): Likewise. (dlang_parse_structlit): Likewise. (dlang_value): Likewise. Handle function literal symbols. (dlang_template_args): Pass 'info' to dlang_value. * testsuite/d-demangle-expected: Add new test.
2021-08-30libiberty: Add support for D `typeof(*null)' typesIain Buclaw2-3/+15
The D language has a new bottom type `typeof(*null)'. Null types were also incorrectly being demangled as `none', this has been fixed to be `typeof(null)'. libiberty/ChangeLog: * d-demangle.c (dlang_attributes): Handle typeof(*null). (dlang_type): Likewise. Demangle 'n' as typeof(null). * testsuite/d-demangle-expected: Update tests.
2021-08-24Daily bump.GCC Administrator1-0/+5
2021-08-23libiberty, Darwin: Fix a build warning.Iain Sandoe1-1/+1
r12-3005-g220c410162ebece4f missed a cast for the set_32 call. Fixed thus. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> libiberty/ChangeLog: * simple-object-mach-o.c (simple_object_mach_o_write_segment): Cast the first argument to set_32 as needed.
2021-08-19Daily bump.GCC Administrator1-0/+5
2021-08-18libiberty, Darwin : Fix simple-object LTO table for cross-endian case.Iain Sandoe1-0/+5
We encapsulate streamed IR in three special sections with a table that describes their entries. The table is expected to be written with native endianness for the target, but for cross-endian cross- compilation the swapping was omitted. Fixed thus. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> libiberty/ChangeLog: * simple-object-mach-o.c (simple_object_mach_o_write_segment): Arrange to swap the LTO index tables where needed.
2021-07-01Daily bump.GCC Administrator1-0/+5
2021-07-01libiberty: No longer use /usr/tmpGerald Pfeifer1-4/+1
/usr/tmp is antiquated and not present on decently modern systems. Remove it from consideration when choosing a directory for temporary files. libiberty: 2021-06-29 Gerald Pfeifer <gerald@pfeifer.com> * make-temp-file.c (usrtmp): Remove. (choose_tmpdir): Remove use of usrtmp.
2021-06-29Daily bump.GCC Administrator1-0/+12
2021-06-28libiberty: copy over .BTF section when using LTOIndu Bhagat1-0/+3
libiberty/ChangeLog: * simple-object.c (handle_lto_debug_sections): Copy over .BTF section.
2021-06-28CTF/BTF debug formatsIndu Bhagat1-0/+3
This commit introduces support for generating CTF debugging information and BTF debugging information from GCC. 2021-06-28 Indu Bhagat <indu.bhagat@oracle.com> David Faust <david.faust@oracle.com> Jose E. Marchesi <jose.marchesi@oracle.com> Weimin Pan <weimin.pan@oracle.com> gcc/ * Makefile.in: Add ctfc.*, ctfout.c and btfout.c files to GTFILES. Add new object files. * common.opt: Add CTF and BTF debug info options. * btfout.c: New file. * ctfc.c: Likewise. * ctfc.h: Likewise. * ctfout.c: Likewise. * dwarf2ctf.c: Likewise. * dwarf2ctf.h: Likewise. * dwarf2cfi.c (dwarf2out_do_frame): Acknowledge CTF_DEBUG and BTF_DEBUG. * dwarf2out.c (dwarf2out_source_line): Likewise. (dwarf2out_finish): Skip emitting DWARF if CTF or BTF are to be generated. (debug_format_do_cu): New function. (dwarf2out_early_finish): Traverse DIEs and emit CTF/BTF for them if requested. Include dwarf2ctf.c. * final.c (dwarf2_debug_info_emitted_p): Acknowledge DWARF-based debug formats. * flag-types.h (enum debug_info_type): Add CTF_DEBUG and BTF_DEBUG. (CTF_DEBUG): New bitmask. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): New enum. * gengtype.c (open_base_files): Handle ctfc.h. (main): Handle uint32_t type. * flags.h (btf_debuginfo_p): New definition. (dwarf_based_debuginfo_p): Likewise. * opts.c (debug_type_names): Add entries for CTF and BTF. (btf_debuginfo_p): New function. (dwarf_based_debuginfo_p): Likewise. (common_handle_option): Handle -gctfN and -gbtf options. (set_debug_level): Set CTF_DEBUG, BTF_DEBUG whenever appropriate. * toplev.c (process_options): Inform the user and ignore -gctfLEVEL if frontend is not C. include/ * ctf.h: New file. * btf.h: Likewise. libiberty/ * simple-object.c (handle_lto_debug_sections): Copy over .ctf sections.
2021-06-06Daily bump.GCC Administrator1-0/+7
2021-06-05Use libiberty snprintf and vsnprintf on hppa*-*-hpux*.John David Anglin2-6/+42
libiberty/ChangeLog: PR target/100734 * configure.ac: Use libiberty snprintf and vsnprintf on hppa*-*-hpux*. * configure: Regenerate.
2021-05-07Daily bump.GCC Administrator1-0/+4
2021-05-06libiberty: add htab_eq_stringTom Tromey1-0/+7
The libiberty hash table includes a helper function for strings, but no equality function. Consequently, this equality function has been reimplemented a number of times in both the gcc and binutils-gdb source trees. This patch adds the function to the libiberty hash table, as a step toward the goal of removing all the copies. One change to gcc is included here. Normally I would have put this in the next patch, but gensupport.c used the most natural name for its reimplementation of this function, and this can't coexist with the extern function in libiberty. include * hashtab.h (htab_eq_string): Declare. libiberty * hashtab.c (htab_eq_string): New function. gcc * gensupport.c (htab_eq_string): Remove.
2021-05-05Daily bump.GCC Administrator1-0/+5
2021-05-04Fix libiberty link failures in LTO mode for MinGWEric Botcazou2-3/+3
The test for the presence of variables (really symbols) does not work when you add -Ox -flto to CFLAGS: for v in $vars; do AC_MSG_CHECKING([for $v]) AC_CACHE_VAL(libiberty_cv_var_$v, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])], [eval "libiberty_cv_var_$v=yes"], [eval "libiberty_cv_var_$v=no"])]) if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED($n) else AC_MSG_RESULT(no) fi done because the assignment to 'p' is optimized away by LTO. This is visible on MinGW platforms in the form of a link failure for sys_siglist. There is another link failures for stpcpy: the symbol is both referenced by libiberty's pex-win32.c and provided by libiberty's stpcpy.c, so it needs to have a linkage to be resolved in LTO mode. libiberty/ * configure.ac: Make test for variables more robust. * configure: Regenerate. gcc/ * builtins.c (builtin_with_linkage_p): Return true for stp[n]cpy. * symtab.c (symtab_node::output_to_lto_symbol_table_p): Tidy up.
2021-05-04Daily bump.GCC Administrator1-0/+5
2021-05-03GCC_CET_HOST_FLAGS: Check if host supports multi-byte NOPsH.J. Lu1-0/+29
Sync with binutils for PR binutils/27397. Check if host supports multi-byte NOPs before enabling CET on host. config/ PR bootstrap/99703 * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte NOPs. libiberty/ PR bootstrap/99703 * configure: Regenerated.
2021-04-22Daily bump.GCC Administrator1-0/+6