aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2017-11-10Fix riscv binutils xfail for debug_ranges test.Jim Wilson2-1/+6
binutils/ * testsuite/binutils-all/objdump.exp: Expect the debug_ranges test to pass.
2017-11-07Fix typo in my email address.Jim Wilson2-1/+5
binutils/ * MAINTAINERS (RISC-V): Fix typo in my email address.
2017-11-07RISC-V: Add Jim Wilson as a maintainer, and clean up our entriesPalmer Dabbelt2-2/+9
Jim has recently started working at SiFive, where he'll be contributing to our binutils port. Andrew and I would like him to be a maintainer. My understanding is that this is right place to ask. I've also changed my address to my SiFive one, where I also work -- it seems cleaner to have everyone use our proper email address. While I was in there, I noticed a trailing space after Andrew's name so I went ahead and removed it as well. binutils/ChangeLog 2017-11-07 Palmer Dabbelt <palmer@sifive.com> * MAINTAINERS (RISC-V): Add Jim Wilson as a maintainer. Clean up Andrew's entry (remove trailing space, add tabs). Change Palmer's email address, and clean up entry (add tabs).
2017-11-07readelf ngettext fixesAlan Modra15-110/+226
This patch is a first pass at fixing readelf message pluralization. I've deliberately not fixed the "out of memory" errors since it's very unlikely that they will ever be complaining about not being able to allocate for a single entry, and a few others where the size is very unlikely to be 1 byte. Then there are messages like this one: "Out of %lu items there are %zu bucket clashes (longest of %zu entries).\n" I suppose this could be split into three parts, "Of %lu items ", "there are %zu bucket clashes ", and "(longest of %zu entries).\n", each part being printed separately, but that might not be ideal for sentence construction in other languages. For now I'm punting on this one. Changes to readelf output require lots of testsuite adjustment.. binutils/ * dwarf.c (read_uleb128): Properly pluralize messages. (display_debug_lines_raw, display_debug_loc): Likewise. (display_debug_names, process_cu_tu_index): Likewise. * od-macho.c (dump_code_signature_superblob): Likewise. * readelf.c (process_program_headers): Likewise. (process_section_header, process_relocs): Likewise. (hppa_process_unwind, arm_process_unwind): Likewise. (process_dynamic_section, process_version_sections): Likewise. (process_symbol_table, process_syminfo): Likewise. (apply_relocations, process_mips_specific): Likewise. (process_gnu_liblist, process_notes_at): Likewise. (process_archive): Likewise. * testsuite/binutils-all/dw2-1.W, * testsuite/binutils-all/dw2-3.W, * testsuite/binutils-all/dw2-3gabi.W, * testsuite/binutils-all/dw5.S, * testsuite/binutils-all/dw5.W, * testsuite/binutils-all/i386/compressed-1a.d, * testsuite/binutils-all/libdw2-compressedgabi.out, * testsuite/binutils-all/objdump.W, * testsuite/binutils-all/readelf.r, * testsuite/binutils-all/readelf.r-64, * testsuite/binutils-all/x86-64/compressed-1a.d: Update for pluralization fixes. gas/ * testsuite/gas/arm/got_prel.d, * testsuite/gas/elf/dwarf2-1.d, * testsuite/gas/elf/dwarf2-2.d, * testsuite/gas/elf/dwarf2-3.d, * testsuite/gas/elf/dwarf2-5.d, * testsuite/gas/elf/dwarf2-6.d, * testsuite/gas/i386/debug1.d, * testsuite/gas/i386/dw2-compress-1.d, * testsuite/gas/i386/dw2-compress-3a.d, * testsuite/gas/i386/dw2-compress-3b.d, * testsuite/gas/i386/dw2-compressed-1.d, * testsuite/gas/i386/dw2-compressed-3a.d, * testsuite/gas/i386/dw2-compressed-3b.d, * testsuite/gas/i386/ilp32/x86-64-localpic.d, * testsuite/gas/i386/localpic.d, * testsuite/gas/i386/x86-64-localpic.d, * testsuite/gas/ia64/pr13167.d, * testsuite/gas/mips/loc-swap-2.d, * testsuite/gas/mips/loc-swap.d, * testsuite/gas/mips/micromips@loc-swap-2.d, * testsuite/gas/mips/micromips@loc-swap.d, * testsuite/gas/mips/mips16-dwarf2-n32.d, * testsuite/gas/mips/mips16-dwarf2.d, * testsuite/gas/mips/mips16@loc-swap-2.d, * testsuite/gas/mips/mips16@loc-swap.d, * testsuite/gas/mips/mips16e@loc-swap.d, * testsuite/gas/mmix/bspec-1.d, * testsuite/gas/mmix/bspec-2.d, * testsuite/gas/tic6x/unwind-1.d, * testsuite/gas/tic6x/unwind-2.d, * testsuite/gas/tic6x/unwind-3.d: Update for pluralization fixes. ld/ * testsuite/ld-aarch64/ifunc-13.d, * testsuite/ld-aarch64/ifunc-15.d, * testsuite/ld-aarch64/ifunc-20.d, * testsuite/ld-alpha/tlsbin.rd, * testsuite/ld-alpha/tlspic.rd, * testsuite/ld-arm/ifunc-3.rd, * testsuite/ld-arm/ifunc-9.rd, * testsuite/ld-arm/unwind-mix.d, * testsuite/ld-arm/unwind-rel.d, * testsuite/ld-cris/hiddef1.d, * testsuite/ld-cris/libdso-13.d, * testsuite/ld-cris/libdso-2.d, * testsuite/ld-cris/pr16044.d, * testsuite/ld-cris/tls-local-63.d, * testsuite/ld-cris/tls-local-64.d, * testsuite/ld-cris/tls-und-38.d, * testsuite/ld-cris/tls-und-42.d, * testsuite/ld-cris/tls-und-46.d, * testsuite/ld-cris/tls-und-50.d, * testsuite/ld-cris/weakref3.d, * testsuite/ld-cris/weakref4.d, * testsuite/ld-elf/comm-data2r.rd, * testsuite/ld-elf/discard1.d, * testsuite/ld-elf/discard2.d, * testsuite/ld-elf/pr19539.d, * testsuite/ld-elf/pr22374-1.r, * testsuite/ld-elf/pr22374-2.r, * testsuite/ld-i386/combreloc.d, * testsuite/ld-i386/emit-relocs-nacl.rd, * testsuite/ld-i386/emit-relocs.rd, * testsuite/ld-i386/pr13302.d, * testsuite/ld-i386/pr17709-nacl.rd, * testsuite/ld-i386/pr17709.rd, * testsuite/ld-i386/pr19539.d, * testsuite/ld-i386/pr19615.d, * testsuite/ld-i386/pr19636-1a.d, * testsuite/ld-i386/pr19636-1e.d, * testsuite/ld-i386/pr19636-1f.d, * testsuite/ld-i386/pr19636-2a.d, * testsuite/ld-i386/pr19636-2b.d, * testsuite/ld-i386/pr19636-2d-nacl.d, * testsuite/ld-i386/pr19636-2e-nacl.d, * testsuite/ld-i386/pr19636-3a.d, * testsuite/ld-i386/pr19636-3d.d, * testsuite/ld-i386/pr19636-3e.d, * testsuite/ld-i386/pr19636-4a.d, * testsuite/ld-i386/pr19645.d, * testsuite/ld-i386/pr19827-nacl.rd, * testsuite/ld-i386/pr19827.rd, * testsuite/ld-i386/pr20253-4a.d, * testsuite/ld-i386/pr20253-4b.d, * testsuite/ld-i386/pr20253-5.d, * testsuite/ld-i386/tlsbin-nacl.rd, * testsuite/ld-i386/tlsbin.rd, * testsuite/ld-i386/tlspic-nacl.rd, * testsuite/ld-i386/tlspic.rd, * testsuite/ld-i386/undefweakb.d, * testsuite/ld-ia64/tlsbin.rd, * testsuite/ld-ia64/tlspic.rd, * testsuite/ld-ifunc/ifunc-13-i386.d, * testsuite/ld-ifunc/ifunc-13-x86-64.d, * testsuite/ld-ifunc/ifunc-15-i386.d, * testsuite/ld-ifunc/ifunc-15-x86-64.d, * testsuite/ld-ifunc/ifunc-20-i386.d, * testsuite/ld-ifunc/ifunc-20-x86-64.d, * testsuite/ld-ifunc/ifunc-23a-x86.d, * testsuite/ld-ifunc/ifunc-23b-x86.d, * testsuite/ld-ifunc/ifunc-23c-x86.d, * testsuite/ld-ifunc/ifunc-24a-x86.d, * testsuite/ld-ifunc/ifunc-24b-x86.d, * testsuite/ld-ifunc/ifunc-24c-x86.d, * testsuite/ld-ifunc/ifunc-25a-x86.d, * testsuite/ld-ifunc/ifunc-25b-x86.d, * testsuite/ld-ifunc/ifunc-25c-x86.d, * testsuite/ld-m68k/got-1.d, * testsuite/ld-mips-elf/vxworks1.rd, * testsuite/ld-powerpc/ambiguousv1.d, * testsuite/ld-powerpc/ambiguousv1b.d, * testsuite/ld-powerpc/ambiguousv2.d, * testsuite/ld-powerpc/ambiguousv2b.d, * testsuite/ld-powerpc/tlsexe.r, * testsuite/ld-powerpc/tlsexe32.r, * testsuite/ld-powerpc/tlsexetoc.r, * testsuite/ld-powerpc/tlsso.r, * testsuite/ld-powerpc/tlsso32.r, * testsuite/ld-powerpc/tlstocso.r, * testsuite/ld-powerpc/vle-multiseg-1.d, * testsuite/ld-powerpc/vle-multiseg-2.d, * testsuite/ld-powerpc/vle-multiseg-3.d, * testsuite/ld-s390/tlsbin.rd, * testsuite/ld-s390/tlsbin_64.rd, * testsuite/ld-s390/tlspic.rd, * testsuite/ld-s390/tlspic_64.rd, * testsuite/ld-sh/ld-r-1.d, * testsuite/ld-sh/sh64/gotplt.d, * testsuite/ld-sh/shared-1.d, * testsuite/ld-sh/tlsbin-2.d, * testsuite/ld-sh/tlspic-2.d, * testsuite/ld-sparc/gotop32.rd, * testsuite/ld-sparc/gotop64.rd, * testsuite/ld-sparc/tlssunpic32.rd, * testsuite/ld-sparc/tlssunpic64.rd, * testsuite/ld-sparc/vxworks1-lib.rd, * testsuite/ld-tic6x/shlib-app-1.rd, * testsuite/ld-tic6x/shlib-app-1b.rd, * testsuite/ld-tic6x/shlib-app-1r.rd, * testsuite/ld-tic6x/shlib-app-1rb.rd, * testsuite/ld-tic6x/shlib-noindex.rd, * testsuite/ld-vax-elf/export-class-data.rd, * testsuite/ld-x86-64/pr13082-1a.d, * testsuite/ld-x86-64/pr13082-1b.d, * testsuite/ld-x86-64/pr13082-2a.d, * testsuite/ld-x86-64/pr13082-2b.d, * testsuite/ld-x86-64/pr13082-3a.d, * testsuite/ld-x86-64/pr13082-3c.d, * testsuite/ld-x86-64/pr13082-4a.d, * testsuite/ld-x86-64/pr13082-5a.d, * testsuite/ld-x86-64/pr13082-5b.d, * testsuite/ld-x86-64/pr13082-6a.d, * testsuite/ld-x86-64/pr13082-6b.d, * testsuite/ld-x86-64/pr17709-nacl.rd, * testsuite/ld-x86-64/pr17709.rd, * testsuite/ld-x86-64/pr19539a.d, * testsuite/ld-x86-64/pr19539b.d, * testsuite/ld-x86-64/pr19615.d, * testsuite/ld-x86-64/pr19636-1a.d, * testsuite/ld-x86-64/pr19636-1d.d, * testsuite/ld-x86-64/pr19636-1e.d, * testsuite/ld-x86-64/pr19636-2a.d, * testsuite/ld-x86-64/pr19636-2e.d, * testsuite/ld-x86-64/pr19636-2f.d, * testsuite/ld-x86-64/pr19636-3a.d, * testsuite/ld-x86-64/pr19645.d, * testsuite/ld-x86-64/pr19807-2b.d, * testsuite/ld-x86-64/pr19807-2d.d, * testsuite/ld-x86-64/pr19827-nacl.rd, * testsuite/ld-x86-64/pr19827.rd, * testsuite/ld-x86-64/pr20253-4a.d, * testsuite/ld-x86-64/pr20253-4b.d, * testsuite/ld-x86-64/pr20253-4d.d, * testsuite/ld-x86-64/pr20253-4e.d, * testsuite/ld-x86-64/pr20253-5a.d, * testsuite/ld-x86-64/pr20253-5b.d, * testsuite/ld-x86-64/tlsbin-nacl.rd, * testsuite/ld-x86-64/tlsbin.rd, * testsuite/ld-x86-64/tlspic-nacl.rd, * testsuite/ld-x86-64/tlspic.rd, * testsuite/ld-x86-64/tlspic2-nacl.rd: Update for pluralization fixes.
2017-11-07ngettext supportAlan Modra2-2/+13
binutils has lacked proper pluralization of output messages for a long time, for example, readelf will display information about a section that "contains 1 entries" or "There are 1 section headers". Fixing this properly requires us to use ngettext, because other languages have different rules to English. This patch defines macros for ngettext and friends to handle builds with --disable-nls, and tidies the existing nls support. I've redefined gettext rather than just defining "_" as dgettext in bfd and opcodes in case someone wants to use gettext there (which might conceivably happen with generated code). bfd/ * sysdep.h: Formatting, comment fixes. (gettext, ngettext): Redefine when ENABLE_NLS. (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. (_): Define using gettext. (textdomain, bindtextdomain): Use safer "do nothing". * hosts/alphavms.h (textdomain, bindtextdomain): Likewise. (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. opcodes/ * opintl.h: Formatting, comment fixes. (gettext, ngettext): Redefine when ENABLE_NLS. (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. (_): Define using gettext. (textdomain, bindtextdomain): Use safer "do nothing". binutils/ * sysdep.h (textdomain, bindtextdomain): Use safer "do nothing". (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. gas/ * asintl.h (textdomain, bindtextdomain): Use safer "do nothing". (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. gold/ * system.h (textdomain, bindtextdomain): Use safer "do nothing". (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS. ld/ * ld.h (textdomain, bindtextdomain): Use safer "do nothing". (ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
2017-11-03[ARC] Force the disassam to use the hexadecimal number for printingclaziss4-1/+19
Force printing of the short/signed values using hexadecimal representation via disassembler option. opcode/ 2017-11-03 Claudiu Zissulescu <claziss@synopsys.com> * arc-dis.c (print_hex): New variable. (parse_option): Check for hex option. (print_insn_arc): Use hexadecimal representation for short immediate values when requested. (print_arc_disassembler_options): Add hex option to the list. binutils/ 2017-11-03 Claudiu Zissulescu <claziss@synopsys.com> * doc/binutils.texi (ARC): Update disassembler options. * testsuite/binutils-all/arc/hexprint.s: New file. * testsuite/binutils-all/arc/objdump.exp: Test hex printing feature.
2017-11-03Fix integer overflow problems when reading an ELF binary with corrupt ↵Nick Clifton2-25/+50
augmentation data. PR 22386 * dwarf.c (read_cie): Use bfd_size_type for augmentation_data_len. (display_augmentation_data): New function. (display_debug_frames): Use it. Check for integer overflow when testing augmentation_data_len.
2017-11-02Work around integer overflows when readelf is checking for corrupt ELF notes ↵Mingi Cho2-16/+23
when run on a 32-bit host. PR 22384 * readelf.c (print_gnu_property_note): Improve overflow checks so that they will work on a 32-bit host.
2017-11-01FT32B is a new FT32 family member. It has a code compression scheme, which ↵James Bowman2-0/+6
requires the use of linker relaxations. The change is quite large, so submission is in several parts. Part 2 adds a relaxation pass, which actually implements the code compression scheme. bfd * archures.c: Add bfd_mach_ft32b. * cpu-ft32.c: Add arch_info_struct. * elf32-ft32.c: Add R_FT32_RELAX, SC0, SC1, DIFF32. (ft32_elf_relocate_section): Add clauses for R_FT32_SC0, SC1, DIFF32. (ft32_reloc_shortable, elf32_ft32_is_diff_reloc, elf32_ft32_adjust_diff_reloc_value, elf32_ft32_adjust_reloc_if_spans_insn, elf32_ft32_relax_delete_bytes, elf32_ft32_relax_is_branch_target, ft32_elf_relax_section): New function. * reloc.c: Add BFD_RELOC_FT32_RELAX, SC0, SC1, DIFF32. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas * config/tc-ft32.c (md_assemble): add relaxation reloc BFD_RELOC_FT32_RELAX. (md_longopts): Add "norelax" and "no-relax". (md_apply_fix): Add reloc BFD_RELOC_FT32_DIFF32. (relaxable_section, ft32_validate_fix_sub, ft32_force_relocation, ft32_allow_local_subtract): New function. * config/tc-ft32.h: remove unused MD_PCREL_FROM_SECTION. * testsuite/gas/ft32/insnsc.s: New test exercising all FT32B shortcodes. include * elf/ft32.h: Add R_FT32_RELAX, SC0, SC1, DIFF32.
2017-11-01Fix an invalid free called when attempting to link a COFF object against an ↵Nick Clifton1-2/+10
ELF archive with --no-keep-memory enabled. PR 22369 * coffgen.c (_bfd_coff_free_symbols): Fail if called on a non-COFF file. * cofflink.c (coff_link_check_archive_element): Skip non-COFF members of an archive.
2017-10-31Remind users to use the --use-dynamic command line option to dump dynamic ↵Nick Clifton2-1/+21
relocations. * readelf.c (process_relocs): Tell users if no static relocs were found, but if they had added --use-dynamic to the command line then relocs would have been displayed.
2017-10-28PR22361 readelf buffer overflow on fuzzed archive headerAlan Modra2-0/+18
PR 22361 * readelf.c (process_archive_index_and_symbols): Ensure ar_size field is zero terminated for strtoul. (setup_archive, get_archive_member_name): Likewise.
2017-10-27dwarf: Read register number as unsigned in DW_CFA_def_cfa*Simon Marchi2-4/+10
When displaying the .debug_frame section, the register numbers in the DW_CFA_def_cfa* statements are read as signed numbers. I have come across a target that has register 121, encoded as 0x79 in unsigned LEB128. Interpreting this as signed results in -7, which makes readelf display "r-7". The DWARF5 standard (6.4.2.2) states that the register numbers should be treated as unsigned LEB128. Simply replacing READ_SLEB with READ_ULEB resulted in warnings like these: /home/emaisin/src/binutils-gdb/binutils/dwarf.c: In function ‘display_debug_frames’: /home/emaisin/src/binutils-gdb/binutils/dwarf.c:355:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if ((var) != _val) \ ^ /home/emaisin/src/binutils-gdb/binutils/dwarf.c:7866:8: note: in expansion of macro ‘READ_ULEB’ READ_ULEB (fc->cfa_reg); ^ ... so I also changed Frame_Chunk::cfa_reg to an unsigned int. binutils/ChangeLog: * dwarf.c (struct Frame_Chunk) <cfa_reg>: Change type to unsigned int. (display_debug_frames): Read CFA reg as an unsigned number.
2017-10-25Allow for __gnu_lto_slim prefixed with extra "_"Alan Modra2-1/+8
Some targets prefix global symbols with "_". bfd/ * archive.c (_bfd_compute_and_write_armap): Match "__gnu_lto_slim" optionally prefixed with "_". * linker.c (_bfd_generic_link_add_one_symbol): Likewise. binutils/ * nm.c (filter_symbols): Match "__gnu_lto_slim" optionally prefixed with "_". gold/ * symtab.cc (Symbol_table::add_from_relobj): Match "__gnu_lto_slim" optionally prefixed with "_". ld/ * testsuite/ld-plugin/lto-3r.d: Match "__gnu_lto_v" optionally prefixed with "_". * testsuite/ld-plugin/lto-5r.d: Likewise.
2017-10-18[Visium] Disassemble the operands of the stop instruction.Eric Botcazou2-0/+5
binutils/ * MAINTAINERS: Add myself as Visium maintainer. opcodes/ * visium-dis.c (disassem_class1) <case 0>: Print the operands.
2017-10-18Add a warning to the how-to-make-a-release notes to check the permissions on ↵Nick Clifton2-5/+17
the files in the tarball. * README-how-to-make-a-release: A note about checking file and directory permissions.
2017-10-18Move Svein Seldal to Past Maintainers section.Nick Clifton2-1/+5
* MAINTAINERS: Move Svein Seldal to Past Maintainers section.
2017-10-18PR22303, print_core_note out of bounds readAlan Modra2-27/+35
The print_core_note change here fixes the PR, the rest is making readelf a little more bombproof against maliciously crafted binaries. PR 22303 * readelf.c (print_core_note): Ensure "count" sanity check calculation doesn't overflow. (process_notes_at): Perform note namesz and descsz checks using unsigned comparisons against data remaining. Catch alignment overflow of namesz and descsz too. Don't allocate a temp for terminating "name" when there is space available before descdata.
2017-10-17Add myself as dwarf-mode.el maintainerTom Tromey2-0/+5
In https://sourceware.org/ml/binutils/2017-10/msg00160.html, Nick said I should update MAINTAINERS to mention that I'm the dwarf-mode.el maintainer. So, I'm checking this in. 2017-10-17 Tom Tromey <tom@tromey.com> * MAINTAINERS: Add myself as dwarf-mode.el maintainer.
2017-10-11Display more information when decoding DW_AT_endianity, DW_AT_decimal_sign, ↵Nick Clifton5-6/+283
DW_AT_defaulted and DW_AT_discr_list DWARF attributes. * dwarf.c (read_and_display_attr_value): Handle DW_AT_endianity, DW_END_default, DW_END_big, DW_END_little, DW_ATE_UCS, DW_ATE_ASCII, DW_CC_pass_by_reference, DW_CC_pass_by_value, DW_CC_GNU_renesas_sh, DW_CC_GNU_borland_fastcall_i386, DW_AT_decimal_sign, DW_AT_defaulted, DW_AT_discr_list. (get_TAG_name): Report user generated tag values. * testsuite/binutils-all/dwarf-attributes.S: New test. * testsuite/binutils-all/dwarf-attributes.W. Expected output from readelf. * testsuite/binutils-all/readelf.exp: Run the new test.
2017-10-10Bump dwarf-mode version numberTom Tromey2-1/+5
Bump the dwarf-mode version number, so it can be installed by package.el users who installed an earlier verision. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el: Bump to version 1.4.
2017-10-10Asynchronous insertion for dwarf-mode.elTom Tromey2-16/+68
I was recently examining a very large .debug file. I tried to use dwarf-mode, but it blocked Emacs for a very long time while reading output. This patch changes dwarf-mode to run the objdump process asynchronously. This way, I can still do other things in Emacs while waiting for the dumping to finish. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el (dwarf--process, dwarf--deletion-region): New defvar. (dwarf--check-running, dwarf--sentinel, dwarf--invoke) (dwarf--filter): New functions. (dwarf-do-insert-substructure, dwarf-do-refresh): Call dwarf--check-running, dwarf--invoke. (dwarf-browse): Initialize new variables.
2017-10-10Set lexical-binding in dwarf-modeTom Tromey2-1/+5
Emacs has had lexical binding for a while, and it's a good practice to use it; so enable it in dwarf-mode.el. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el: Set lexical-binding.
2017-10-10Bind keys in dwarf-mode-map definitionTom Tromey2-2/+11
It's bad Emacs style to define keys from a top-level form. Instead, one should define a mode map separately and binding keys in the definition. This lets users completely override the map by defining it before loading the mode. 2017-10-10 Tom Tromey <tom@tromey.com> * dwarf-mode.el (dwarf-mode-map): New defvar.
2017-10-10Improve the speed of the --dwarf-start option by skipping processing of any ↵Nick Clifton2-0/+14
comp unit that ends before the specified start address. PR 22249 * dwarf.c (process_debug_info): Skip any comp unit that ends before dwarf_start_die.
2017-10-06DWARF header checksAlan Modra2-86/+95
This patch tidies DWARF header checks, consolidating the "negative" checks (which are really overflow checks) with the section size check. In a number of cases this also ensures that small negative lengths are caught. For instance hdrptr = start + arange.ar_length + initial_length_size; if (hdrptr < start || hdrptr > end) does not detect ar_length in the range [-initial_length_size,-1]. * dwarf.c (process_debug_info): Consolidate header length checks. (display_debug_pubnames_worker): Use "start" to read header. Properly check header length and report errors earlier. Simplify loop printing pubnames. (get_line_filename_and_dirname): Catch small negative "length" values. (display_debug_aranges): Likewise. Report header errors earlier using standardized message. (display_debug_names): Likewise.
2017-10-05Avoid spurious readelf error status from decode_arm_unwind.Joseph Myers2-1/+5
readelf.c:decode_arm_unwind has a variable res that is used as a return value, with FALSE meaning unsuccessful and TRUE meaning successful. This is initialized to FALSE (and then various code in the function sets it to FALSE again on error), meaning that when the function is successful, if it reaches returning res is still returns FALSE, resulting eventually in exit status 1 from readelf without any error message to indicate an error. This patch fixes the initialization to use TRUE, so avoiding those spurious errors. I don't have a self-contained test for this issue; it was observed as many prelink tests failing without the patch and passing with it. * readelf.c (decode_arm_unwind): Initialize res to TRUE.
2017-10-05Fix strip so that is accepts -M as an abbreviation for --merge-notes.Nick Clifton2-1/+7
PR 22260 * objcopy.c (strip_main): Add 'M' character to short options list when calling getopt_long.
2017-10-05Change readelf so that when --wide is active a relocation's full name is ↵Nick Clifton2-1/+7
displayed. PR 22262 binutils* readelf.c (dump_relocations): Do not truncate reloc names when displaying output in wide mode. ld * testsuite/ld-powerpc/relocsort.d: Update expected output (for longer reloc names).
2017-10-05Update README-how-to-make-a-release with the correct sequence for creating ↵Nick Clifton2-39/+34
the source tarball. * README-how-to-make-a-release: Merge steps 3, 4 and 5, and insert the git tag operation at the correct location.
2017-10-05PR22239 - invalid memory read in display_debug_framesAlan Modra2-11/+12
Pointer comparisons have traps for the unwary. After adding a large unknown value to "start", the test "start < end" depends on where "start" is originally in memory. PR 22239 * dwarf.c (read_cie): Don't compare "start" and "end" pointers after adding a possibly wild length to "start", compare the length to the difference of the pointers instead. Remove now redundant "negative" length test.
2017-10-05Update my email address.Tristan Gingold2-3/+8
Also refer to global maintainers for branch release approval.
2017-10-01PR22232, NULL pointer dereference in load_specific_debug_sectionAlan Modra2-2/+10
PR 22232 PR 22230 * objdump.c (load_specific_debug_section): Introduce a temp to stop bfd_get_full_section_contents NULLing out section->start.
2017-10-01PR22230, buffer overflow in display_debug_macroAlan Modra2-4/+11
PR 22230 * objdump.c (load_specific_debug_section): Allocate an extra byte for a terminating NUL.
2017-09-30PR21978, objdump does not display line numbers in certain casesAlan Modra2-12/+24
Same line but different file ought to display file and line. PR 21978 * objdump.c: Formatting. (show_line): Reset prev_line when function name changes.
2017-09-27Prevent an infinite loop in the DWARF parsing code when encountering a CU ↵Nick Clifton2-1/+16
structure with a small negative size. PR 22219 * dwarf.c (process_debug_info): Add a check for a negative cu_length field.
2017-09-27PR22216, infinite loop in readelf process_symbol_tableAlan Modra2-18/+34
This should make readelf bombproof given a fuzzed DT_HASH. Also removes a bogus check that would have resulted in wrong histograms. PR 22216 * readelf.c (process_symbol_table): Check that DT_HASH symbol chains are only visited once, and report an error if not. Display invalid symbol index if chain is out of range. Use the same logic when calculating histograms rather than the PR 17531 fix. Delete bogus check that chained index is less than number of buckets.
2017-09-26Fix address violations when parsing a corrupt DWARF linenumber table.Nick Clifton2-5/+22
PR 22154 * dwarf.c (get_line_filename_and_dirname): Add extra checks for buffer overruns.
2017-09-26Add README file for creating binutils releasesNick Clifton2-0/+139
2017-09-26PR21732, String-concatenated message can not be translatedAlan Modra3-30/+60
Preprocessor tokens like DWARF_VMA_FMT and BFD_VMA_FMT are not understood by gettext, and cause the translation string to be truncated. Even if it were not truncated, we wouldn't want a value that changes depending on host or configure options to be put in a translation string. PR 21732 * dwarf.c (READ_ULEB): Don't use DWARF_VMA_FMT in translated string. (READ_SLEB): Likewise. * readelf.c (bfd_vmatoa): New function. (get_data, get_dynamic_data): Use it for printing error messages.
2017-09-25Free memory returned from bfd_get_synthetic_symtabH.J. Lu2-1/+9
PR binutils/22203 * nm.c (display_rel_file): Free memory returned from bfd_get_synthetic_symtab.
2017-09-22LVU: dump loclists with locviewsAlexandre Oliva8-35/+1048
When dumping location lists, also dump locview lists that may be interspersed with them, and bring view pairs next to the corresponding location list entries. This patch supports DW_AT_GNU_locviews as a separate attribute for DWARF4- loc_lists and split (dwo) loclists, as well as DWARF5 loclists. It also supports, in DWARF5 loclists, the proposed DW_LLE_GNU_view_pair loclist entry type proposed for DWARF6. The tests use 32-bit DWARF, even on 64-bit targets, resolving offsets to constants so as to reduce the risk that relocations be created for them, or that the offsets be rejected as nonconstants. The patch also adds an xfail to an unrelated test, namely dw5, so that no unexpected fails remain on nds32*-elf, one of the tested targets. Reviewed-by: Alan Modra <amodra@gmail.com> for include/ChangeLog * dwarf2.def (DW_AT_GNU_locviews): New. * dwarf2.h (enum dwarf_location_list_entry_type): Add DW_LLE_GNU_view_pair. (DW_LLE_view_pair): Define. for binutils/ChangeLog * dwarf.h (debug_info): Add loc_views and num_loc_views. * dwarf.c (vm1): New constant. (print_dwarf_view): New function. (read_and_display_attr_value): Support DW_AT_GNU_locviews. (process_debug_info): Keep num_loc_offsets and num_loc_views in sync. (display_view_pair_list): New function. (display_loc_list_dwo): Take vstart_ptr; update it. Dump location view pairs before the range they apply to, when a viewlist augments the loc list. (display_loc_list): Likewise. Check view numbers in range tests. (display_loclists_list): Likewise. Handle view pair entries, and warn on trailing ones. (loc_views): New variable. (loc_offsets_compar): Compare loc_views if loc_offsets are the same. (display_debug_loc): Check and sort loc_views too. Accept loc_view as expected_start. Skip if lists and views are the same. Dump locview list separately in order, and pass the locview list base to each list dump function. Warn and skip overlap and hole checking if we find loclists and locviews to not be adjacent. * testsuite/binutils-all/locview-1.s: New. * testsuite/binutils-all/readelf.locview-1: New. * testsuite/binutils-all/locview-2.s: New. * testsuite/binutils-all/readelf.locview-2: New. * testsuite/binutils-all/readelf.exp: Run new tests. Fix option spelling in pr18374 fail message. XFAIL dw5 test on nds32*-elf.
2017-09-22readelf testsAlan Modra2-43/+49
We have multiple tests that report failure to assemble without saying exactly what test is failing. * testsuite/binutils-all/readelf.exp: Don't perror and exit on bintest.s assembly failure. Report tests unresolved instead. Likewise for version note test, pr18374, decompress, and dw5 tests. (readelf_test): Set testname to include both option and binary file name. Use for pass/fail.
2017-09-22readelf: Handle E_MIPS_MACH_5900Maciej W. Rozycki2-0/+5
Fix commit e407c74b5b60 ("Support for MIPS R5900 (Sony Playstation 2)"), <https://sourceware.org/ml/binutils/2012-12/msg00240.html>, and add the handling of E_MIPS_MACH_5900, correctly showing `5900' among `Flags:' in the output of `-h' rather than `unknown CPU'. binutils/ * readelf.c (get_machine_flags) <E_MIPS_MACH_5900>: New case. gas/ * testsuite/gas/mips/elf_mach_5900.d: New test. * testsuite/gas/mips/mips.exp: Run it.
2017-09-05Fix a buffer overrun when parsing a corrupt MIPS ELF binary.Nick Clifton2-3/+9
PR 21995 * readelf.c (process_mips_specific): Add checks for a NULL data pointer.
2017-09-05Missing relocation R_PPC_VLE_ADDR20 and add VLE flag to details in readelfAlexander Fedotov-B556132-0/+17
include/ * elf/ppc.h (R_PPC_VLE_ADDR20): New relocation. bfd/ * elf32-ppc.c (ppc_elf_howto_raw): Add R_PPC_VLE_ADDR20. (ppc_elf_check_relocs): Handle it. (ppc_elf_vle_split20): New function. (ppc_elf_relocate_section): Handle R_PPC_VLE_ADDR20. binutils/ * readelf.c (get_elf_section_flags): Add VLE. (process_section_headers): Add VLE key to details. gas/ * config/tc-ppc.c (md_parse_option): Handle "mno-vle" flag. (ppc_elf_section_letter): New function. * config/tc-ppc.h (md_elf_section_letter): New. * testsuite/gas/elf/section10.d: Adjust for VLE.
2017-08-25PR21994, readelf looping on verdefsAlan Modra2-14/+39
PR 21994 * readelf.c (process_version_sections <SHT_GNU_verdef>): Check vd_aux and vda_next for sanity. Delete "end". Correct overflow checks. (process_version_sections <SHT_GNU_verneed>): Correct overflow check. Don't report invalid vna_next on overflow. Do report invalid vna_next on size less than aux info.
2017-08-23PR21990, Integer overflow in process_version_sectionsAlan Modra2-26/+29
This tidies some of the overflow checking when processing verneed and verdef sections. PR 21990 * readelf.c (process_version_sections <SHT_GNU_verneed>): Check for invalid vn_next field before adding to idx. Use unsigned long for index vars. Move index checks. <SHT_GNU_verdef>: Likewise for vd_next.
2017-08-17Add test of V2 GNU build attribute notes.Nick Clifton8-1/+232
* testsuite/binutils-all/note-3-64.s: New test. Checks assembly and decoding of version2 GNU build attribute notes. * testsuite/binutils-all/note-3-32.s: New test. 32-bit version of the above test. * testsuite/binutils-all/note-3-64.d: New test driver. * testsuite/binutils-all/note-3-32.d: New test driver. * testsuite/binutils-all/objcopy.exp: Run the new test. * readelf.c (is_64bit_abs_reloc): Add R_SPARC_64.
2017-08-16Add new NT_PPC_* available since Linux 4.8Gustavo Romero2-0/+31
Add new note types available since Linux 4.8 to elf/common.h and make the 'readelf' tool aware of it. include/ * elf/common.h (NT_PPC_TAR): New macro. (NT_PPC_PPR): Likewise. (NT_PPC_DSCR): Likewise. (NT_PPC_EBB): Likewise. (NT_PPC_PMU): Likewise. (NT_PPC_TM_CGPR): Likewise. (NT_PPC_TM_CFPR): Likewise. (NT_PPC_TM_CVMX): Likewise. (NT_PPC_TM_CVSX): Likewise. (NT_PPC_TM_SPR): Likewise. (NT_PPC_TM_CTAR): Likewise. (NT_PPC_TM_CPPR): Likewise. (NT_PPC_TM_CDSCR): Likewise. binutils/ * readelf.c (get_note_type): Handle PPC note types available since Linux 4.8.