summaryrefslogtreecommitdiff
path: root/binutils
Commit message (Collapse)AuthorAgeFilesLines
* Set version to 2.34, turn off development, add changelog entriesbinutils-2_34Nick Clifton2020-02-013-112/+116
|
* Updated translations for some of the binutils sub-directoriesNick Clifton2020-01-312-1827/+2171
|
* Fix objcopy --merge-notes dependency on qsort implementation behavior.users/roland/2.34/objcopy-merge-notes-qsortRoland McGrath2020-01-272-16/+23
| | | | | | | | binutils/ * objcopy.c (compare_gnu_build_notes): Fix comparison results for overlapping ranges so that (A == B) == (B == A) holds. (cherry picked from commit 82ef9cad78b74ee9176e059e8c8dec1bdb4a1efe)
* More updated translationNick Clifton2020-01-232-1831/+2227
|
* Updated translations for various binutils sub-directoriesNick Clifton2020-01-203-3678/+4469
|
* Set BFD_VERSION to 2.33.90. Regenerate configure and pot files.Nick Clifton2020-01-183-1061/+1092
|
* Add markers for 2.34 branch to the NEWS files and ChangeLogs.Nick Clifton2020-01-184-6/+13
|
* Improve the performance of the ascii art jump visualizer.Thomas Troeger2020-01-172-27/+46
| | | | | | | * objdump.c (jump_info_visualize_address): Discard jumps that are no longer needed. (disassemble_bytes): Only compute the maximum level if jumps were detected.
* Moev declaration of loop variable outside of the loop.Nick Clifton2020-01-132-1/+3
| | | | * objdump.c (disassemble_bytes): Remove C99-ism.
* Add test driver for the debuginfod support in the binutils sub-directory.Nick Clifton2020-01-132-0/+193
| | | | * testsuite/binutils-all/debuginfod.exp: New tests.
* Add an option to objdump's disassembler to generate ascii art diagrams ↵Thomas Troeger2020-01-134-5/+764
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | showing the destinations of flow control instructions. binutils* objdump.c (visualize_jumps, color_output, extended_color_output) (detected_jumps): New variables. (usage): Add the new jump visualization options. (option_values): Add new option value. (long_options): Add the new option. (jump_info_new, jump_info_free): New functions. (jump_info_min_address, jump_info_max_address): Likewise. (jump_info_end_address, jump_info_is_start_address): Likewise. (jump_info_is_end_address, jump_info_size): Likewise. (jump_info_unlink, jump_info_insert): Likewise. (jump_info_add_front, jump_info_move_linked): Likewise. (jump_info_intersect, jump_info_merge): Likewise. (jump_info_sort, jump_info_visualize_address): Likewise. (disassemble_jumps): New function - used to locate jumps. (disassemble_bytes): Add ascii art generation. (disassemble_section): Add scan to locate jumps. (main): Parse the new visualization option. * doc/binutils.texi: Document the new feature. * NEWS: Mention the new feature. opcodes * arm-dis.c (print_insn_arm): Fill in insn info fields for control flow instructions. (print_insn_thumb16, print_insn_thumb32): Likewise. (print_insn): Initialize the insn info. * i386-dis.c (print_insn): Initialize the insn info fields, and detect jumps.
* Re: PR23560, PR23561, readelf memory leaksAlan Modra2020-01-131-2/+2
| | | | | | | | PR 25360 PR 25361 Dyslexia strikes again. Fix git commit a788aedd86da983faf0afef3cb41461118a2e9f2 ChangeLog.
* PR23560, PR23561, readelf memory leaksAlan Modra2020-01-133-12/+44
| | | | | | | | | | | | PR 23560 PR 23561 * dwarf.c (display_debug_frames): Move fde_fc earlier. Free fde_fc col_type and col_offset. * readelf.c (apply_relocations): Move symsec check earlier. (free_debug_section): Free reloc_info. (process_notes_at): Free pnotes on error path. (process_object): Free dump_sects here.. (process_archive): ..not here.
* PR25362, memory leak in nmAlan Modra2020-01-132-0/+7
| | | | | PR 25362 * nm.c (display_rel_file): Free dyn_syms.
* Fix an attempt to free a static pointer when using objcopy's symbol addition ↵Nick Clifton2020-01-092-5/+18
| | | | | | | | | | feature. PR 25220 * objcopy.c (empty_name): New variable. (need_sym_before): Prevent an attempt to free a static variable. (filter_symbols): Avoid strcmp test by checking for pointer equality.
* Update Traditional Chinese translation for the binutils sub-directory.Nick Clifton2020-01-092-335/+34
| | | | * po/zh_TW.po: Updated Traditional Chinese translation.
* Add support for debuginfod to the binutils (disable by default, enabled via ↵Aaron Merey2020-01-0913-59/+468
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a configure time option). debuginfod is a lightweight web service that indexes ELF/DWARF debugging resources by build-id and serves them over HTTP. This patch enables objdump and readelf to query debuginfod servers when they are otherwise not able to find separate debug files. Binutils can be built with debuginfod using the --with-debuginfod configure option. This requires that libdebuginfod be installed and found at configure time. debuginfod is packaged with elfutils, starting with version 0.178. For more information see https://sourceware.org/elfutils/. toplevel* config/debuginfod.m4: New file. Add macro AC_DEBUGINFOD. Adds new configure option --with-debuginfod. * configure: Regenerate. * configure.ac: Call AC_DEBUGINFOD. binutils* Makefile.am (readelf_LDADD, objdump_LDADD): Add libdebuginfod. * Makefile.in: Regenerate. * NEWS: Update. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Call AC_DEBUGINFOD. * doc/Makefile.in: Regenerate. * doc/binutils.texi: Add section on using binutils with debuginfod. * dwarf.c (debuginfod_fetch_separate_debug_info): New function. Query debuginfod servers for the target debug file. (load_separate_debug_info): Call debuginfod_fetch_separate_debug_info if configured with debuginfod. (load_separate_debug_files): Add file argument to load_separate_debug_info calls. * dwarf.h (get_build_id): Add declaration. * objdump.c (get_build_id): New function. Get build-id of file. * readelf.c (get_build_id): Likewise. * testsuite/binutils-all/debuginfod.exp: New tests. * testsuite/binutils-all/linkdebug.s: Add .note.gnu.build-id section.
* Mach-O: misc build adjustmentsJan Beulich2020-01-031-1/+1
| | | | | | Oldish gcc warns about local variables shadowing outer scope ones. Additionally %lx is not (always) suitable to print the result of bfd_get_32().
* Add support for the GBZ80, Z180, and eZ80 variants of the Z80 architecure. ↵Sergey Belyashov2020-01-023-1785/+2110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an ELF based target for these as well. PR 25224 bfd * Makefile.am: Add z80-elf target support. * configure.ac: Likewise. * targets.c: Likewise. * config.bfd: Add z80-elf target support and new arches: ez80 and z180. * elf32-z80.c: New file. * archures.c: Add new z80 architectures: eZ80 and Z180. * coffcode.h: Likewise. * cpu-z80.c: Likewise. * bfd-in2.h: Likewise plus additional Z80 relocations. * coff-z80.c: Add new relocations for Z80 target and local label check. gas * config/tc-z80.c: Add new architectures: Z180 and eZ80. Add support for assembler code generated by SDCC. Add new relocation types. Add z80-elf target support. * config/tc-z80.h: Add z80-elf target support. Enable dollar local labels. Local labels starts from ".L". * testsuite/gas/all/fwdexp.d: Fix failure due to symbol conflict. * testsuite/gas/all/fwdexp.s: Likewise. * testsuite/gas/z80/suffix.d: Fix failure on ELF target. * testsuite/gas/z80/z80.exp: Add new tests * testsuite/gas/z80/dollar.d: New file. * testsuite/gas/z80/dollar.s: New file. * testsuite/gas/z80/ez80_adl_all.d: New file. * testsuite/gas/z80/ez80_adl_all.s: New file. * testsuite/gas/z80/ez80_adl_suf.d: New file. * testsuite/gas/z80/ez80_isuf.s: New file. * testsuite/gas/z80/ez80_z80_all.d: New file. * testsuite/gas/z80/ez80_z80_all.s: New file. * testsuite/gas/z80/ez80_z80_suf.d: New file. * testsuite/gas/z80/r800_extra.d: New file. * testsuite/gas/z80/r800_extra.s: New file. * testsuite/gas/z80/r800_ii8.d: New file. * testsuite/gas/z80/r800_z80_doc.d: New file. * testsuite/gas/z80/z180.d: New file. * testsuite/gas/z80/z180.s: New file. * testsuite/gas/z80/z180_z80_doc.d: New file. * testsuite/gas/z80/z80_doc.d: New file. * testsuite/gas/z80/z80_doc.s: New file. * testsuite/gas/z80/z80_ii8.d: New file. * testsuite/gas/z80/z80_ii8.s: New file. * testsuite/gas/z80/z80_in_f_c.d: New file. * testsuite/gas/z80/z80_in_f_c.s: New file. * testsuite/gas/z80/z80_op_ii_ld.d: New file. * testsuite/gas/z80/z80_op_ii_ld.s: New file. * testsuite/gas/z80/z80_out_c_0.d: New file. * testsuite/gas/z80/z80_out_c_0.s: New file. * testsuite/gas/z80/z80_reloc.d: New file. * testsuite/gas/z80/z80_reloc.s: New file. * testsuite/gas/z80/z80_sli.d: New file. * testsuite/gas/z80/z80_sli.s: New file. ld * Makefile.am: Add new target z80-elf * configure.tgt: Likewise. * emultempl/z80.em: Add support for eZ80 and Z180 architectures. * emulparams/elf32z80.sh: New file. * emultempl/z80elf.em: Likewise. * testsuite/ld-z80/arch_ez80_adl.d: Likewise. * testsuite/ld-z80/arch_ez80_z80.d: Likewise. * testsuite/ld-z80/arch_r800.d: Likewise. * testsuite/ld-z80/arch_z180.d: Likewise. * testsuite/ld-z80/arch_z80.d: Likewise. * testsuite/ld-z80/comb_arch_ez80_z80.d: Likewise. * testsuite/ld-z80/comb_arch_z180.d: Likewise. * testsuite/ld-z80/labels.s: Likewise. * testsuite/ld-z80/relocs.s: Likewise. * testsuite/ld-z80/relocs_b_ez80.d: Likewise. * testsuite/ld-z80/relocs_b_z80.d: Likewise. * testsuite/ld-z80/relocs_f_z80.d: Likewise. * testsuite/ld-z80/z80.exp: Likewise. opcodes * z80-dis.c: Add support for eZ80 and Z80 instructions.
* Re: Update year range in copyright notice of binutils filesAlan Modra2020-01-011-0/+4
| | | | Add the ChangeLog entry.
* Update year range in copyright notice of binutils filesAlan Modra2020-01-01140-141/+141
|
* ChangeLog rotationAlan Modra2020-01-012-1513/+1527
|
* Re: Revise sleb128 and uleb128 readerAlan Modra2019-12-302-21/+28
| | | | | | | | A missing part of git commit cd30bcef4a685. * od-macho.c: Include elfcomm.h. (dump_dyld_info_rebase, dump_dyld_info_bind): Fix read_leb128 args. (dump_dyld_info_export_1, dump_segment_split_info): Likewise.
* Fix build 32-bit-host build error last for last binutils/dwarf2.c change.Hans-Peter Nilsson2019-12-232-1/+6
| | | | | * dwarf.c (display_debug_lines_decoded): Cast printf parameter to format type to correct last change.
* Revise sleb128 and uleb128 readerAlan Modra2019-12-234-1065/+833
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch catches and reports errors when reading leb128 values, addressing a FIXME in read_leb128. * dwarf.h (read_leb128): Update prototype. (report_leb_status): New inline function. (SKIP_ULEB, SKIP_SLEB, READ_ULEB, READ_SLEB): Define. * dwarf.c: Use above macros throughout file. Formatting. (read_leb128): Reorder params. Add status return param. Don't stop reading until finding terminator or end of data. Detect loss of significant bits. Sign extend only on terminating byte. (read_sleb128, read_uleb128): Delete functions. (SKIP_ULEB, SKIP_SLEB, READ_ULEB, READ_SLEB): Delete macros. (read_and_print_leb128): Rewrite. (process_extended_line_op): Return a size_t. Use size_t vars. Adjust to suit new macros. Add proper name size to "data" when processing DW_LNE_define_file. (process_abbrev_section): Adjust to suit new macros. (decode_location_expression, skip_attr_bytes): Likewise. (get_type_signedness): Likewise. (read_and_display_attr_value): Likewise. Consolidate block code. (process_debug_info): Adjust to suit new macros. (display_formatted_table, display_debug_lines_raw): Likewise. (display_debug_lines_decoded): Likewise. Properly check for end of DW_LNS_extended_op. (display_debug_macinfo): Adjust to suit new macros. (get_line_filename_and_dirname, display_debug_macro): Likewise. (display_view_pair_list): Likewise. Don't back off when hitting end of data. (display_loc_list): Adjust to suit new macros. (display_loclists_list, display_loc_list_dwo): Likewise. (display_debug_rnglists_list, read_cie): Likewise. (display_debug_frames): Likewise. * readelf.c: Use new ULEB macros throughout file. (read_uleb128): Delete. (decode_arm_unwind_bytecode): Use read_leb128. (decode_tic6x_unwind_bytecode): Likewise. (display_tag_value): Adjust to suit new macros. (display_arc_attribute, display_arm_attribute): Likewise. (display_gnu_attribute, display_power_gnu_attribute): Likewise. (display_s390_gnu_attribute, display_sparc_gnu_attribute): Likewise. (display_mips_gnu_attribute, display_tic6x_attribute): Likewise. (display_msp430x_attribute, display_msp430_gnu_attribute): Likewise. (display_riscv_attribute, process_attributes): Likewise.
* Prefer object over notype symbols when disassemblingAlan Modra2019-12-172-16/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing objdump disassembly output like this always requires some testsuite changes, with the avr and x64_64 changes simply due to picking up better symbols, the whole point of the patch. The mips changes are due to mips-sgi-irix changing STT_NOTYPE symbols to STT_OBJECT, which objdump now chooses in preference to script symbols. The problem is that objdump looks at the first symbol in the section being disassembled, and if object type, just dumps out bytes rather than disassembling. This results in new failures: FAIL: JAL overflow 2 FAIL: undefined weak symbol overflow FAIL: undefined weak symbol overflow (n32) FAIL: undefined weak symbol overflow (n64) So for mips-sgi-irix function symbols really do need to be function type. I fixed a few more than just the required minimum to avoid the above test fails. binutils/ * objdump.c (compare_section): New static var. (compare_symbols): Sort by current section only. Don't access symbol name out of bounds when checking for file symbols. Sort section symbols and object symbols. (find_symbol_for_address): Remove bogus debugging and section symbol test. (disassemble_data): Move symbol sort from here.. (disassemble_section): ..to here. Set compare_section. ld/ * testsuite/ld-avr/lds-mega.d: Adjust symbols to suit objdump change. * testsuite/ld-avr/lds-tiny.d: Likewise. * testsuite/ld-x86-64/load2.d: Likewise. * testsuite/ld-mips-elf/compact-eh1.s: Give function symbols function type. * testsuite/ld-mips-elf/compact-eh1a.s: Likewise. * testsuite/ld-mips-elf/compact-eh1b.s: Likewise. * testsuite/ld-mips-elf/compact-eh2.s: Likewise. * testsuite/ld-mips-elf/compact-eh3.s: Likewise. * testsuite/ld-mips-elf/compact-eh3a.s: Likewise. * testsuite/ld-mips-elf/eh-frame5.s: Likewise. * testsuite/ld-mips-elf/ehdr_start-new.s: Likewise. * testsuite/ld-mips-elf/ehdr_start-o32.s: Likewise. * testsuite/ld-mips-elf/emit-relocs-1a.s: Likewise. * testsuite/ld-mips-elf/jaloverflow-2.s: Likewise. * testsuite/ld-mips-elf/jaloverflow.s: Likewise. * testsuite/ld-mips-elf/mips16-call-global-1.s: Likewise. * testsuite/ld-mips-elf/mips16-intermix-1.s: Likewise. * testsuite/ld-mips-elf/mips16-pic-1b.s: Likewise. * testsuite/ld-mips-elf/mips16-pic-4c.s: Likewise. * testsuite/ld-mips-elf/no-shared-1-n64.s: Likewise. * testsuite/ld-mips-elf/no-shared-1-o32.s: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-1b.s: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-2a.s: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-3b.s: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-4b.s: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-5a.s: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-6-n32c.s: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-6-n64c.s: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-6-o32c.s: Likewise. * testsuite/ld-mips-elf/pie.s: Likewise. * testsuite/ld-mips-elf/relax-jalr.s: Likewise. * testsuite/ld-mips-elf/reloc-1a.s: Likewise. * testsuite/ld-mips-elf/reloc-2a.s: Likewise. * testsuite/ld-mips-elf/reloc-4.s: Likewise. * testsuite/ld-mips-elf/reloc-5.s: Likewise. * testsuite/ld-mips-elf/reloc-6b.s: Likewise. * testsuite/ld-mips-elf/textrel-1.s: Likewise. * testsuite/ld-mips-elf/undefweak-overflow.s: Likewise. * testsuite/ld-mips-elf/undefweak-overflow.d: Adjust.
* Remove tic80 supportAlan Modra2019-12-173-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is one way of fixing ubsan bug reports, just delete the code. The assembler support was removed back in 2005 along with other non-BFD assemblers, but somehow the remainder of the port stayed in. bfd/ * coff-tic80.c: Delete file. * cpu-tic80.c: Delete file. * archures.c: Remove tic80 support. * coffcode.h: Likewise. * coffswap.h: Likewise. * targets.c: Likewise. * config.bfd: Likewise. * configure.ac: Likewise. * Makefile.am: Likewise. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * configure: Regenerate. * po/SRC-POTFILES.in: Regenerate. binutils/ * testsuite/binutils-all/objcopy.exp: Remove tic80 support. * testsuite/binutils-all/objdump.exp: Likewise. gas/ * doc/as.texi: Remove mention of tic80. include/ * coff/tic80.h: Delete file. * opcode/tic80.h: Delete file. ld/ * emulparams/tic80coff.sh: Delete file. * scripttempl/tic80coff.sc: Delete file. * configure.tgt: Remove tic80 support. * Makefile.am: Likewise. * Makefile.in: Regenerate. * po/BLD-POTFILES.in: Regenerate. opcodes/ * tic80-dis.c: Delete file. * tic80-opc.c: Delete file. * disassemble.c: Remove tic80 support. * disassemble.h: Likewise. * Makefile.am: Likewise. * configure.ac: Likewise. * Makefile.in: Regenerate. * configure: Regenerate. * po/POTFILES.in: Regenerate.
* Make bfd_get_8 return a bfd_vma like other bfd_get_* functionsAlan Modra2019-12-112-2/+8
| | | | | | | | | | | And similarly for bfd_get_signed_8. bfd/ * libbfd.c (bfd_get_8): Return a bfd_vma. (bfd_get_signed_8): Return a bfd_signed_vma. * bfd-in2.h: Regenerate. binutils/ * od-xcoff.c (dump_dumpx_core): Adjust for bfd_h_get_8 change.
* PR24960, Memory leak from disassemblerAlan Modra2019-12-102-0/+6
| | | | | | | | | | PR 24960 include/ * dis-asm.h (disassemble_free_target): Declare. opcodes/ * disassemble.c (disassemble_free_target): New function. binutils/ * objdump.c (disassemble_data): Call disassemble_free_target.
* Delete duplicate struct objdump_disasm_info fieldAlan Modra2019-12-102-6/+12
| | | | | | | | | objdump_disasm_info.sec duplicates disassemble_info.section * objdump.c (struct objdump_disasm_info): Delete "sec". (find_symbol_for_address): Use inf->section rather than aux->sec. (objdump_print_addr, disassemble_bytes): Likewise. (disassemble_section): Don't set aux->sec.
* Optional matching for run_dump_testAlan Modra2019-12-082-0/+23
| | | | | | | | | | | | | | This adds an alternative to using #... in dump files, useful where we only want to allow specific extra output. DW_CFA_nop in CIEs and FDEs to pad out to required alignment (larger for 64-bit than 32-bit) is an example where these optional match patterns are useful. binutils/ * testsuite/lib/binutils-common.exp (regexp_diff): Support #?REGEXP. ld/ * testsuite/ld-elf/eh4.d: Match optional padding DW_CFA_nop in FDEs. * testsuite/ld-elf/eh5.d: Likewise, and extra CIEs emitted on embedded targets.
* binutils/gas/riscv: Add DWARF register numbers for CSRsAndrew Burgess2019-11-282-3/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit gives DWARF register numbers to the RISC-V CSRs inline with the RISC-V ELF specification here: https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md The CSRs are defined being numbered from 4096 to 8191. This adds support to the assembler, required in order to reference CSRs in, for example .cfi directives. I have then extended dwarf.c in order to support printing CSR names in the dumped DWARF output. As the CSR name space is quite large and only sparsely populated, I have provided a new function to perform RISC-V DWARF register name lookup which uses a switch statement rather than the table base approach that other architectures use. Any CSR that does not have a known name will return a name based on 'csr%d' with the %d being replaced by the offset of the CSR from 4096. gas/ChangeLog: * config/tc-riscv.c (tc_riscv_regname_to_dw2regnum): Lookup CSR names too. * testsuite/gas/riscv/csr-dw-regnums.d: New file. * testsuite/gas/riscv/csr-dw-regnums.s: New file. binutils/ChangeLog: * dwarf.c (regname_internal_riscv): New function. (init_dwarf_regnames_riscv): Use new function. Change-Id: I3f70bc24fa8b3c75744e6775eeeb87db70c7ecfb
* binutils: Make DWARF register name lookup be via a function pointerAndrew Burgess2019-11-282-8/+51
| | | | | | | | | | | | | | | | | | | | | | | | | Add a layer of indirection for DWARF register name lookup by introducing a function pointer. Right now all targets use the same table based implementation that they always have, however, this will change in a later commit. binutils/ChangeLog: * dwarf.c (typedef dwarf_regname_lookup_ftype): New typedef. (dwarf_regnames_lookup_func): New static global. (init_dwarf_regnames_i386): Set dwarf_regnames_lookup_func. (init_dwarf_regnames_iamcu): Likewise. (init_dwarf_regnames_x86_64): Likewise. (init_dwarf_regnames_aarch64): Likewise. (init_dwarf_regnames_s390): Likewise. (init_dwarf_regnames_riscv): Likewise. (init_dwarf_regnames_by_elf_machine_code): Reset dwarf_regnames_lookup_func to NULL. (init_dwarf_regnames_by_bfd_arch_and_mach): Likewise. (regname_internal_by_table_only): New function. (regname): Make use of dwarf_regnames_lookup_func. Change-Id: Ibbff61c0abea32927f35c9e478793039ab8bb57d
* binutils: Make some functions static in dwarf.cAndrew Burgess2019-11-283-12/+21
| | | | | | | | | | | | | | | | | | | | | | The architecture specific register name initialisation routines no longer need to be externally visible, so make them static. binutils/ChangeLog: * dwarf.c (init_dwarf_regnames_i386): Make static. (init_dwarf_regnames_iamcu): Make static. (init_dwarf_regnames_x86_64): Make static. (init_dwarf_regnames_aarch64): Make static. (init_dwarf_regnames_s390): Make static. (init_dwarf_regnames_riscv): Make static. * dwarf.h (init_dwarf_regnames_i386): Delete declaration. (init_dwarf_regnames_iamcu): Delete declaration. (init_dwarf_regnames_x86_64): Delete declaration. (init_dwarf_regnames_aarch64): Delete declaration. (init_dwarf_regnames_s390): Delete declaration. (init_dwarf_regnames_riscv): Delete declaration. Change-Id: I9e350f76f98f46e9e3dd88d502f2a2a83e44cb36
* binutils: Add a new function to initialise DWARF register name stateAndrew Burgess2019-11-284-36/+63
| | | | | | | | | | | | | | | | | | | Adds a new API function init_dwarf_regnames_by_bfd_arch_and_mach to initialise the register name state from a BFD architecture and machine type. There should be no user visible changes after this commit. binutils/ChangeLog: * dwarf.c (init_dwarf_regnames_by_bfd_arch_and_mach): New function. * dwarf.h (init_dwarf_regnames_by_bfd_arch_and_mach): Declare. * objdump.c (dump_dwarf): Call new function instead of calling specific initialization routines. Restrucure so that eh_addr_size is still calculated correctly. Change-Id: I346d665d2079a18ec4d04bd41893d0e9dc05e4b3
* binutils: Rename init_dwarf_regnamesAndrew Burgess2019-11-284-3/+11
| | | | | | | | | | | | | | | | | | | | | | As part of a process to change how dwarf.c figures out the correct name for a register I wanted to clean up how we initialise the register name tracking state. As part of this I rename init_dwarf_regnames to init_dwarf_regnames_by_elf_machine_code, later commits will add a different entry point to initialise the register name state. There should be no user visible changes after this commit. binutils/ChangeLog: * dwarf.c (init_dwarf_regnames): Renamed to... (init_dwarf_regnames_by_elf_machine_code): ...this. * dwarf.h (init_dwarf_regnames): Renamed to... (init_dwarf_regnames_by_elf_machine_code): ...this. * readelf.c (process_file_header): Update call to use new name. Change-Id: Ic8d2ef5fb62a8590ecd8cbb7e6258e11c6263594
* binutils: Be more forgiving of targets with large numbers of registersAndrew Burgess2019-11-282-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently if a target has a large ( > 1024 ) number of registers then we get a warning when dumping the DWARF whenever a register over the 1024 limit is referenced, this occurs in dwarf.c:frame_need_space. This check was initially introduced to guard against corrupted DWARF referencing stupidly large numbers of registers. The frame_need_space function already has a check in place so that, if a target specifies a set of known DWARF register names then we must only reference a register within this set, it is only after this check that we check for the 1024 limit. What this means is that if a target DOES NOT define a set of known register names and if we reference more than 1024 registers frame_need_space will give a warning. If a target DOES define a set of known registers and there are more than 1024 defined registers, and we try to reference a register beyond 1024 we will again get an error. This second case feels wrong to me. My thinking is that if a target defines a set of registers then it is not unreasonable to assume the tools can cope with that number of registers. And so, if the target defines 2000 named DWARF registers, frame_need_space should allow access to all of these registers. If a target does not define a set of named registers then the 1024 limit should remain. This is pretty arbitrary, but we do need to have some limit in place I think, so for now that seems as good as any. This is an entirely theoretical fix - there are no targets that define such large numbers of registers, but while experimenting with adding support for RISC-V CSRs I ran into this issue and felt like it was a good improvement. binutils/ChangeLog: * dwarf.c (frame_need_space): Compare dwarf_regnames_count against 0, and only warn about large numbers of registers if the number is more than the dwarf_regnames_count. Change-Id: Ifac1a999ff0677676e81ee373c4c044b6a700827
* Introduce new section flag: SEC_ELF_OCTETSChristian Eggers2019-11-252-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All symbols, sizes and relocations in this section are octets instead of bytes. Required for DWARF debug sections as DWARF information is organized in octets, not bytes. bfd/ * section.c (struct bfd_section): New flag SEC_ELF_OCTETS. * archures.c (bfd_octets_per_byte): New parameter sec. If section is not NULL and SEC_ELF_OCTETS is set, one octet es returned [ELF targets only]. * bfd.c (bfd_get_section_limit): Provide section parameter to bfd_octets_per_byte. * bfd-in2.h: regenerate. * binary.c (binary_set_section_contents): Move call to bfd_octets_per_byte into section loop. Provide section parameter to bfd_octets_per_byte. * coff-arm.c (coff_arm_reloc): Provide section parameter to bfd_octets_per_byte. * coff-i386.c (coff_i386_reloc): likewise. * coff-mips.c (mips_reflo_reloc): likewise. * coff-x86_64.c (coff_amd64_reloc): likewise. * cofflink.c (_bfd_coff_link_input_bfd): likewise. (_bfd_coff_reloc_link_order): likewise. * elf.c (_bfd_elf_section_offset): likewise. (_bfd_elf_make_section_from_shdr): likewise. Set SEC_ELF_OCTETS for sections with names .gnu.build.attributes, .debug*, .zdebug* and .note.gnu*. * elf32-msp430.c (rl78_sym_diff_handler): Provide section parameter to bfd_octets_per_byte. * elf32-nds.c (nds32_elf_get_relocated_section_contents): likewise. * elf32-ppc.c (ppc_elf_addr16_ha_reloc): likewise. * elf32-pru.c (pru_elf32_do_ldi32_relocate): likewise. * elf32-s12z.c (opru18_reloc): likewise. * elf32-sh.c (sh_elf_reloc): likewise. * elf32-spu.c (spu_elf_rel9): likewise. * elf32-xtensa.c (bfd_elf_xtensa_reloc): likewise * elf64-ppc.c (ppc64_elf_brtaken_reloc): likewise. (ppc64_elf_addr16_ha_reloc): likewise. (ppc64_elf_toc64_reloc): likewise. * elflink.c (bfd_elf_final_link): likewise. (bfd_elf_perform_complex_relocation): likewise. (elf_fixup_link_order): likewise. (elf_link_input_bfd): likewise. (elf_link_sort_relocs): likewise. (elf_reloc_link_order): likewise. (resolve_section): likewise. * linker.c (_bfd_generic_reloc_link_order): likewise. (bfd_generic_define_common_symbol): likewise. (default_data_link_order): likewise. (default_indirect_link_order): likewise. * srec.c (srec_set_section_contents): likewise. (srec_write_section): likewise. * syms.c (_bfd_stab_section_find_nearest_line): likewise. * reloc.c (_bfd_final_link_relocate): likewise. (bfd_generic_get_relocated_section_contents): likewise. (bfd_install_relocation): likewise. For section which have SEC_ELF_OCTETS set, multiply output_base and output_offset with bfd_octets_per_byte. (bfd_perform_relocation): likewise. include/ * coff/ti.h (GET_SCNHDR_SIZE, PUT_SCNHDR_SIZE, GET_SCN_SCNLEN), (PUT_SCN_SCNLEN): Adjust bfd_octets_per_byte calls. binutils/ * objdump.c (disassemble_data): Provide section parameter to bfd_octets_per_byte. (dump_section): likewise (dump_section_header): likewise. Show SEC_ELF_OCTETS flag if set. gas/ * as.h: Define SEC_OCTETS as SEC_ELF_OCTETS if OBJ_ELF. * dwarf2dbg.c: (dwarf2_finish): Set section flag SEC_OCTETS for .debug_line, .debug_info, .debug_abbrev, .debug_aranges, .debug_str and .debug_ranges sections. * write.c (maybe_generate_build_notes): Set section flag SEC_OCTETS for .gnu.build.attributes section. * frags.c (frag_now_fix): Don't divide by OCTETS_PER_BYTE if SEC_OCTETS is set. * symbols.c (resolve_symbol_value): Likewise. ld/ * ldexp.c (fold_name): Provide section parameter to bfd_octets_per_byte. * ldlang (init_opb): New argument s. Set opb_shift to 0 if SEC_ELF_OCTETS for the current section is set. (print_input_section): Pass current section to init_opb. (print_data_statement,print_reloc_statement, print_padding_statement): Likewise. (lang_check_section_addresses): Call init_opb for each section. (lang_size_sections_1,lang_size_sections_1, lang_do_assignments_1): Likewise. (lang_process): Pass NULL to init_opb.
* PR273, SOM size -AAlan Modra2019-11-213-3/+18
| | | | | | | | | | | | | | | | The SOM backend creates BFD sections for "spaces", and "sub-spaces". "sub-spaces" are what we normally think of as a section, "spaces" aggregate "sub-spaces". Thus it does not really make sense to include "spaces" for size -A since that would double count total size. It so happens that real sections ought to have at least one of the ALLOC and HAS_CONTENTS flags set, so this patch excludes "spaces" but excluding BFD sections with no flags set. PR 273 * size.c (sysv_internal_sizer, sysv_internal_printer): Exclude sections with no flag bits set. * testsuite/binutils-all/size.exp: Allow $CODE$ as a text section.
* Fix potential buffer overrun in objcopy's note merging code.Nick Clifton2019-11-212-3/+14
| | | | | | * objcopy.c (merge_gnu_build_notes): Allow for the possibility that the new notes might actually be larger than the original notes.
* PR46, cygwin: FAIL: cdtest with -UrAlan Modra2019-11-212-7/+15
| | | | | | | | | | | | | See the comment in pe.sc to understand why ld -Ur won't work. PR 46 binutils/ * testsuite/lib/binutils-common.exp (is_pecoff_format): Rewrite with positive logic and add more target triples. ld/ * scripttempl/pe.sc: Comment on ld -Ur fail. Wrap .gcc_exc comment. * scripttempl/pep.sc: Likewise. * testsuite/ld-cdtest/cdtest.exp (test2): xfail for pe.
* PR24499, ignore --add-gnu-debuglink for archivesAlan Modra2019-11-192-0/+13
| | | | | | | | objcopy --add-gnu-debuglink=foo.a.dbg foo.a just doesn't make any sense. Who puts executables in archives? PR 24499 * objcopy.c (copy_file): Ignore --add-gnu-debuglink for archives.
* PR24968, make objcopy use output ELF arch if -B not givenAlan Modra2019-11-192-2/+16
| | | | | | | | | | This should make objcopy -B redundant for the common case of producing ELF output where the -O target defaults to the desired arch:mach. PR 24968 * objcopy.c (copy_object): For ELF output and non-ELF input without arch, take arch from output file if not given by -B. Don't bfd_get_arch_info when we already have iarch.
* PR25191, internal error in _bfd_elf_set_section_contentsAlan Modra2019-11-192-10/+24
| | | | | | | | | | | | | | | | | This PR copies a fuzzed PE input file to ELF output, in the process confusing the ELF backend by copying COFF-only section flags to the output. SEC_COFF_SHARED has the same value as SEC_ELF_COMPRESS. One approach to fixing this problem is of course not to reuse flag bits, but we've run out. So this patch only copies section flags that are in the bfd_applicable_section_flags set when changing the flavour of the output file. PR 25191 * objcopy.c (is_nondebug_keep_contents_section): Use bfd_get_flavour. (copy_object): Likewise. (setup_section): Likewise. If flavour of input and output files differ, restrict section flags to the intersection of input and output bfd_applicable_section_flags.
* Add space between program name and file for objcopy/strip/objdump messagesAlan Modra2019-11-192-6/+11
| | | | | | | | | | | | | The GNU coding standard does indicate there should be no space in messages like these, but we tend to put a space in all other messages. This patch cures the inconsistency in: $ binutils/strip-new -F elf32-little -N .text -o pr25200 pr25200.bin binutils/strip-new: pr25200: R_X86_64_PLT32 unsupported binutils/strip-new:pr25200: sorry, cannot handle this file * bucomm.c (bfd_nonfatal_message): Add a space between program name and file.
* PR25198, use of out of date pointerAlan Modra2019-11-182-2/+6
| | | | | PR 25198 * prdbg.c (tg_start_class_type): Correct scope of idbuf.
* PR25172, Wrong description of --stop-address=ADDR switchAlan Modra2019-11-082-1/+6
| | | | | PR 25172 * objdump.c (usage): Correct --stop-address description.
* Allow the --output option of the "ar" prorgam to extract files to locations ↵Nick Clifton2019-11-073-20/+25
| | | | | | | | | outside of the current directory. * ar.c (open_output_file): Check for filename validity before prefixing with output directory. Display the constructed output filename if in verbose mode. (extract_file): Let open_output_file display the filename.
* Fix bug merging notes with objcopy when no merging results in zeroes being ↵Nick Clifton2019-11-072-15/+20
| | | | | | | | written back into the note section. * objcopy.c (copy_object): Skip note sections that do not have an output section. Always copy note sections, even if no changes are made.
* Fix an off-by-one error in the IN_RANGE macro used by readelf. Add another ↵Christian Eggers2019-11-062-3/+14
| | | | | | | | | use of the macro. * readelf.c (IN_RANGE): Rename parameter OFF to NELEM. Add comment. Catch potential integer overflow and fix off by one error whilst checking reloc location against section size. (apply_relocations): Use IN_RANGE macro.