aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2020-09-16bfd: verilog hex dump backend should handle 64-bit addressesAnatoly Parshintsev1-0/+5
* verilog.c (verilog_write_address): Properly handle 64-bit addresses to avoid truncation of the high part.
2020-09-16Tidy elf_symbol_fromAlan Modra3-2/+7
bfd/ * elf-bfd.h (elf_symbol_from): Remove unused ABFD parameter. * elf.c (ignore_section_sym, _bfd_elf_copy_private_symbol_data), (swap_out_syms): Adjust elf_symbol_from invocation. binutils/ * nm.c (print_symbol): Adjust elf_symbol_from invocation. * objcopy.c (is_hidden_symbol): Likewise. gas/ * config/obj-elf.c (obj_elf_visibility, elf_frob_symbol): Adjust elf_symbol_from invocation. * config/tc-aarch64.c (s_variant_pcs): Likewise. * config/tc-m68hc11.c (s_m68hc11_mark_symbol): Likewise. * config/tc-ppc.c (ppc_elf_localentry, ppc_force_relocation), (ppc_fix_adjustable): Likewise. * config/tc-xgate.c (xgate_frob_symbol): Likewise. ld/ * plugin.c (asymbol_from_plugin_symbol): Adjust elf_symbol_from invocation. opcodes/ * ppc-dis.c (ppc_symbol_is_valid): Adjust elf_symbol_from invocation.
2020-09-15Add note about creating a bugzilla tag for a point release.Nick Clifton2-0/+9
* README-how-to-make-a-release (https): Add a reminder to create a new Bugzilla tag for the point release, once it has been published.
2020-09-11x86: Add NT_X86_CET noteH.J. Lu2-0/+6
Define NT_X86_CET which is the proposed note for x86 CET state to support Intel CET in Linux kernel. Double check it after Intel CET patches have been merged into Linux kernel. binutils/ * readelf.c (get_note_type): Support NT_X86_CET. include/ * elf/common.h (NT_X86_CET): New.
2020-09-11Fix the debuglink following code to recursively load links found in the ↵Nick Clifton2-27/+60
newly loaded debug info. PR 26595 * dwarf.c (load_separate_debug_info): Return NULL rather than FALSE in error situations. (load_separate_debug_file): Move code to load debug links to ... (check_for_and_load_links): ... here. New function. Load separate debug information pointed to by debuglink and debugaltlink sections. Recursively scan newly loaded debug information for more links and load them too.
2020-09-09PR26578, memory leak in parse_gnu_debugaltlinkAlan Modra2-7/+8
The associated check function doesn't do anything with its "data" param, so nothing to adjust there. PR 26578 * dwarf.c (parse_gnu_debugaltlink): Don't alloc build_id_data. (load_separate_debug_files): Use a stack var for build_id_data.
2020-09-08Pass --disable-reloc-section on PE targets for PR 25662 testH.J. Lu2-1/+12
Pass --disable-reloc-section on PE targets for PR 25662 test since commit 514b4e191d5f46de8e142fe216e677a35fa9c4bb Author: Jeremy Drake <sourceware-bugzilla@jdrake.com> Date: Thu Aug 27 12:58:27 2020 +0100 Change the default characteristics of DLLs built by the linker to more secure settings. defaulted to --enable-reloc-section. PR ld/26587 * testsuite/binutils-all/objcopy.exp: Pass --disable-reloc-section to ld on PE targets for PR 25662 test.
2020-09-08MSP430: Support relocations for subtract expressions in .uleb128 directivesJozef Lawrynowicz2-2/+31
Link-time relaxations of branches are common for MSP430, given that GCC can generate pessimal branch instructions, and the -mcode-region=either/-mdata-region=either options to shuffle sections can further change the type of branch instruction required. These relaxations can result in invalid code when .uleb128 directives, used in the .gcc_except_table section, are used to calculate the distance between two labels. A value for the .uleb128 directive is calculated at assembly-time, and can't be updated at link-time, even if relaxation causes the distance between the labels to change. This patch adds relocations for subtract expressions in .uleb128 directives, to allow the linker to re-calculate the value of these expressions after relaxation has been performed. bfd/ChangeLog: * bfd-in2.h (bfd_reloc_code_real): Add BFD_RELOC_MSP430_{SET,SUB}_ULEB128. * elf32-msp430.c (msp430_elf_ignore_reloc): New. (elf_msp430_howto_table): Add R_MSP430{,X}_GNU_{SET,SUB}_ULEB128. (msp430_reloc_map): Add R_MSP430_GNU_{SET,SUB}_ULEB128. (msp430x_reloc_map): Add R_MSP430X_GNU_{SET,SUB}_ULEB128. (write_uleb128): New. (msp430_final_link_relocate): Handle R_MSP430{,X}_GNU_{SET,SUB}_ULEB128. * libbfd.c (_bfd_write_unsigned_leb128): New. * libbfd.h (_bfd_write_unsigned_leb128): New prototype. Add BFD_RELOC_MSP430_{SET,SUB}_ULEB128. * reloc.c: Document BFD_RELOC_MSP430_{SET,SUB}_ULEB128. binutils/ChangeLog: * readelf.c (target_specific_reloc_handling): Handle R_MSP430{,X}_GNU_{SET,SUB}_ULEB128. gas/ChangeLog: * config/tc-msp430.c (msp430_insert_uleb128_fixes): New. (msp430_md_end): Call msp430_insert_uleb128_fixes. include/ChangeLog: * elf/msp430.h (elf_msp430_reloc_type): Add R_MSP430_GNU_{SET,SUB}_ULEB128. (elf_msp430x_reloc_type): Add R_MSP430X_GNU_{SET,SUB}_ULEB128. ld/ChangeLog: * testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests. * testsuite/ld-msp430-elf/uleb128.s: New test. * testsuite/ld-msp430-elf/uleb128_430.d: New test. * testsuite/ld-msp430-elf/uleb128_430x.d: New test.
2020-09-02ubsan: objdump.c:3009 negation of -2147483648Alan Modra2-2/+6
* objdump.c (disassemble_bytes): Use an unsigned type for "addend".
2020-08-30readelf: ubsan: shift exponent 32 is too largeAlan Modra2-1/+6
When compiled on a 32-bit host, a temp var is too small for possible 64-bit values to be calculated. * readelf.c (print_gnu_build_attribute_name): Make "bytes" unsigned long long.
2020-08-28Fix a bogus error message from the DWARF LEB129 decoder when trying to read ↵Nick Clifton2-7/+27
a signed LEB128 value containing the largest possible signed negative integer value. PR 26548 * dwarf.c (read_leb128): When checking for overflow of a signed read, use a signed shift.
2020-08-28CSKY: Support attribute section.Cooper Qu3-1/+131
bfd * elf32-csky.c (csky_archs): Fix arch names. (csky_find_arch_with_name): New. (elf32_csky_merge_attributes): New. (csky_elf_merge_private_bfd_data): Add process of merge attribute section. (elf32_csky_obj_attrs_arg_type): New. (elf32_csky_obj_attrs_handle_unknown): New. (elf_backend_obj_attrs_vendor): Define. (elf_backend_obj_attrs_section): Define. (elf_backend_obj_attrs_arg_type): Define. (elf_backend_obj_attrs_section_type): Define. binutils/ * readelf.c (get_csky_section_type_name): New. (get_section_type_name): Add handler for CSKY. (display_csky_attribute): New. (process_arch_specific): Add handler for CSKY. * testsuite/binutils-all/strip-3.d: Remove .csky.attributes section. elfcpp/ * elfcpp.h (enum SHT): New enum SHT_CSKY_ATTRIBUTES. gas/ * gas/config/tc-csky.c (md_begin): Set attributes. (isa_flag): Change type to unsigned 64 bits. (struct csky_cpu_info): Likewise. (struct csky_macro_info): Likewise. (set_csky_attribute): New. * testsuite/gas/csky/802j.d: Ignore .csky.attributes section. * testsuite/gas/csky/all.d: Likewise. * testsuite/gas/csky/bsr1.d: Likewise. * testsuite/gas/csky/csky_vdsp.d: Likewise. * testsuite/gas/csky/cskyv2_all.d: Likewise. * testsuite/gas/csky/cskyv2_ck803r2.d: Likewise. * testsuite/gas/csky/cskyv2_ck860.d: Likewise. * testsuite/gas/csky/cskyv2_dsp.d: Likewise. * testsuite/gas/csky/cskyv2_elrw.d: Likewise. * testsuite/gas/csky/cskyv2_float.d: Likewise. * testsuite/gas/csky/enhance_dsp.d: Likewise. * testsuite/gas/csky/java.d: Likewise. * testsuite/gas/csky/v1_float.d: Likewise. * testsuite/gas/csky/v2_float_part1.d: Likewise. * testsuite/gas/csky/v2_float_part2.d: Likewise. * testsuite/gas/csky/v2_tls_gd.d: Likewise. * testsuite/gas/csky/v2_tls_ie.d: Likewise. * testsuite/gas/csky/v2_tls_ld.d: Likewise. * testsuite/gas/csky/v2_tls_le.d: Likewise. * testsuite/gas/elf/elf.exp: Add handler for CSKY. * testsuite/gas/elf/section2.e-csky: New. include/ * elf/csky.h (SHT_CSKY_ATTRIBUTES): Define. (Tag_CSKY_ARCH_NAME): New enum constant. (Tag_CSKY_CPU_NAME): Likewise. (Tag_CSKY_ISA_FLAGS): Likewise. (Tag_CSKY_DSP_VERSION): Likewise. (Tag_CSKY_VDSP_VERSION): Likewise. (Tag_CSKY_FPU_VERSION): Likewise. (Tag_CSKY_FPU_ABI): Likewise. (Tag_CSKY_FPU_ROUNDING): Likewise. (Tag_CSKY_FPU_DENORMAL): Likewise. (Tag_CSKY_FPU_Exception): Likewise. (Tag_CSKY_FPU_NUMBER_MODULE): Likewise. (Tag_CSKY_FPU_HARDFP): Likewise. (Tag_CSKY_MAX): Likewise. (VAL_CSKY_DSP_VERSION_EXTENSION): Likewise. (VAL_CSKY_DSP_VERSION_2): Likewise. (VAL_CSKY_VDSP_VERSION_1): Likewise. (VAL_CSKY_VDSP_VERSION_2): Likewise. (VAL_CSKY_FPU_ABI_SOFT): Likewise. (VAL_CSKY_FPU_ABI_SOFTFP): Likewise. (VAL_CSKY_FPU_ABI_HARD): Likewise. (VAL_CSKY_FPU_HARDFP_HALF): Likewise. (VAL_CSKY_FPU_HARDFP_SINGLE): Likewise. (VAL_CSKY_FPU_HARDFP_DOUBLE): Likewise. * opcode/csky.h (CSKY_ISA_VDSP_V2): Define. CSKYV1_ISA_E1: Change to long constant type. CSKYV2_ISA_E1: Likewise. CSKYV2_ISA_1E2: Likewise. CSKYV2_ISA_2E3: Likewise. CSKYV2_ISA_3E7: Likewise. CSKYV2_ISA_7E10: Likewise. CSKYV2_ISA_3E3R1: Likewise. CSKYV2_ISA_3E3R2: Likewise. CSKYV2_ISA_10E60: Likewise. CSKY_ISA_TRUST: Likewise. CSKY_ISA_CACHE: Likewise. CSKY_ISA_NVIC: Likewise. CSKY_ISA_CP: Likewise. CSKY_ISA_MP: Likewise. CSKY_ISA_MP_1E2: Likewise. CSKY_ISA_JAVA: Likewise. CSKY_ISA_MAC: Likewise. CSKY_ISA_MAC_DSP: Likewise. CSKY_ISA_DSP: Likewise. CSKY_ISA_DSP_1E2: Likewise. CSKY_ISA_DSP_ENHANCE: Likewise. CSKY_ISA_FLOAT_E1: Likewise. CSKY_ISA_FLOAT_1E2: Likewise. CSKY_ISA_FLOAT_1E3: Likewise. CSKY_ISA_FLOAT_3E4: Likewise. CSKY_ISA_VDSP: Likewise. ld/ * emulparams/cskyelf.sh: Support attribute section. * testsuite/ld-csky/tls-le-v1.d: Match .csky.attributes section. * ld/testsuite/ld-csky/tls-le.d: Likewise. * testsuite/ld-elf/non-contiguous.ld: Ignore .csky.attributes section. opcodes/ * csky-dis.c (CSKY_DEFAULT_ISA): Define. (csky_dis_info): Add member isa. (csky_find_inst_info): Skip instructions that do not belong to current CPU. (csky_get_disassembler): Get infomation from attribute section. (print_insn_csky): Set defualt ISA flag. * csky.h (CSKY_ISA_VDSP_2): Rename from CSKY_ISA_VDSP_V2. * csky-opc.h (struct csky_opcode): Change isa_flag16 and isa_flag32'type to unsigned 64 bits.
2020-08-27readelf: MSP430: Fix incorrect usage of "msp430x" in function namesJozef Lawrynowicz2-4/+13
The "X" in "MSP430X" indicates an extension to the original MSP430 ISA, but these functions are generically used for all MSP430 ISAs, so the names should not use the "X" suffix. binutils/ChangeLog: * readelf.c (get_msp430x_section_type_name): Rename to ... (get_msp430_section_type_name): ... this. (get_section_type_name): Use get_msp430_section_type_name. (display_msp430x_attribute): Rename to ... (display_msp430_attribute): ... this. (process_arch_specific): Use display_msp430_attribute.
2020-08-27Fix PR binutils/26356 on hppa*-*-hpux*.John David Anglin3-9/+21
PR 26356 * som.c (som_bfd_copy_private_section_data): Issue error when a subspace is specified without its containing space. * testsuite/binutils-all/objcopy.exp (objcopy --reverse-bytes): Add "-j $PRIVATE$" to command on hppa*-*-hpux*. * testsuite/lib/utils-lib.exp (default_binutils_run): Remove existing dollar-sign quotes before quoting. Do this prior to generating log output.
2020-08-27Corrects the broken line number incrementation in the Windows resource parserRalf Habacker2-1/+10
When the tokens MCLINE, MCENDLINE, and MCCOMMENT were created, the line number was not increased, which led to an incorrect value in the error output. PR 26088 * mclex.c (skip_until_eol): if eol was found, increment line number
2020-08-27binutils, ld: dequote libctf error messagesNick Alcock3-2/+7
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 Alcock3-30/+64
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 Alcock3-2/+7
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-26Add support to readelf for the OpenBSD segment types.Nick Clifton2-0/+9
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-26PR26412 UBSAN: objcopy.c:3026 null pointer fwriteAlan Modra2-2/+8
PR 26412 * objcopy.c (copy_object): Don't fwrite NULL contents.
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-24gcc-4 -Og false positive "may be used uninitialised"Alan Modra2-1/+6
binutils/ * readelf.c (dump_section_as_strings) Avoid false positive "may be used uninitialised". gas/ * config/tc-arm.c (move_or_literal_pool): Avoid false positive "may be used uninitialised". (opcode_lookup): Likewise.
2020-08-22elf: Keep only one '@' for undefined versioned symbolsH.J. Lu3-2/+18
The symbol string table in the .symtab section is optional and cosmetic. Keep only one '@' for undefined versioned symbols, which are defined in shared objects, in the symbol string table. Update "nm -D" to display only one '@' for undefined versioned symbols. bfd/ PR ld/26382 * elflink.c (elf_link_output_symstrtab): Keep only one '@' for versioned symbols, which are defined in shared objects, in symbol string table. binutils/ PR ld/26382 * nm.c (print_symname): Display only one '@' for undefined versioned symbols. * doc/binutils.texi: Update nm version information. ld/ PR ld/26382 * testsuite/ld-elf/pr26302.nd: Updated. * testsuite/ld-elf/pr26302.rd: New file. * testsuite/ld-elf/shared.exp: Add a test for readelf -sW.
2020-08-21Recognize DW_LANG_C11 in readelf testsuite.Mark Wielaard2-1/+6
readelf_wi_test checks the DW_AT_LANGUAGE is recognized by matching against ANSI C. But for the new DWARF5 DW_LANG_C11 readelf simply prints "C11", not prefixed with ANSI (DW_LANG_C is "non-ANSI C", DW_LANG_C89 is "ANSI C" and DW_LANG_C99 is "ANSI-C99"). Adjust the testcase instead of readelf because C11 seems a fine name. binutils/ChangeLog: * testsuite/binutils-all/readelf.exp (readelf_wi_test): Also recognize DW_LANG_C11.
2020-08-19PR26349, FAIL: binutils-all/pr25543 on hpuxAlan Modra2-31/+10
The 't' length modifier isn't in SUSv2, unsurprisingly %tx isn't recognized by older printf implementations. So even though 't' is correct for ptrdiff_t we can't use it. Also, _bfd_int64_high and _bfd_int64_low disappeared in 2008. PR 26349 * readelf.c (dump_relocations): Use BFD_VMA_FMT to print offset and info fields. (dump_section_as_strings): Don't use %tx to display offset.
2020-08-14PR26388, objdump debug dump memory leaksAlan Modra3-13/+21
num_debug_info_entries is used not just as a count but also as a flag (DEBUG_INFO_UNAVAILABLE) after some errors. That means num_debug_info_entries can't be used when cleaning up malloc'd info. PR 26388 * dwarf.c (free_debug_memory): Free alloc_num_debug_info_entries of debug_information. Correct test of max_loc_offsets and max_range_lists. * rddbg.c (read_debugging_info): Free dhandle on error.
2020-08-14Readelf demangling test typoAlan Modra2-3/+6
Using floating point data results in cris failing the test. * testsuite/binutils-all/mangled.s: Use dc.a rather than dc.d.
2020-08-13PR26348, Malloc error in write_zerosAlan Modra2-1/+15
This adds a few more sanity checks on ELF objects, and a BFD flag to disable objcopy and strip when fuzzed input files belong in the "too hard" basket. bfd/ PR 26348 * bfd.c (struct bfd): Add read_only. * elfcode.h (elf_swap_shdr_in): Test both sh_offset and sh_size. Set read_only on warning. (elf_object_p): Sanity check program header alignment. Set read_only on warning. * bfd-in2.h: Regenerate. binutils/ PR 26348 * objcopy.c (copy_object): Report file name with endian error. Error and return on abfd->read_only.
2020-08-12Two fixes in dwarf-mode.elTom Tromey2-5/+13
This fixes a couple of small problems in dwarf-mode.el. First, I noticed that for an attribute like: <2><136c>: Abbrev Number: 11 (DW_TAG_member) <136d> DW_AT_name : t ... the "t" would not be font-locked using the function name face. The problem here is that the regexp assumed the indirect string format, like: <12ac> DW_AT_name : (indirect string, offset: 0x1b40): whatever Here the fix is to adjust the regexp to match both formats. Second, when following a DIE reference, point could end up on an attribute instead. This happens when there is a zero-length attribute with the same "offset" as the following DIE, like: <12c5> DW_AT_GNU_all_call_sites: 1 <2><12c5>: Abbrev Number: 5 (DW_TAG_formal_parameter) Here the fix is to search for the DIE by looking for the depth ("<2>" in the example) as well. I've bumped the internal version number to make it simpler to install this using the Emacs package facility. binutils/ChangeLog 2020-08-12 Tom Tromey <tromey@adacore.com> * dwarf-mode.el (Version): Now 1.6. (dwarf-die-button-action): Tighten DIE reference regexp. (dwarf-font-lock-keywords): Update name regexp.
2020-08-12Add demangling support to readelf.Nick Clifton7-38/+172
PR binutils/26331 * readelf.c (do_demangle): New option flag. (print_symbol): If do_demangle is enabled, demangle the symbol. (enum long_option_values): New enum to hold long option values. (options): Add demangle, no-demangle, recursion-limit and no-recursion-limit options. Alpha sort the table. (usage): Describe the new options. (parse_args): Handle the new options. * NEWS: Mention the new feature. * doc/binutils.texi: Document the new feature. * testsuite/binutils-all/readelf.exp: Test the new feature. * testsuite/binutils-all/mangled.s: New file - assembler source. * testsuite/binutils-all/readelf.demangled: New file - expected output from readelf.
2020-08-12Updated Serbian and Russian translations for various sub-directoriesNick Clifton2-1903/+2161
2020-08-10nm: Remove --with-symbol-versionsH.J. Lu3-28/+19
Since commit 7e6e972f74aeac0ebdbd95a7f905d871cd2581de Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Mar 24 04:23:11 2020 -0700 bfd: Display symbol version for nm -D always displays symbol version for nm, remove --with-symbol-versions and silently accept it for backward compatibility. binutils/ PR binutils/26302 * nm.c (with_symbol_versions): Removed. (long_option_values): Add OPTION_WITH_SYMBOL_VERSIONS. (long_options): Update --with-symbol-versions entry. (print_symbol): Remove the with_symbol_versions check. (main): Add OPTION_WITH_SYMBOL_VERSIONS for backward compatibility. * doc/binutils.texi: Remove --with-symbol-versions. ld/ PR binutils/26302 * testsuite/ld-elf/pr26302.nd: New file. * testsuite/ld-elf/pr26302.ver: Likewise. * testsuite/ld-elf/pr26302a.c: Likewise. * testsuite/ld-elf/pr26302b.c: Likewise. * testsuite/ld-elf/shared.exp: Run binutils/26302 tests.
2020-08-05Revert "PR26337, Malloc size error in objdump"Alan Modra2-3/+9
This reverts commit 0b97e818464a42305c8243a980a5c13967554fd9.
2020-08-05PR26337, Malloc size error in objdumpAlan Modra2-4/+9
A malloc failure triggered by a fuzzed object file isn't a real problem unless objdump doesn't exit cleanly after the failure, which it does. However we have bfd_malloc_and_get_section to sanity check size of uncompressed sections before allocating memory. Use it. PR 26337 * objdump.c (load_specific_debug_section): Don't malloc space for section contents, use bfd_malloc_and_get_section.
2020-07-30Unify Solaris procfs and largefile handlingRainer Orth5-11/+63
GDB currently doesn't build on 32-bit Solaris: * On Solaris 11.4/x86: In file included from /usr/include/sys/procfs.h:26, from /vol/src/gnu/gdb/hg/master/dist/gdb/i386-sol2-nat.c:24: /usr/include/sys/old_procfs.h:31:2: error: #error "Cannot use procfs in the large file compilation environment" #error "Cannot use procfs in the large file compilation environment" ^~~~~ * On Solaris 11.3/x86 there are several more instances of this. The interaction between procfs and large-file support historically has been a royal mess on Solaris: * There are two versions of the procfs interface: ** The old ioctl-based /proc, deprecated and not used any longer in either gdb or binutils. ** The `new' (introduced in Solaris 2.6, 1997) structured /proc. * There are two headers one can possibly include: ** <procfs.h> which only provides the structured /proc, definining _STRUCTURED_PROC=1 and then including ... ** <sys/procfs.h> which defaults to _STRUCTURED_PROC=0, the ioctl-based /proc, but provides structured /proc if _STRUCTURED_PROC == 1. * procfs and the large-file environment didn't go well together: ** Until Solaris 11.3, <sys/procfs.h> would always #error in 32-bit compilations when the large-file environment was active (_FILE_OFFSET_BITS == 64). ** In both Solaris 11.4 and Illumos, this restriction was lifted for structured /proc. So one has to be careful always to define _STRUCTURED_PROC=1 when testing for or using <sys/procfs.h> on Solaris. As the errors above show, this isn't always the case in binutils-gdb right now. Also one may need to disable large-file support for 32-bit compilations on Solaris. config/largefile.m4 meant to do this by wrapping the AC_SYS_LARGEFILE autoconf macro with appropriate checks, yielding ACX_LARGEFILE. Unfortunately the macro doesn't always succeed because it neglects the _STRUCTURED_PROC part. To make things even worse, since GCC 9 g++ predefines _FILE_OFFSET_BITS=64 on Solaris. So even if largefile.m4 deciced not to enable large-file support, this has no effect, breaking the gdb build. This patch addresses all this as follows: * All tests for the <sys/procfs.h> header are made with _STRUCTURED_PROC=1, the definition going into the various config.h files instead of having to make them (and sometimes failing) in the affected sources. * To cope with the g++ predefine of _FILE_OFFSET_BITS=64, -U_FILE_OFFSET_BITS is added to various *_CPPFLAGS variables. It had been far easier to have just #undef _FILE_OFFSET_BITS in config.h, but unfortunately such a construct in config.in is commented by config.status irrespective of indentation and whitespace if large-file support is disabled. I found no way around this and putting the #undef in several global headers for bfd, binutils, ld, and gdb seemed way more invasive. * Last, the applicability check in largefile.m4 was modified only to disable largefile support if really needed. To do so, it checks if <sys/procfs.h> compiles with _FILE_OFFSET_BITS=64 defined. If it doesn't, the disabling only happens if gdb exists in-tree and isn't disabled, otherwise (building binutils from a tarball), there's no conflict. What initially confused me was the check for $plugins here, which originally caused the disabling not to take place. Since AC_PLUGINGS does enable plugin support if <dlfcn.h> exists (which it does on Solaris), the disabling never happened. I could find no explanation why the linker plugin needs large-file support but thought it would be enough if gld and GCC's lto-plugin agreed on the _FILE_OFFSET_BITS value. Unfortunately, that's not enough: lto-plugin uses the simple-object interface from libiberty, which includes off_t arguments. So to fully disable large-file support would mean also disabling it in libiberty and its users: gcc and libstdc++-v3. This seems highly undesirable, so I decided to disable the linker plugin instead if large-file support won't work. The patch allows binutils+gdb to build on i386-pc-solaris2.11 (both Solaris 11.3 and 11.4, using GCC 9.3.0 which is the worst case due to predefined _FILE_OFFSET_BITS=64). Also regtested on amd64-pc-solaris2.11 (again on Solaris 11.3 and 11.4), x86_64-pc-linux-gnu and i686-pc-linux-gnu. config: * largefile.m4 (ACX_LARGEFILE) <sparc-*-solaris*|i?86-*-solaris*>: Check for <sys/procfs.h> incompatilibity with large-file support on Solaris. Only disable large-file support and perhaps plugins if needed. Set, substitute LARGEFILE_CPPFLAGS if so. bfd: * bfd.m4 (BFD_SYS_PROCFS_H): New macro. (BFD_HAVE_SYS_PROCFS_TYPE): Require BFD_SYS_PROCFS_H. Don't define _STRUCTURED_PROC. (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Likewise. * elf.c [HAVE_SYS_PROCFS_H] (_STRUCTURED_PROC): Don't define. * configure.ac: Use BFD_SYS_PROCFS_H to check for <sys/procfs.h>. * configure, config.in: Regenerate. * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS. * Makefile.in, doc/Makefile.in: Regenerate. binutils: * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS. * Makefile.in, doc/Makefile.in: Regenerate. * configure: Regenerate. gas: * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS. * Makefile.in, doc/Makefile.in: Regenerate. * configure: Regenerate. gdb: * proc-api.c (_STRUCTURED_PROC): Don't define. * proc-events.c: Likewise. * proc-flags.c: Likewise. * proc-why.c: Likewise. * procfs.c: Likewise. * Makefile.in (INTERNAL_CPPFLAGS): Add LARGEFILE_CPPFLAGS. * configure, config.in: Regenerate. gdbserver: * configure, config.in: Regenerate. gdbsupport: * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS. * common.m4 (GDB_AC_COMMON): Use BFD_SYS_PROCFS_H to check for <sys/procfs.h>. * Makefile.in: Regenerate. * configure, config.in: Regenerate. gnulib: * configure.ac: Run ACX_LARGEFILE before gl_EARLY. * configure: Regenerate. gprof: * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS. * Makefile.in: Regenerate. * configure: Regenerate. ld: * Makefile.am (AM_CPPFLAGS): Add LARGEFILE_CPPFLAGS. * Makefile.in: Regenerate. * configure: Regenerate.
2020-07-30x86: Pass --gdwarf-3 to assemblerH.J. Lu7-6/+16
Pass --gdwarf-3 to assembler for commit 4d8ee860737005517be588f4771c358593fa421c Author: Nick Clifton <nickc@redhat.com> Date: Thu Jul 30 08:39:14 2020 +0100 Prevent the generation of DWARF level 0 line number tables... binutils/ * testsuite/binutils-all/i386/compressed-1a.d: Pass --gdwarf-3 to assembler. * testsuite/binutils-all/i386/compressed-1b.d: Likewise. * testsuite/binutils-all/i386/compressed-1c.d: Likewise. * testsuite/binutils-all/x86-64/compressed-1a.d: Likewise. * testsuite/binutils-all/x86-64/compressed-1b.d: Likewise. * testsuite/binutils-all/x86-64/compressed-1c.d: Likewise. gas/ * testsuite/gas/elf/dwarf2-3.d:Pass --gdwarf-3 to assembler. * testsuite/gas/elf/dwarf2-5.d: Likewise. * testsuite/gas/i386/dw2-compress-3a.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3a.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise.
2020-07-29MIPS: Make the IRIX naming of local section symbols consistentMaciej W. Rozycki11-0/+127
Make the MIPS/IRIX naming of local section symbols consistent between files produced by generic ELF code and ELF linker code, complementing commit 174fd7f95561 ("New bfd elf hook: force naming of local section symbols"), <https://sourceware.org/ml/binutils/2004-02/msg00072.html>. Local section symbols have no names in the standard ELF gABI, however the lack of a name causes problems with IRIX's MIPSpro linker. To work around the issue we give them names, however we do that in generic ELF code only, based on what the `elf_backend_name_local_section_symbols' hook returns if present. That makes objects created by GAS or `objdump' work correctly, however not ones created by `ld -r'. That would not normally cause issues with IRIX systems using GAS and `objdump' only with the MIPSpro linker, however if GNU LD was used for whatever reason in producing objects later fed to IRIX's MIPSpro linker, then things would break. Modify ELF linker code accordingly then, using the same hook. Adjust the `ld-elf/64ksec-r' test accordingly so that it also accepts a section symbol with a name. Also modify the hook itself so that only actual ET_REL objects have names assigned to local section symbols. Other kinds of ELF files are not ever supposed to be relocated with the MIPSpro linker, so we can afford producing more standard output. Add suitable GAS, LD and `objcopy' test cases to the relevant testsuites to keep these tools consistently verified. This change also fixes: FAIL: objcopy executable (pr25662) across MIPS targets using the IRIX compatibility mode. bfd/ * elflink.c (bfd_elf_final_link): Give local symbols a name if so requested. * elfxx-mips.c (_bfd_mips_elf_name_local_section_symbols): Only return TRUE if making ET_REL output. binutils/ * testsuite/binutils-all/mips/global-local-symtab-sort-o32.d: New test. * testsuite/binutils-all/mips/global-local-symtab-sort-o32t.d: New test. * testsuite/binutils-all/mips/global-local-symtab-sort-n32.d: New test. * testsuite/binutils-all/mips/global-local-symtab-sort-n32t.d: New test. * testsuite/binutils-all/mips/global-local-symtab-sort-n64.d: New test. * testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d: New test. * testsuite/binutils-all/mips/global-local-symtab-final-o32.d: New test. * testsuite/binutils-all/mips/global-local-symtab-final-n32.d: New test. * testsuite/binutils-all/mips/global-local-symtab-final-n64.d: New test. * testsuite/binutils-all/mips/mips.exp: Run the new tests. gas/ * testsuite/gas/mips/global-local-symtab-sort-o32.d: New test. * testsuite/gas/mips/global-local-symtab-sort-o32t.d: New test. * testsuite/gas/mips/global-local-symtab-sort-n32.d: New test. * testsuite/gas/mips/global-local-symtab-sort-n32t.d: New test. * testsuite/gas/mips/global-local-symtab-sort-n64.d: New test. * testsuite/gas/mips/global-local-symtab-sort-n64t.d: New test. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-elf/sec64k.exp: Also accept a section symbol with a name. * testsuite/ld-mips-elf/global-local-symtab-sort-o32.d: New test. * testsuite/ld-mips-elf/global-local-symtab-sort-o32t.d: New test. * testsuite/ld-mips-elf/global-local-symtab-sort-n32.d: New test. * testsuite/ld-mips-elf/global-local-symtab-sort-n32t.d: New test. * testsuite/ld-mips-elf/global-local-symtab-sort-n64.d: New test. * testsuite/ld-mips-elf/global-local-symtab-sort-n64t.d: New test. * testsuite/ld-mips-elf/global-local-symtab-final-o32.d: New test. * testsuite/ld-mips-elf/global-local-symtab-final-n32.d: New test. * testsuite/ld-mips-elf/global-local-symtab-final-n64.d: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2020-07-29MIPS/LD: Set symtab's `sh_info' correctly for IRIX emulationsMaciej W. Rozycki7-0/+65
Correct ELF linker code so as to set the `sh_info' value of the static symbol table section according to the section symbols vs other symbols split where required by the selection of the IRIX compatibility mode for MIPS target. Add a `elf_backend_elfsym_local_is_section' hook for that purpose, returning TRUE if it is only STB_LOCAL/STT_SECTION symbols that are to be considered local for the purpose of this split rather than all STB_LOCAL symbols. We do it already in generic ELF code, and have done it since 1993, with the `elf_backend_sym_is_global' hook, affecting GAS and `objcopy', so these tools produce correct ELF output in the IRIX compatibility mode, however if such output is fed as input to `ld -r', then the linker's output is no longer valid for that mode. The relevant changes to generic ELF code are: commit 062189c6eab72c7ba1bab1cf30fdb27d67a7d668 Author: Ian Lance Taylor <ian@airs.com> Date: Thu Nov 18 17:12:47 1993 +0000 and: commit 6e07e54f1b347f885cc6c021c3fd912c79bdaf55 Author: Ian Lance Taylor <ian@airs.com> Date: Thu Jan 6 20:01:42 1994 +0000 (split across two GIT commits likely due to repository conversion peculiarities). The `elf_backend_sym_is_global' hook however operates on BFD rather than ELF symbols, making it unsuitable for the ELF linker as the linker does not convert any symbol tables processed into the BFD format. Converting the hook to operate on ELF symbols would in principle be possible, but it would still require a considerable rewrite of `bfd_elf_final_link' to adapt to the interface. Therefore, especially given that no new use for the IRIX compatibility mode is expected, minimize changes made to the ELF linker code and just add an entirely new hook, and wire it in the o32 and n32 MIPS backends accordingly; the n64 backend never uses the IRIX compatibility mode. Since we have no coverage here at all add suitable GAS, LD and `objcopy' test cases to the relevant testsuites to keep these tools consistently verified. bfd/ * elf-bfd.h (elf_backend_data): Add `elf_backend_elfsym_local_is_section' member. * elfxx-target.h (elf_backend_elfsym_local_is_section): New macro. (elfNN_bed): Add `elf_backend_elfsym_local_is_section' member. * elflink.c (bfd_elf_final_link): Use it to determine whether set the `.symtab' section's `sh_info' value to the index of the first non-local or non-section symbol. * elf32-mips.c (mips_elf32_elfsym_local_is_section): New function. (elf_backend_elfsym_local_is_section): New macro. * elfn32-mips.c (mips_elf_n32_elfsym_local_is_section): New function. (elf_backend_elfsym_local_is_section): New macro. binutils/ * testsuite/binutils-all/mips/global-local-symtab-o32.d: New test. * testsuite/binutils-all/mips/global-local-symtab-o32t.d: New test. * testsuite/binutils-all/mips/global-local-symtab-n32.d: New test. * testsuite/binutils-all/mips/global-local-symtab-n32t.d: New test. * testsuite/binutils-all/mips/global-local-symtab-n64.d: New test. * testsuite/binutils-all/mips/mips.exp: Run the new tests. gas/ * testsuite/gas/mips/global-local-symtab-o32.d: New test. * testsuite/gas/mips/global-local-symtab-o32t.d: New test. * testsuite/gas/mips/global-local-symtab-n32.d: New test. * testsuite/gas/mips/global-local-symtab-n32t.d: New test. * testsuite/gas/mips/global-local-symtab-n64.d: New test. * testsuite/gas/mips/global-local-symtab.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-mips-elf/global-local-symtab-o32.d: New test. * testsuite/ld-mips-elf/global-local-symtab-o32t.d: New test. * testsuite/ld-mips-elf/global-local-symtab-n32.d: New test. * testsuite/ld-mips-elf/global-local-symtab-n32t.d: New test. * testsuite/ld-mips-elf/global-local-symtab-n64.d: New test. * testsuite/ld-mips-elf/global-local-symtab.ld: New test linker script. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2020-07-28PKG_CHECK_MODULES: Properly check if $pkg_cv_[]$1[]_LIBS worksH.J. Lu2-6/+13
There is no need to check $pkg_cv_[]$1[]_LIBS works if package check failed. config/ PR binutils/26301 * pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if $pkg_failed = no. binutils/ PR binutils/26301 * configure: Regenerated. gdb/ PR binutils/26301 * configure: Regenerated.
2020-07-28PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS worksH.J. Lu2-0/+27
It is quite normal to have headers without library on multilib OSes. Add AC_TRY_LINK to PKG_CHECK_MODULES to check if $pkg_cv_[]$1[]_LIBS works. config/ PR binutils/26301 * pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if $pkg_cv_[]$1[]_LIBS works. binutils/ PR binutils/26301 * configure: Regenerated. gdb/ PR binutils/26301 * configure: Regenerated.
2020-07-27Prevent strange "section mentioned in a -j option but not found"Alan Modra2-2/+7
"objdump -s -j .bss" results in a message that indicates objdump couldn't find a .bss section when present. Fix that. * objdump.c (dump_section): Don't return without calling process_section_p.
2020-07-27doc: Replace preceeded with precededH.J. Lu2-4/+8
binutils/ * doc/binutils.texi: Replace preceeded with preceded. gas/ * doc/as.texi: Replace preceeded with preceded.
2020-07-26MIPS/binutils/testsuite: Correct mips.exp test ABI/emul/endian arrangementMaciej W. Rozycki23-53/+258
The binutils testsuite supports involving LD in processing test cases and with the MIPS target that has the same issues the LD testsuite does. So to support LD in the MIPS part of the binutils testsuite similarly to commit 86b24e15c45b ("MIPS/LD/testsuite: Correct comm-data.exp test ABI/emul/endian arrangement") update the mips.exp test script to: - correctly select emulations for targets using non-traditional MIPS emulations, - correctly select ABIs for targets that do not support all of them, - use the default endianness selection where possible to benefit targets that support only one, - simplify test invocation by providing ABI-specific `run_dump_test' wrappers, specifically `run_dump_test_o32', `run_dump_test_n32' and `run_dump_test_n64', which remove the need to use conditionals across the Expect script or to repeat ABI-specific GAS and LD flags with each invocation, borrowing changes from commit 78da84f99405 ("MIPS/LD/testsuite: Correct mips-elf.exp test ABI/emul/endian arrangement"). As a side effect this disables o32 ABI testing for targets that are not supposed to support them and do not with LD, but still have such support with BFD and GAS due to our inflexibility in configuration. Ultimately we ought to support having o32 completely disabled. binutils/ * testsuite/binutils-all/mips/mips.exp (run_dump_test_abi) (run_dump_test_o32, run_dump_test_n32, run_dump_test_n64): New procedures. (has_newabi): Remove variable. (has_abi, abi_asflags, abi_ldflags): New associative array variables. (irixemul): New variable. Replace `run_dump_test' calls where applicable throughout with `run_dump_test_o32', `run_dump_test_n32' and `run_dump_test_n64' as appropriate. Use `noarch' for tests that require their own architecture setting. * testsuite/binutils-all/mips/mips-ase-1.d: Remove GAS flags. * testsuite/binutils-all/mips/mips-ase-2.d: Likewise. * testsuite/binutils-all/mips/mips-ase-3.d: Likewise. * testsuite/binutils-all/mips/mips-note-2-n32.d: Likewise. * testsuite/binutils-all/mips/mips-note-2-n64.d: Likewise. * testsuite/binutils-all/mips/mips-note-2.d: Likewise. * testsuite/binutils-all/mips/mips-note-2r-n32.d: Likewise. * testsuite/binutils-all/mips/mips-note-2r-n64.d: Likewise. * testsuite/binutils-all/mips/mips-note-2r.d: Likewise. * testsuite/binutils-all/mips/mips-reginfo-n32.d: Likewise. * testsuite/binutils-all/mips/mips-reginfo.d: Likewise. * testsuite/binutils-all/mips/mips16-extend-noinsn.d: Likewise. * testsuite/binutils-all/mips/mips16-pcrel.d: Likewise. * testsuite/binutils-all/mips/mips16-alias.d: Remove `-32' from GAS flags. * testsuite/binutils-all/mips/mips16-extend-insn.d: Likewise. * testsuite/binutils-all/mips/mips16-noalias.d: Likewise. * testsuite/binutils-all/mips/mips16-undecoded.d: Likewise. * testsuite/binutils-all/mips/mips16e2-extend-insn.d: Likewise. * testsuite/binutils-all/mips/mips16e2-undecoded.d: Likewise. * testsuite/binutils-all/mips/mixed-micromips.d: Likewise. * testsuite/binutils-all/mips/mixed-mips16.d: Likewise.
2020-07-24config/debuginfod.m4: Use PKG_CHECK_MODULESAaron Merey5-114/+288
Use PKG_CHECK_MODULES to set debuginfod autoconf vars. Also add pkg.m4 to config/. ChangeLog: * config/debuginfod.m4: use PKG_CHECK_MODULES. * config/pkg.m4: New file. * configure: Rebuild. * configure.ac: Remove AC_DEBUGINFOD. ChangeLog/binutils: * Makefile.am: Replace LIBDEBUGINFOD with DEBUGINFOD_LIBS. * Makefile.in: Rebuild. * configure: Rebuild. * doc/Makefile.in: Rebuild. ChangeLog/gdb: * Makefile.in: Replace LIBDEBUGINFOD with DEBUGINFOD_LIBS. * configure: Rebuild.
2020-07-24Update documentation on how to make a releaseNick Clifton2-10/+34
2020-07-22binutils, testsuite: allow compilation before doing run_dump_testNick Alcock2-5/+58
The CTF assembler emitted by GCC has architecture-dependent pseudos in it, and is (obviously) tightly tied to a particular set of C source files with specific types in them. The CTF tests do run_dump_test on some candidate input, link it using the run_dump_test ld machinery, and compare objdump --ctf output. To avoid skew, we'd like to be able to easily regenerate the .s being scanned so that the .c doesn't get out of sync with it, but since GCC emits arch-dependent pseudos, we are forced to hand-hack the output every time (quite severely on some arches, like x86-32 and -64, where every single pseudo used is not only arch-dependent but undocumented). To avoid this, teach run_dump_test how to optionally compile things given new, optional additional flags passed in in the cc option. Only sources with the .c suffix are compiled, so there is no effect on any existing tests. The .s files go into the tmpdir, from which existing run_dump_test code picks them up as usual. binutils/ * testsuite/lib/binutils-common.exp (run_dump_test): Add 'cc' option.
2020-07-22binutils: objdump: ctf: drop incorrect linefeedsNick Alcock2-4/+9
The CTF objdumping code is adding linefeeds in calls to non_fatal, which is wrong and looks ugly. binutils/ * objdump.c (dump_ctf_archive_member): Remove linefeeds. (dump_ctf): Likewise.
2020-07-22libctf, ld, binutils: add textual error/warning reporting for libctfNick Alcock3-2/+43
This commit adds a long-missing piece of infrastructure to libctf: the ability to report errors and warnings using all the power of printf, rather than being restricted to one errno value. Internally, libctf calls ctf_err_warn() to add errors and warnings to a list: a new iterator ctf_errwarning_next() then consumes this list one by one and hands it to the caller, which can free it. New errors and warnings are added until the list is consumed by the caller or the ctf_file_t is closed, so you can dump them at intervals. The caller can of course choose to print only those warnings it wants. (I am not sure whether we want objdump, readelf or ld to print warnings or not: right now I'm printing them, but maybe we only want to print errors? This entirely depends on whether warnings are voluminous things describing e.g. the inability to emit single types because of name clashes or something. There are no users of this infrastructure yet, so it's hard to say.) There is no internationalization here yet, but this at least adds a place where internationalization can be added, to one of ctf_errwarning_next or ctf_err_warn. We also provide a new ctf_assert() function which uses this infrastructure to provide non-fatal assertion failures while emitting an assert-like string to the caller: to save space and avoid needlessly duplicating unchanging strings, the assertion test is inlined but the print-things-out failure case is not. All assertions in libctf will be converted to use this machinery in future commits and propagate assertion-failure errors up, so that the linker in particular cannot be killed by libctf assertion failures when it could perfectly well just print warnings and drop the CTF section. include/ * ctf-api.h (ECTF_INTERNAL): Adjust error text. (ctf_errwarning_next): New. libctf/ * ctf-impl.h (ctf_assert): New. (ctf_err_warning_t): Likewise. (ctf_file_t) <ctf_errs_warnings>: Likewise. (ctf_err_warn): New prototype. (ctf_assert_fail_internal): Likewise. * ctf-inlines.h (ctf_assert_internal): Likewise. * ctf-open.c (ctf_file_close): Free ctf_errs_warnings. * ctf-create.c (ctf_serialize): Copy it on serialization. * ctf-subr.c (ctf_err_warn): New, add an error/warning. (ctf_errwarning_next): New iterator, free and pass back errors/warnings in succession. * libctf.ver (ctf_errwarning_next): Add. ld/ * ldlang.c (lang_ctf_errs_warnings): New, print CTF errors and warnings. Assert when libctf asserts. (lang_merge_ctf): Call it. (land_write_ctf): Likewise. binutils/ * objdump.c (ctf_archive_member): Print CTF errors and warnings. * readelf.c (dump_ctf_archive_member): Likewise.
2020-07-22Fix problems in CTF handling code exposed by the Coverity static analysis tool.Nick Clifton2-1/+11
readelf * readelf.c (parse_args): Silence potential warnings about a memory resource leak when allocating space for ctf option values. (dump_section_as_ctf): Fix typo checking dump_ctf_strtab_name variable. libctf * ctf-archive.c (ctf_arc_write): Avoid calling close twice on the same file descriptor.
2020-07-21Updated Swedish translation for the binutils sub-directoryNick Clifton2-1899/+2075