aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-08-27Re: commit eae0b5c3b2d6bAlan Modra2-3/+7
PR 26416 * elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Correct "dynamic".
2020-08-27binutils, ld: dequote libctf error messagesNick Alcock12-13/+32
These are not identifiers and should not be quoted. (Also, quoting them just looks odd.) Adjust diagnostics tests accordingly. binutils/ChangeLog 2020-08-27 Nick Alcock <nick.alcock@oracle.com> * objdump.c (dump_ctf_errs): Unquote CTF error messages. * readelf.c (dump_ctf_errs): Likewise. ld/ChangeLog 2020-08-27 Nick Alcock <nick.alcock@oracle.com> * ldlang.c (dump_ctf_errs): Unquote CTF error messages. (ldlang_open_ctf): Likewise. (lang_merge_ctf): Likewise. (lang_write_ctf): Likewise. * testsuite/ld-ctf/diag-ctf-version-f.d: Adjust. * testsuite/ld-ctf/diag-cttname-invalid.d: Adjust. * testsuite/ld-ctf/diag-decompression-failure.d: Adjust. * testsuite/ld-ctf/diag-parname.d: Adjust. * testsuite/ld-ctf/diag-unsupported-flag.d: Adjust. * testsuite/ld-ctf/diag-wrong-magic-number-mixed.d: Adjust. * testsuite/ld-ctf/diag-wrong-magic-number.d: Adjust.
2020-08-27libctf, binutils, include, ld: gettextize and improve error handlingNick Alcock21-418/+658
This commit follows on from the earlier commit "libctf, ld, binutils: add textual error/warning reporting for libctf" and converts every error in libctf that was reported using ctf_dprintf to use ctf_err_warn instead, gettextizing them in the process, using N_() where necessary to avoid doing gettext calls unless an error message is actually generated, and rephrasing some error messages for ease of translation. This requires a slight change in the ctf_errwarning_next API: this API is public but has not been in a release yet, so can still change freely. The problem is that many errors are emitted at open time (whether opening of a CTF dict, or opening of a CTF archive): the former of these throws away its incompletely-initialized ctf_file_t rather than return it, and the latter has no ctf_file_t at all. So errors and warnings emitted at open time cannot be stored in the ctf_file_t, and have to go elsewhere. We put them in a static local in ctf-subr.c (which is not very thread-safe: a later commit will improve things here): ctf_err_warn with a NULL fp adds to this list, and the public interface ctf_errwarning_next with a NULL fp retrieves from it. We need a slight exception from the usual iterator rules in this case: with a NULL fp, there is nowhere to store the ECTF_NEXT_END "error" which signifies the end of iteration, so we add a new err parameter to ctf_errwarning_next which is used to report such iteration-related errors. (If an fp is provided -- i.e., if not reporting open errors -- this is optional, but even if it's optional it's still an API change. This is actually useful from a usability POV as well, since ctf_errwarning_next is usually called when there's been an error, so overwriting the error code with ECTF_NEXT_END is not very helpful! So, unusually, ctf_errwarning_next now uses the passed fp for its error code *only* if no errp pointer is passed in, and leaves it untouched otherwise.) ld, objdump and readelf are adapted to call ctf_errwarning_next with a NULL fp to report open errors where appropriate. The ctf_err_warn API also has to change, gaining a new error-number parameter which is used to add the error message corresponding to that error number into the debug stream when LIBCTF_DEBUG is enabled: changing this API is easy at this point since we are already touching all existing calls to gettextize them. We need this because the debug stream should contain the errno's message, but the error reported in the error/warning stream should *not*, because the caller will probably report it themselves at failure time regardless, and reporting it in every error message that leads up to it leads to a ridiculous chattering on failure, which is likely to end up as ridiculous chattering on stderr (trimmed a bit): CTF error: `ld/testsuite/ld-ctf/A.c (0): lookup failure for type 3: flags 1: The parent CTF dictionary is unavailable' CTF error: `ld/testsuite/ld-ctf/A.c (0): struct/union member type hashing error during type hashing for type 80000001, kind 6: The parent CTF dictionary is unavailable' CTF error: `deduplicating link variable emission failed for ld/testsuite/ld-ctf/A.c: The parent CTF dictionary is unavailable' ld/.libs/lt-ld-new: warning: CTF linking failed; output will have no CTF section: `The parent CTF dictionary is unavailable' We only need to be told that the parent CTF dictionary is unavailable *once*, not over and over again! errmsgs are still emitted on warning generation, because warnings do not usually lead to a failure propagated up to the caller and reported there. Debug-stream messages are not translated. If translation is turned on, there will be a mixture of English and translated messages in the debug stream, but rather that than burden the translators with debug-only output. binutils/ChangeLog 2020-08-27 Nick Alcock <nick.alcock@oracle.com> * objdump.c (dump_ctf_archive_member): Move error- reporting... (dump_ctf_errs): ... into this separate function. (dump_ctf): Call it on open errors. * readelf.c (dump_ctf_archive_member): Move error- reporting... (dump_ctf_errs): ... into this separate function. Support calls with NULL fp. Adjust for new err parameter to ctf_errwarning_next. (dump_section_as_ctf): Call it on open errors. include/ChangeLog 2020-08-27 Nick Alcock <nick.alcock@oracle.com> * ctf-api.h (ctf_errwarning_next): New err parameter. ld/ChangeLog 2020-08-27 Nick Alcock <nick.alcock@oracle.com> * ldlang.c (lang_ctf_errs_warnings): Support calls with NULL fp. Adjust for new err parameter to ctf_errwarning_next. Only check for assertion failures when fp is non-NULL. (ldlang_open_ctf): Call it on open errors. * testsuite/ld-ctf/ctf.exp: Always use the C locale to avoid breaking the diags tests. libctf/ChangeLog 2020-08-27 Nick Alcock <nick.alcock@oracle.com> * ctf-subr.c (open_errors): New list. (ctf_err_warn): Calls with NULL fp append to open_errors. Add err parameter, and use it to decorate the debug stream with errmsgs. (ctf_err_warn_to_open): Splice errors from a CTF dict into the open_errors. (ctf_errwarning_next): Calls with NULL fp report from open_errors. New err param to report iteration errors (including end-of-iteration) when fp is NULL. (ctf_assert_fail_internal): Adjust ctf_err_warn call for new err parameter: gettextize. * ctf-impl.h (ctfo_get_vbytes): Add ctf_file_t parameter. (LCTF_VBYTES): Adjust. (ctf_err_warn_to_open): New. (ctf_err_warn): Adjust. (ctf_bundle): Used in only one place: move... * ctf-create.c: ... here. (enumcmp): Use ctf_err_warn, not ctf_dprintf, passing the err number down as needed. Don't emit the errmsg. Gettextize. (membcmp): Likewise. (ctf_add_type_internal): Likewise. (ctf_write_mem): Likewise. (ctf_compress_write): Likewise. Report errors writing the header or body. (ctf_write): Likewise. * ctf-archive.c (ctf_arc_write_fd): Use ctf_err_warn, not ctf_dprintf, and gettextize, as above. (ctf_arc_write): Likewise. (ctf_arc_bufopen): Likewise. (ctf_arc_open_internal): Likewise. * ctf-labels.c (ctf_label_iter): Likewise. * ctf-open-bfd.c (ctf_bfdclose): Likewise. (ctf_bfdopen): Likewise. (ctf_bfdopen_ctfsect): Likewise. (ctf_fdopen): Likewise. * ctf-string.c (ctf_str_write_strtab): Likewise. * ctf-types.c (ctf_type_resolve): Likewise. * ctf-open.c (get_vbytes_common): Likewise. Pass down the ctf dict. (get_vbytes_v1): Pass down the ctf dict. (get_vbytes_v2): Likewise. (flip_ctf): Likewise. (flip_types): Likewise. Use ctf_err_warn, not ctf_dprintf, and gettextize, as above. (upgrade_types_v1): Adjust calls. (init_types): Use ctf_err_warn, not ctf_dprintf, as above. (ctf_bufopen_internal): Likewise. Adjust calls. Transplant errors emitted into individual dicts into the open errors if this turns out to be a failed open in the end. * ctf-dump.c (ctf_dump_format_type): Adjust ctf_err_warn for new err argument. Gettextize. Don't emit the errmsg. (ctf_dump_funcs): Likewise. Collapse err label into its only case. (ctf_dump_type): Likewise. * ctf-link.c (ctf_create_per_cu): Adjust ctf_err_warn for new err argument. Gettextize. Don't emit the errmsg. (ctf_link_one_type): Likewise. (ctf_link_lazy_open): Likewise. (ctf_link_one_input_archive): Likewise. (ctf_link_deduplicating_count_inputs): Likewise. (ctf_link_deduplicating_open_inputs): Likewise. (ctf_link_deduplicating_close_inputs): Likewise. (ctf_link_deduplicating): Likewise. (ctf_link): Likewise. (ctf_link_deduplicating_per_cu): Likewise. Add some missed ctf_set_errnos to obscure error cases. * ctf-dedup.c (ctf_dedup_rhash_type): Adjust ctf_err_warn for new err argument. Gettextize. Don't emit the errmsg. (ctf_dedup_populate_mappings): Likewise. (ctf_dedup_detect_name_ambiguity): Likewise. (ctf_dedup_init): Likewise. (ctf_dedup_multiple_input_dicts): Likewise. (ctf_dedup_conflictify_unshared): Likewise. (ctf_dedup): Likewise. (ctf_dedup_rwalk_one_output_mapping): Likewise. (ctf_dedup_id_to_target): Likewise. (ctf_dedup_emit_type): Likewise. (ctf_dedup_emit_struct_members): Likewise. (ctf_dedup_populate_type_mapping): Likewise. (ctf_dedup_populate_type_mappings): Likewise. (ctf_dedup_emit): Likewise. (ctf_dedup_hash_type): Likewise. Fix a bit of messed-up error status setting. (ctf_dedup_rwalk_one_output_mapping): Likewise. Don't hide unknown-type-kind messages (which signify file corruption).
2020-08-27libctf, binutils: initial work towards libctf gettextizationNick Alcock11-21/+107
We gettextize under our package name, which we change to a more reasonable 'libctf'. Our internationalization support is mostly provided by ctf-intl.h, which is a copy of opcodes/opintl.h with the non-gettext_noop N_() expansion debracketed to avoid pedantic compiler warnings. The libctf error strings returned by ctf_errmsg are marked up for internationalization. (We also adjust binutils's Makefile a tiny bit to allow for the fact that libctf now uses functions from libintl.) binutils/ChangeLog 2020-08-27 Nick Alcock <nick.alcock@oracle.com> * Makefile.am (readelf_LDADD): Move $(LIBINTL) after $(LIBCTF_NOBFD). * Makefile.in: Regenerated. libctf/ChangeLog 2020-08-27 Nick Alcock <nick.alcock@oracle.com> * configure.ac: Adjust package name to simply 'libctf': arbitrarily declare this to be version 1.2.0. * Makefile.am (AM_CPPFLAGS): Add @INCINTL@. * Makefile.in: Regenerated. * configure: Regenerated. * ctf-intl.h: New file, lightly modified from opcodes/opintl.h. * ctf-impl.h: Include it. * ctf-error.r (_ctf_errlist_t): Mark strings as noop-translatable. (ctf_errmsg): Actually translate them.
2020-08-27Change the default characteristics of DLLs built by the linker to more ↵Jeremy Drake8-43/+201
secure settings. PR 19011 * emultempl/pe.em (DEFAULT_DLL_CHARACTERISTICS): Define. (pe_dll_characteristics): Initialise to DEFAULT_DLL_CHARACTERISTICS. (add_options): Add options to disable DLL characteristics. (list_options): List the new options. (handle_options): Handle the new options. * emultempl/pep.em: Similar changes to above. (NT_EXE_IMAGE_BASE): Default to an address above 4G. (NT_DLL_IMAGE_BASE, NT_DLL_AUTO_IMAGE_BASE, (NT_DLL_AUTO_IMAGE_MASK): Likewise. * ld.texi: Document the new options. * pe-dll.c (pe_dll_enable_reloc_section): Change to default to true. (generate_reloc): Do nothing if there is no reloc section. (pe_exe_fill_sections): Only assign the reloc section contents if the section exists. * testsuite/ld-pe/pe.exp: Add the --disable-reloc-section flag to the .secrel32 tests. * testsuite/ld-scripts/provide-8.d: Expect for fail on PE targets. * NEWS: Mention the change in DLL generation.
2020-08-27Automatic date update in version.inGDB Administrator1-1/+1
2020-08-26Update gnulib to current trunkChristian Biesinger104-1956/+5524
This fixes two issues on Windows: Update. https://sourceware.org/pipermail/gdb-patches/2020-June/169978.html gnulib/ChangeLog: 2020-08-26 Christian Biesinger <cbiesinger@google.com> Pedro Alves <palves@redhat.com> Joel Brobecker <brobecker@adacore.com> * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.in: Regenerate. * configure: Regenerate. * import/Makefile.am: Update. * import/Makefile.in: Regenerate. * import/alloca.in.h (if): Update. * import/assure.h (affirm): Update. * import/at-func.c: Update. * import/attribute.h: New file. * import/btowc.c: New file. * import/canonicalize-lgpl.c: Update. * import/count-one-bits.h (COUNT_ONE_BITS_GENERIC): Update. (COUNT_ONE_BITS): Update. (intrinsic): Update. (__popcnt64): Update. (popcount_supported): Update. * import/ctype.in.h: New file. * import/dirent-private.h (WIN32_FIND_DATA): Update. * import/dirent.in.h (_GL_ATTRIBUTE_PURE): Update. * import/dirname.h: Update. * import/dosname.h: Remove. * import/error.h (_GL_ATTRIBUTE_FORMAT): Update. * import/extra/update-copyright: Update. * import/fchdir.c: Update. * import/fcntl.in.h (GNULIB_defined_rpl_fcntl): Update. (GNULIB_defined_fcntl): Update. * import/filename.h (HAS_DEVICE): Update. (IS_ABSOLUTE_PATH): Update. (IS_PATH_WITH_DIR): Update. (FILE_SYSTEM_PREFIX_LEN): Update. (_IS_DRIVE_LETTER): Update. (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE): Update. (IS_ABSOLUTE_FILE_NAME): Update. (IS_RELATIVE_FILE_NAME): Update. (IS_FILE_NAME_WITH_DIR): Update. * import/filenamecat-lgpl.c (mfile_name_concat): Update. * import/fnmatch.c (WIDE_CHAR_SUPPORT): Update. (btowc): Update. (iswctype): Update. (mempcpy): Update. (strnlen): Update. (towlower): Update. (wcscat): Update. (wcslen): Update. (wctype): Update. (wmemchr): Update. (wmempcpy): Update. (SIZE_MAX): Update. (isblank): Update. (__libc_use_alloca): Update. (alloca): Update. (alloca_account): Update. (STREQ): Update. (CHAR_CLASS_MAX_LENGTH): Update. (IS_CHAR_CLASS): Update. (ISWCTYPE): Update. (if): Update. (HANDLE_MULTIBYTE): Update. (internal_function): Update. (FOLD): Update. (CHAR): Update. (UCHAR): Update. (INT): Update. (FCT): Update. (EXT): Update. (END): Update. (L_): Update. (BTOWC): Update. (STRLEN): Update. (STRCAT): Update. (MEMPCPY): Update. (MEMCHR): Update. (WIDE_CHAR_VERSION): Update. (STRUCT): Update. (FINDIDX): Update. (findidx): Update. (ALLOCA_LIMIT): Update. (SHLIB_COMPAT): Update. * import/fnmatch_loop.c (struct STRUCT): Update. (FCT): Update. (EXT): Update. (END): Update. (str): Update. (NEW_PATTERN): Update. * import/getcwd.c: Update. * import/getlogin_r.c (GetUserName): Update. * import/getprogname.c (getprogname): Update. * import/getrandom.c: New file. * import/gettimeofday.c: Remove. * import/glob.in.h (_Restrict_): Update. * import/inttypes.in.h (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. * import/isblank.c: New file. * import/isnanl-nolibm.h (__has_builtin): Update. * import/libc-config.h (versioned_symbol): Update. (compat_symbol): Update. * import/limits.in.h (_GL_ALREADY_INCLUDING_LIMITS_H): Update. * import/m4/btowc.m4: New file. * import/m4/ctype.m4: New file. * import/m4/exponentl.m4: Update. * import/m4/fnmatch.m4: Update. * import/m4/getrandom.m4: New file. * import/m4/glob.m4: Update. * import/m4/gnulib-cache.m4: Update. * import/m4/gnulib-common.m4: Update. * import/m4/gnulib-comp.m4: Update. * import/m4/inttypes.m4: Update. * import/m4/isblank.m4: New file. * import/m4/isnanl.m4: Update. * import/m4/largefile.m4: Update. * import/m4/mbtowc.m4: New file. * import/m4/memmem.m4: Update. * import/m4/minmax.m4: New file. * import/m4/signal_h.m4: Update. * import/m4/stdio_h.m4: Update. * import/m4/stdlib_h.m4: Update. * import/m4/string_h.m4: Update. * import/m4/strnlen.m4: New file. * import/m4/sys_random_h.m4: New file. * import/m4/sys_socket_h.m4: Update. * import/m4/sys_stat_h.m4: Update. * import/m4/time_h.m4: Update. * import/m4/unistd_h.m4: Update. * import/m4/wchar_h.m4: Update. * import/m4/wint_t.m4: Update. * import/m4/wmemchr.m4: New file. * import/m4/wmempcpy.m4: New file. * import/math.in.h (__has_builtin): Update. * import/mbrtowc.c (FALLTHROUGH): Update. * import/mbtowc-impl.h: New file. * import/mbtowc.c: New file. * import/minmax.h: New file. * import/open.c (open): Update. * import/openat-proc.c (openat_proc_name): Update. * import/openat.c (rpl_openat): Update. (openat_needs_fchdir): Update. * import/openat.h (FCHOWNAT_INLINE): Update. (CHOWNAT_INLINE): Update. (FCHMODAT_INLINE): Update. (CHMODAT_INLINE): Update. * import/opendir.c (WIN32_FIND_DATA): Update. (GetFullPathName): Update. (FindFirstFile): Update. * import/readdir.c (FindNextFile): Update. * import/rename.c (MoveFileEx): Update. * import/rewinddir.c (FindFirstFile): Update. * import/rmdir.c: Update. * import/signal.in.h (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. * import/stat-w32.c (_WIN32_WINNT): Update. (LoadLibrary): Update. (GetFinalPathNameByHandle): Update. (GetProcAddress): Update. (DWORD): Update. (GetFileInformationByHandleExFunc): Update. (GetFinalPathNameByHandleFunc): Update. * import/stat.c (WIN32_FIND_DATA): Update. (CreateFile): Update. (FindFirstFile): Update. * import/stdio.in.h (_GL_ATTRIBUTE_FORMAT): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. (_GL_FUNCDECL_RPL_1): Update. (_GL_CXXALIAS_RPL_1): Update. (_GL_CXXALIAS_SYS_CAST): Update. * import/stdlib.in.h (_GL_ATTRIBUTE_PURE): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. * import/string.in.h (_GL_ATTRIBUTE_PURE): Update. (_GL_WARN_ON_USE): Update. (_GL_WARN_ON_USE_CXX): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_CXXALIAS_SYS): Update. (mbstok_r): Update. * import/strnlen.c: New file. * import/sys_random.in.h: New file. * import/sys_socket.in.h (GNULIB_defined_socklen_t): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_CXXALIAS_SYS_CAST): Update. * import/sys_stat.in.h (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. (lchmod): Update. (_GL_CXXALIAS_RPL_1): Update. (stat): Update. * import/tempname.c (__set_errno): Update. (__secure_getenv): Update. (__try_tempname): Update. (__getpid): Update. (__gettimeofday): Update. (RANDOM_BITS): Update. (uint64_t): Update. (RANDOM_VALUE_MAX): Update. (BASE_62_DIGITS): Update. (BASE_62_POWER): Update. (try_tempname_len): Update. (try_file): Update. (try_dir): Update. (try_nocreate): Update. (gen_tempname_len): Update. (__gen_tempname): Update. (try_tempname): Update. * import/tempname.h (gen_tempname_len): Update. (try_tempname_len): Update. * import/time.in.h (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_CXXALIAS_SYS): Update. * import/unistd.in.h (if): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. (_GL_CXXALIASWARN): Update. (_GL_WARN_ON_USE): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. * import/verify.h: Update. * import/warn-on-use.h (_GL_WARN_ON_USE_CXX): Update. * import/wchar.in.h (_GL_ATTRIBUTE_PURE): Update. (_GL_FUNCDECL_RPL): Update. (_GL_CXXALIAS_RPL): Update. (_GL_FUNCDECL_SYS): Update. (_GL_CXXALIAS_SYS): Update. (_GL_CXXALIASWARN): Update. (_GL_WARN_ON_USE): Update. (_GL_CXXALIAS_SYS_CAST2): Update. (_GL_CXXALIASWARN1): Update. * import/windows-rwlock.c (CreateEvent): Update. * import/wmemchr-impl.h: New file. * import/wmemchr.c: New file. * import/wmempcpy.c: New file. * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add gettimeofday. (GNULIB_COMMIT_SHA1): Update gnulib revision.
2020-08-26ld: Add $NOSANTIZE_CFLAGS to more linker testsH.J. Lu10-57/+141
-fsanitize= can be used to build binutils with $ CC="gcc -fsanitize=address,undefined" CXX="g++ -fsanitize=address,undefined" .../configure --disable-werror Since not all linker tests are compatible with -fsanitize=, pass $NOSANTIZE_CFLAGS to disable -fsanitize= for such tests. * testsuite/ld-elf/indirect.exp: Append $NOSANTIZE_CFLAGS to CC. * testsuite/ld-elf/shared.exp: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Likewise. * testsuite/ld-elfvers/vers.exp: Likewise. * testsuite/ld-elfvsb/elfvsb.exp: Likewise. * testsuite/ld-elfweak/elfweak.exp: Likewise. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-plugin/plugin.exp: Likewise. * testsuite/ld-scripts/crossref.exp: Likewise.
2020-08-26Fix sanitization problems in the BFD library when running the linker ↵Nick Clifton2-7/+13
testsuite for the AVR target. PR 26433 * elf32-avr.c (avr_final_link_relocate): Fix undefined shift behaviour. (avr_elf32_load_records_from_section): Use bfd_get_16 and bfd_get_32 to load values from potentially unaligned pointers.
2020-08-26Fix sanitization problems running the linker testsuite for the alpha-elf target.Nick Clifton2-11/+27
PR 26416 * elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Test for and ignore local symbols. (elf64_alpha_relax_got_load): Do not check for local dynamic symbols. (OP_LDA, OP_LDAH, OP_LDQ, OP_BR, OP_BSR): Use unsigned constant values. (INSN_A) Cast the A parameter to unsigned. (INSN_AB): Define in terms of INSN_A. (INSN_ABC): Likewise. (INSN_ABO): Likewise. (INSN_AD): Likewise.
2020-08-26Fix a sanitization problem running the linker testsuite for the AArch64 target.Nick Clifton2-1/+8
PR 26411 * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Use an unsigned long constant when creating a mask to test for alignment issues.
2020-08-26opcodes: Add missing entries to ebpf_isa_attrJose E. Marchesi2-1/+5
opcodes/ * disassemble.c (enum epbf_isa_attr): Add ISA_XBPFBE, ISA_EBPFMAX.
2020-08-26Add support to readelf for the OpenBSD segment types.Nick Clifton4-0/+21
PR 26405 binutils* readelf.c (get_segment_type): Handle OpenBSD segment types. include * elf/common.h (PT_OPENBSD_BOOTDATA): Define. (PT_OPENBSD_RANDOMIZE): Define. (PT_OPENBSD_WXNEEDED): Define.
2020-08-26PR26508 UBSAN: tc-xtensa.c:7764 null pointer bsearchAlan Modra2-0/+9
PR 26508 * config/tc-xtensa.c (xg_get_trampoline_chain): Return early when n_entries is zero.
2020-08-26PR26507 UBSAN: elf32-xtensa.c:6013 null pointer bsearchAlan Modra2-6/+14
PR 26507 * elf32-xtensa.c (find_removed_literal): Don't bsearch empty map.
2020-08-26PR26506 UBSAN: elf32-xtensa.c:3203 null pointer memcpyAlan Modra2-0/+9
PR 26506 * elf32-xtensa.c (elf_xtensa_combine_prop_entries): Return early when section is empty.
2020-08-26PR26499 UBSAN: eelf32_spu.c:537 member access null pointerAlan Modra2-1/+6
Another &p->field. PR 26499 * emultempl/spuelf.em (spu_elf_relink): Check for NULL tmp_file_list.
2020-08-26PR26498 UBSAN: elf32-spu.c:2292 left shift overflowAlan Modra2-2/+8
PR 26498 * elf32-spu.c (find_function_stack_adjust): Use unsigned vars to avoid UB left shift.
2020-08-26PR 26484-26488, 26490 UBSAN &h->elf null pointerAlan Modra2-18/+40
PR 26484 PR 26485 PR 26486 PR 26487 PR 26488 PR 26490 * elf64-ppc.c (is_tls_get_addr): Avoid UB &h->elf when h is NULL. (ppc64_elf_tls_setup): Likewise. (branch_reloc_hash_match): Likewise. (build_plt_stub): Likewise. (ppc64_elf_relocate_section): Likewise.
2020-08-26PR26478 UBSAN: mmo.c:2941 null pointer memcpyAlan Modra2-1/+7
PR 26478 * mmo.c (mmo_write_symbols_and_terminator): Don't memcpy empty table.
2020-08-26PR26475 UBSAN: elfxx-mips.c:12180 null pointer memsetAlan Modra2-1/+8
Another memset(0,0,0) PR 26475 * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Check sstubs->contents != NULL.
2020-08-26PR26458 UBSAN: elf32-i386.c:3615 left shift of negative valueAlan Modra2-1/+6
Happens when poking symbol index -2 into r_info. (The index is updated before writing out to file.) PR 26458 * elf/common.h (ELF32_R_INFO): Cast symbol index to unsigned.
2020-08-26PR26453 UBSAN: som.c:2885 null pointer memcpyAlan Modra2-0/+8
PR 26453 * som.c (som_prep_for_fixups): Return early when no symbols.
2020-08-26PR26448 UBSAN: symbols.c:1586 left shift of negative valueAlan Modra2-2/+26
Besides avoiding the UB, this also makes right shifts inside expression symbols unsigned, consistent with the way gas evaluates expressions in source. PR 26448 * symbols.c: Include limits.h. (resolve_symbol_value <O_left_shift, O_right_shift>): Do an unsigned shift. Warn if shift count larger than valueT size.
2020-08-26PR26447 UBSAN: expr.c:1936 left shift of negative valueAlan Modra2-6/+22
PR 26447 * expr.c (expr <O_left_shift>): Do an unsigned shift.
2020-08-26PR26431 UBSAN: pe-dll.c:568 null pointer bsearchAlan Modra2-2/+8
PR 26431 * pe-dll.c (auto_export): Don't call bsearch with zero count.
2020-08-26PR26418 UBSAN: cache.c:386 null pointer fwriteAlan Modra2-4/+11
PR 26418 * ecofflink.c (WRITE): Don't write size 0 chunks.
2020-08-26asan: alpha-vms: mmember access within null pointerAlan Modra2-7/+15
* bfdio.c (bfd_get_file_size): Don't segv on NULL adata.
2020-08-26PR26415 UBSAN: vms-misc.c:636 left shift cannot be representedAlan Modra2-2/+7
An unsigned short value is promoted to int, thus triggering UB on a left shift of a positive value that results in a negative int. PR 26415 * vms-misc.c (vms_time_t_to_vms_time): Don't use unsigned short vars.
2020-08-26PR26412 UBSAN: objcopy.c:3026 null pointer fwriteAlan Modra2-2/+8
PR 26412 * objcopy.c (copy_object): Don't fwrite NULL contents.
2020-08-26bpf: add xBPF ISADavid Faust19-323/+543
This patch adds support for xBPF, another ISA targetting the BPF virtual architecture. For now, the primary difference between eBPF and xBPF is that xBPF supports indirect calls through the 'call %reg' form of the call instruction. bfd/ * archures.c (bfd_mach_xbpf): Define. * bfd-in2.h: Regenerate. * cpu-bpf.c (bfd_xbpf_arch) New. (bfd_bpf_arch) Update next in list field to point to xbpf arch. cpu/ * bpf.cpu (arch bpf): Add xbpf mach and isas. (define-xbpf-isa) New pmacro. (all-isas) Add xbpfle,xbpfbe. (endian-isas): New pmacro. (mach xbpf): New. (model xbpf-def): Likewise. (h-gpr): Add xbpf mach. (f-dstle, f-srcle, dstle, srcle): Add xbpfle isa. (f-dstbe, f-srcbe, dstbe, srcbe): Add xbpfbe isa. (define-alu-insn-un): Use new endian-isas pmacro. (define-alu-insn-bin, define-alu-insn-mov): Likewise. (define-endian-insn, define-lddw): Likewise. (dlind, dxli, dxsi, dsti): Likewise. (define-cond-jump-insn, define-call-insn): Likewise. (define-atomic-insns): Likewise. gas/ * config/tc-bpf.c: Add option -mxbpf to select xbpf isa. * testsuite/gas/bpf/indcall-1.d: New file. * testsuite/gas/bpf/indcall-1.s: Likewise. * testsuite/gas/bpf/indcall-bad-1.l: Likewise. * testsuite/gas/bpf/indcall-bad-1.s: Likewise. * testsuite/gas/bpf/bpf.exp: Run new tests. opcodes/ * bpf-desc.c: Regenerate. * bpf-desc.h: Likewise. * bpf-opc.c: Likewise. * bpf-opc.h: Likewise. * disassemble.c (disassemble_init_for_target): Set bits for xBPF ISA when appropriate.
2020-08-26windres: AUTOCHECKBOX default style must have WS_TABSTOP styleKatayama Hirofumi2-1/+6
PR 26340 * rcparse.y (AUTOCHECKBOX): Add WS_TABSTOP to the base style.
2020-08-26gdb: Add ARC target and maintainer to MAINTAINERSShahab Vahedi2-0/+7
This patch updates gdb/MAINTAINERS with ARC as a target and myself as the maintainer. There is no mention of "-Werror" because that is enabled by default for gdb/ targets now. gdb/ChangeLog: * MAINTAINERS: Add ARC target and maintainer.
2020-08-26Re: CSKY: Add new arch CK860Alan Modra2-0/+5
bfd-in2.h is a generated file. Put the new machine where it belongs. * archures.c (bfd_mach_ck860): Define.
2020-08-26Automatic date update in version.inGDB Administrator1-1/+1
2020-08-25arc: Add GNU/Linux support for ARCAnton Kolesov6-2/+298
ARC Linux targets differences from baremetal: - No support for hardware single instruction stepping. - Different access rules to registers. - Use of another instruction for breakpoints. v2: Changes after Tom's remarks [1] arc-linux-tdep.c - Use true/false instead of TRUE/FALSE. - arc_linux_sw_breakpoint_from_kind (): Break long lines into two. - arc_linux_sw_breakpoint_from_kind (): Remove starting blank line. - Use explicit number evaluation, e.g: if (a & b) -> if ((a & b) != 0) arc-tdep.c - Use explicit number evaluation, e.g: if (a & b) -> if ((a & b) != 0) gdb/configure.tgt - arc*-*-linux*): Remove "build_gdbserver=yes". v3: Changes after Simon's remarks [2] arc-linux-tdep.c - Use "return trap_size" instead of cryptic "return 2". - Removed unnecessary curly braces. - Removed "void" from "_initialize_arc_linux_tdep (void)". v5: Changes after Simon's remarks [3] - Remove unnecessary empty lines. - Replace "breakpoint uses" with "breakpoints use" in a comment. - "return condition;" i.s.o. "if (condition) return true; else return false;" [1] Tom's remarks https://sourceware.org/pipermail/gdb-patches/2020-April/167887.html [2] Simon's remarks on v2 https://sourceware.org/pipermail/gdb-patches/2020-May/168513.html [3] Simon's remarks on v4 https://sourceware.org/pipermail/gdb-patches/2020-August/170994.html gdb/ChangeLog: 2020-08-25 Anton Kolesov <anton.kolesov@synopsys.com> * configure.tgt: ARC support for GNU/Linux. * Makefile.in (ALL_TARGET_OBJS): Likewise. * arc-linux-tdep.c: New file. * arc-tdep.h (ARC_STATUS32_L_MASK, ARC_STATUS32_DE_MASK): Declare. * arc-tdep.c (arc_write_pc): Use it.
2020-08-25arc: Add hardware loop detectionShahab Vahedi5-6/+56
For ARC there are registers that are not part of a required set in XML target descriptions by default, but are almost always present on ARC targets and are universally exposed by the ptrace interface. Hardware loop registers being one of them. LP_START and LP_END auxiliary registers are hardware loop start and end. Formally, they are optional, but it is hard to find an ARC configuration that doesn't have them. They are always present in processors that can run GNU/Linux. GDB needs to know about those registers to implement proper software single stepping, since they affect what instruction will be next. This commit adds the code to check for the existance of "lp_start" and "lp_end" in XML target descriptions. If they exist, then the function reports that the target supports hardware loops. gdb/ChangeLog: * arc-tdep.c (arc_check_for_hardware_loop): New. * arc-tdep.h (gdbarch_tdep): New field has_hw_loops. gdb/doc/ChangeLog: * gdb.texinfo (Synopsys ARC): Document LP_START, LP_END and BTA.
2020-08-25arc: Add inclusion of "gdbarch.h" in "arc-tdep.h"Shahab Vahedi2-0/+5
The "arc-tdep.h" makes use of definitions in "gdbarch.h", but it does not include it explicitly. I have piggy backed this fix in another commit [1], but I was asked to do it separately [2]. [1] arc: Add hardware loop detection https://sourceware.org/pipermail/gdb-patches/2020-July/170800.html [2] Simon's remarks to "arc: Add hardware loop detection" https://sourceware.org/pipermail/gdb-patches/2020-August/170993.html gdb/ChangeLog: * arc-tdep.h: Include "gdbarch.h".
2020-08-25arc: Add ARCv2 XML target along with refactoringShahab Vahedi19-349/+691
A few changes have been made to make the register support simpler, more flexible and extendible. The trigger for most of these changes are the remarks [1] made earlier for v2 of this patch. The noticeable improvements are: - The arc XML target features are placed under gdb/features/arc - There are two cores (based on ISA) and one auxiliary feature: v1-core: ARC600, ARC601, ARC700 v2-core: ARC EM, ARC HS aux: common in both - The XML target features represent a minimalistic sane set of registers irrespective of application (baremetal or linux). - A concept of "feature" class has been introduced in the code. The "feature" object is constructed from BFD and GDBARCH data. It contains necessary information (ISA and register size) to determine which XML target feature to use. - A new structure (ARC_REGISTER_FEATURE) is added that allows providing index, names, and the necessity of registers. This simplifies the sanity checks and future extendibility. - Documnetation has been updated to reflect ARC features better. - Although the feature names has changed, there still exists backward compatibility with older names through find_obsolete_[core,aux]_names() functions. The last two points were inspired from RiscV port. [1] https://sourceware.org/pipermail/gdb-patches/2020-May/168511.html gdb/ChangeLog: * arch/arc.h (arc_gdbarch_features): New class to stir the selection of target XML. (arc_create_target_description): Use FEATURES to choose XML target. (arc_lookup_target_description): Use arc_create_target_description to create _new_ target descriptions or return the already created ones if the FEATURES is the same. * arch/arc.c: Implementation of prototypes described above. * gdb/arc-tdep.h (arc_regnum enum): Add more registers. (arc_gdbarch_features_init): Initialize the FEATURES struct. * arc-tdep.c (*_feature_name): Make feature names consistent. (arc_register_feature): A new struct to hold information about registers of a particular target/feature. (arc_check_tdesc_feature): Check if XML provides registers in compliance with ARC_REGISTER_FEATURE structs. (arc_update_acc_reg_names): Add aliases for r58 and r59. (determine_*_reg_feature_set): Which feature name to look for. (arc_gdbarch_features_init): Given MACH and ABFD, initialize FEATURES. (mach_type_to_arc_isa): Convert from a set of binutils machine types to expected ISA enums to be used in arc_gdbarch_features structs. * features/Makefile (FEATURE_XMLFILES): Add new files. * gdb/features/arc/v1-aux.c: New file. * gdb/features/arc/v1-aux.xml: Likewise. * gdb/features/arc/v1-core.c: Likewise. * gdb/features/arc/v1-core.xml: Likewise. * gdb/features/arc/v2-aux.c: Likewise. * gdb/features/arc/v2-aux.xml: Likewise. * gdb/features/arc/v2-core.c: Likewise. * gdb/features/arc/v2-core.xml: Likewise. * NEWS (Changes since GDB 9): Announce obsolence of old feature names. gdb/doc/ChangeLog: * gdb.texinfo (Synopsys ARC): Update the documentation for ARC Features. gdb/testsuite/ChangeLog: * gdb.arch/arc-tdesc-cpu.xml: Use new feature names.
2020-08-25gdb/testsuite: fix gdb.threads/stepi-random-signal.exp pattern (gdb/26532)Simon Marchi2-1/+6
Commit 1eb8556f5a8b ("gdb: add infrun_debug_printf macro") changed the debug output format for `set debug infrun 1`. The test gdb.threads/stepi-random-signal.exp uses that debug output, and was updated, but not correctly. It results in this failure: FAIL: gdb.threads/stepi-random-signal.exp: stepi (no random signal) Fix it by adjusting the pattern in the test. gdb/testsuite/ChangeLog: PR gdb/26532 * gdb.threads/stepi-random-signal.exp: Update pattern. Change-Id: If5fa525e9545e32a286effe6a6184358374bd37c
2020-08-25gdb/testsuite: fix gdb.base/ui-redirect.exp pattern (gdb/26532)Simon Marchi2-1/+6
Commit 1eb8556f5a8b ("gdb: add infrun_debug_printf macro") changed the debug output format for `set debug infrun 1`. It broke test gdb.base/ui-redirect.exp, which I missed: FAIL: gdb.base/ui-redirect.exp: debugging: continue Fix it by adjusting the pattern in the test to the new reality. gdb/testsuite/ChangeLog: PR gdb/26532 * gdb.base/ui-redirect.exp: Update pattern. Change-Id: Ie8a8f6675e35a0cab55109b1534b44eb51baec9d
2020-08-25Fix ChangeLog entry for commit b04aa1fc8c9d4a79e6293a3a1df7507052afedf3Gary Benson1-1/+1
2020-08-25Fix the linker's handling of DWARF-5 line number tables.Mark Wielaard2-2/+136
When building with gcc with -gdwarf-5 ld tests (including ld-elf/dwarf.exp) fail because they try to read the .debug_ranges section. But DWARF5 introduces a new .debug_rnglists section that encodes the address ranges more efficiently. Implement reading the debug_rnglists in bfd/dwarf2.c. Which makes all tests pass again and fixes several gcc testsuite tests when defaulting to DWARF5. * dwarf2.c (struct dwarf2_debug_file): Add dwarf_rnglists_buffer and dwarf_rnglists_size fields. (dwarf_debug_sections): Add debug_rnglists. (dwarf_debug_section_enum): Likewise. (read_debug_rnglists): New function. (read_rangelist): New function to call either read_ranges or read_rnglists. Rename original function to... (read_ranges): ...this. (read_rnglists): New function.
2020-08-25Disable Clang's integrated assembler for two testcasesGary Benson3-1/+20
gdb.dwarf2/dw2-dir-file-name.exp fails to build using Clang because the generated assembly language contains .ascii directives with more than one string literal. gdb.dwarf2/dw2-restore.exp fails to build using Clang because it contains .func and .endfunc directives. This commit causes Clang to invoke the system assembler to assemble the relevant files. gdb/testsuite/ChangeLog: * gdb.dwarf2/dw2-dir-file-name.exp: Use system assembler when compiling with clang. * gdb.dwarf2/dw2-restore.exp: Likewise
2020-08-25Enable gdb.cp/ambiguous.exp with GCC and clangGary Benson2-2/+17
gdb.cp/ambiguous.exp failed to build using clang with the following error: gdb compile failed, /gdbtest/src/gdb/testsuite/gdb.cp/ambiguous.cc:70:36: warning: direct base 'A1' is inaccessible due to ambiguity: class JVA1 -> class KV -> class A1 class JVA1 -> class A1 [-Winaccessible-base] class JVA1 : public KV, public LV, public A1 { ^~~~~~~~~ This commit builds this testcase with -Wno-inaccessible-base when using clang, to avoid this failure. Furthermore, gdb.cp/ambiguous.exp has been disabled when using GCC since 1998. This commit enables this testcase, building with -Wno-inaccessible-base when using GCC >= 10.1, and -w otherwise. gdb/testsuite/ChangeLog: * gdb.cp/ambiguous.exp: Enable test when compiling with GCC. Add additional_flags=-Wno-inaccessible-base when compiling with GCC >= 10.1 or clang. Add additional_flags=-w when compiling with GCC < 10.
2020-08-25PR26505, ASAN: xstormy16_elf_relax_section elf32-xstormy16.c:595Alan Modra2-1/+8
PR 26505 * elf32-xstormy16.c (xstormy16_elf_relax_section): Check is_elf_hash_table before accessing elf fields.
2020-08-25PR26504, ASAN: parse_disassembler_options vax-dis.c:142Alan Modra2-2/+8
PR 26504 * vax-dis.c (parse_disassembler_options): Always add at least one to entry_addr_total_slots.
2020-08-25PR26501, ASAN: tic54x_undefined_symbol tc-tic54x.c:5015Alan Modra2-8/+9
PR26501 * gas/config/tc-tic54x.c (tic54x_undefined_symbol): Properly treat misc_symbol_hash entries without values.
2020-08-25PR26500, ASAN: tic4x_inst_make tc-tic4x.c:1247Alan Modra2-2/+7
PR 26500 * tc-tic4x.c (tic4x_inst_make): Don't die on terminating insn with name = "".
2020-08-25PR26482, ASAN: _bfd_xcoff_sizeof_headers coff-rs6000.c:2585Alan Modra2-5/+13
PR 26482 * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Ignore sections that won't be output.