summaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)Author
2018-01-03Fix compile time warning introduced by previous delta.Nick Clifton
* objcopy.c (merge_gnu_build_notes): Add cast to maximum address constants.
2018-01-03Add support for v3 binary annotation notes.Nick Clifton
I am checking in the attached patch which updates the binutils support for version 3 binary annotation notes. (Version 3 adds an end address to the ranges covered by the notes, so that it is possible to detect gaps in the coverage). This patch also stops the note merging feature of objcopy from executing if the notes have relocations against them. This makes the code simpler, and prevents the problems with architectures which have unusual relocation management issues. * objcopy.c (objcopy_internal_note): New structure. (gap_exists): New function. (is_open_note): New function. (is_func_note): New function. (is_64bit): New function. (merge_gnu_build_notes): Handle v3 notes. Do not merge if there are relocations against the notes. * readelf.c (get_note_type): Use short names for build attribute notes. (print_symbol_for_build_attribute): Rename to get_symbol_for_build_attribute. Returns the found symbol rather than printing it. (print_gnu_build_attribute_description): Maintain address ranges for function notes as well as global notes. Handle v3 notes. (print_gnu_build_attribute_name): Use more space for printing the name in wide mode. * testsuite/binutils-all/note-2-32.s: Use .dc.l instead of .word. Eliminate symbol references in order to remove the need for relocations. * testsuite/binutils-all/note-2-64.s: Likewise. * testsuite/binutils-all/note-3-32.s: Add a size to the note_1 symbol. * testsuite/binutils-all/note-3-64.s: Likewise. * testsuite/binutils-all/mips/mips-note-2r-n32.d: Update expected output. * testsuite/binutils-all/mips/mips-note-2r-n64.d: Likewise. * testsuite/binutils-all/mips/mips-note-2r.d: Likewise. * testsuite/binutils-all/note-2-32.d: Likewise. * testsuite/binutils-all/note-2-64.d: Likewise. * testsuite/binutils-all/note-3-32.d: Likewise. * testsuite/binutils-all/note-3-64.d: Likewise. * testsuite/binutils-all/note-4-64.s: New test. Checks v3 notes. * testsuite/binutils-all/note-4-32.s: New test. * testsuite/binutils-all/note-4-64.d: New test result file. * testsuite/binutils-all/note-4-32.d: New test result file.
2018-01-03Update year range in copyright notice of binutils filesAlan Modra
2018-01-03ChangeLog rotationAlan Modra
2017-12-19Stop readelf from complaining about relocation sections with an sh_info ↵Nick Clifton
field of 0 in dynamic executables. PR 22587 * readelf.c (process_section_headers): Do not complain about an sh_info field of 0 in relocation sections of ET_EXEC or ET_DYN type executables.
2017-12-19Test binutils_assemble return valueAlan Modra
This is a followup to "binutils nm testsuite tidy". Since the perror in binutils_assemble has been removed, we need to take more care in failure paths. The patch also fixed a number of .exp files that have multiple tests, where an assembly failure returns from the .exp file. In most cases it is nicer to attempt all tests. * testsuite/binutils-all/ar.exp (unique_symbol): Don't run AR if assembly fails. * testsuite/binutils-all/arc/objdump.exp (check_assembly): If objfile is empty, fail test. * testsuite/binutils-all/arm/objdump.exp: Don't return if assembly fails for a test, continue on to other tests. * testsuite/binutils-all/bfin/objdump.exp: Likewise. * testsuite/binutils-all/hppa/objdump.exp: Likewise. * testsuite/binutils-all/m68k/objdump.exp: Likewise. * testsuite/binutils-all/vax/objdump.exp: Likewise. * testsuite/binutils-all/size.exp: Likewise. * testsuite/binutils-all/nm.exp: Likewise. Move PR12753 test. * testsuite/binutils-all/objcopy.exp: Don't perror on assembly fail. * testsuite/binutils-all/objdump.exp: Report assembly fails.
2017-12-18Decode expression lists used with DW_AT_byte_size and other DWARF attributes.Nick Clifton
PR 22532 * dwarf.c (read_and_display_attr_value): Add attributes that might use the DW_FORM_exprloc form, and if so, display the decoded location expression list.
2017-12-14binutils nm testsuite tidyAlan Modra
We can run the gnu_unique_object symbol test on all ELF targets. Those that don't support the symbol type and fail to assemble can just be resolved as "unsupported". This means binutils_assemble can't report an error on assembly failure, but it probably should never have done that anyway. * testsuite/lib/utils-lib.exp (default_binutils_assemble_flags): Don't perror on assembler diagnostic output. * testsuite/binutils-all/nm.exp: Run unique symbol test on all ELF targets. Resolve as "unsupported" on assembly failure.
2017-12-11[Binutils][Objdump]Check symbol section information while search a mapping ↵Renlin Li
symbol backward. When checking mapping symbols backwardly, the section which defines the symbol is not considerted. This patch fixes this by moving the section checking code into get_sym_code_type () function which is shared by forward and backword mapping symbol searching. opcodes/ 2017-12-11 Petr Pavlu <petr.pavlu@arm.com> Renlin Li <renlin.li@arm.com> * aarch64-dis.c (print_insn_aarch64): Move symbol section check ... (get_sym_code_type): Here. binutils/ 2017-12-11 Renlin Li <renlin.li@arm.com> * testsuite/binutils-all/aarch64/objdump.d: New. * testsuite/binutils-all/aarch64/objdump.s: New.
2017-12-08Fix stripping relocs in a file with mergeable notes.Nick Clifton
A recent Fedora bug (1520805) exposed a problem with objcopy's reloc copying code, when a binary also contains mergeable notes. The note merging code would delete some relocs, but then the reloc copying code would try to put them back again, which did not work. So I am checking in the patch below to fix the problem. The patch also tweaks one of the binutils note merging tests so that it is skipped for the Sparc64 target, since this has funky relocs. binutils * objcopy.c (copy_relocations_in_section): Use the orelocations field of the input section, if it has been initialised. * testsuite/binutils-all/note-2-64.d: Skip test on Sparc64. bfd * elfcode.h (elf_write_relocs): Check for an empty howto field.
2017-12-06Objcopy interleave fails if section address not multiple of interleave.Jim Wilson
PR 22465 binutils/ * objcopy.c (copy_section): New local extra. If isection->lma not exactly divisible by interleave, then bias from. Also adjust osection->lma if necessary. ld/ * testsuite/ld-elf/interleave-0.d, testsuite/ld-elf/interleave-4.d, * testsuite/ld-elf/interleave.ld, testsuite/ld-elf/interleave.s: New.
2017-12-06PR22552, readelf heap buffer overflow in load_debug_sectionAlan Modra
PR 22552 * readelf.c (process_file_header): Don't assume XINDEX case value for e_shstrndx is within bounds. (load_debug_section): Sanity test e_shstrndx before attempting to read .shstrtab. Wrap long lines.
2017-12-01Add --strip-unneeded to objcopy synopsisOleksandr Pikozh
* doc/binutils.texi: Add --strip-unneeded to objcopy synopsis.
2017-11-30Prevent an illegal memory access in readelf when attempting to parse a ↵Nick Clifton
corrupt ELF file. PR 22510 * readelf.c (load_debug_section): Fail if there are no section headers available.
2017-11-29Stop objdump from attempting to allocate a huge chunk of memory when parsing ↵Nick Clifton
relocs in a corrupt file. PR 22508 * objdump.c (dump_relocs_in_section): Also check the section's relocation count to make sure that it is reasonable before attempting to allocate space for the relocs.
2017-11-29Support --localedir, --datarootdir and --datadirStefan Stroe
bfd/ * po/Make-in (datadir): Define as @datadir@. (localedir): Define as @localedir@. (gnulocaledir, gettextsrcdir): Use @datarootdir@. binutils/ * po/Make-in (datadir): Define as @datadir@. (localedir): Define as @localedir@. (gnulocaledir, gettextsrcdir): Use @datarootdir@. gas/ * po/Make-in (datadir): Define as @datadir@. (localedir): Define as @localedir@. (gnulocaledir, gettextsrcdir): Use @datarootdir@. gold/ * po/Make-in (datadir): Define as @datadir@. (localedir): Define as @localedir@. (gnulocaledir, gettextsrcdir): Use @datarootdir@. gprof/ * po/Make-in (datadir): Define as @datadir@. (localedir): Define as @localedir@. (gnulocaledir, gettextsrcdir): Use @datarootdir@. ld/ * po/Make-in (datadir): Define as @datadir@. (localedir): Define as @localedir@. (gnulocaledir, gettextsrcdir): Use @datarootdir@. opcodes/ * po/Make-in (datadir): Define as @datadir@. (localedir): Define as @localedir@. (gnulocaledir, gettextsrcdir): Use @datarootdir@.
2017-11-28Properly handle note sections and segmentsH.J. Lu
When dumping notes, get note alignment from either note section or note segment. To support notes generated by assemblers with https://sourceware.org/bugzilla/show_bug.cgi?id=22492 we treate alignment as 4 bytes if it is less than 4. Otherwise, we skip notes if alignment isn't 4 nor 8 bytes. We should call load_separate_debug_file only if e_shstrndx != SHN_UNDEF. PR binutils/22490 * readelf.c (process_notes_at): Add an argument for note alignment. If note alignment is less than 4, use 4 byte alignment. Otherwise, skip notes if alignment isn't 4 nor 8 bytes. (process_corefile_note_segments): Pass segment alignment to process_notes_at. (process_note_sections): Pass section alignment to process_notes_at. (process_object): Call load_separate_debug_file only if e_shstrndx != SHN_UNDEF.
2017-11-27Fix a seg-fault when displaying notes from a prorgam segment. Check for a ↵Nick Clifton
NULL string section before attempting compute the name of a separate debug info file. PR 22490 * readelf.c (dump_section_as_bytes): Check for a NULL string section pointer. (process_notes_at): Compute the alignment to use if displaying notes from a segment.
2017-11-26Rename argument name from link to xlinkH.J. Lu
This fixed the build with GCC 4.2: cc1: warnings being treated as errors binutils-gdb/binutils/dwarf.c: In function ‘load_separate_debug_info’: binutils-gdb/binutils/dwarf.c:9650: warning: declaration of ‘link’ shadows a global declaration /usr/include/unistd.h:757: warning: shadowed declaration is here * dwarf.c (load_separate_debug_info): Rename argument name from link to xlink.
2017-11-24Re-apply "elf: Properly compute offsets of note descriptor and next note"H.J. Lu
CORE PT_NOTE segments may have p_align values of 0 or 1. gABI specifies that PT_NOTE alignment should be aligned to 4 bytes for 32-bit objects and to 8 bytes for 64-bit objects. If segment alignment is less than 4, we use 4 byte alignment.
2017-11-24Revert "elf: Properly compute offsets of note descriptor and next note"Simon Marchi
This reverts commit 650444eb540f9fd85e821567a3f943b4bc41b8be. With this patch, running the GDB test case gdb.base/auxv.exp is stuck in an infinite loop, consuming memory to the point that it renders the machine unusable. I am reverting it so we can take our time to investigate while not killing all the developers' machines.
2017-11-24elf: Properly compute offsets of note descriptor and next noteH.J. Lu
According to gABI, in a note entry, the note name field, not note name size, is padded for the note descriptor. And the note descriptor field, not note descriptor size, is padded for the next note entry. Also notes are aligned to 4 bytes in 32-bit objects and 8 bytes in 64-bit objects. Since on Linux, .note.ABI-tag and .note.gnu.build-id notes are always aligned to 4 bytes, we need to use alignment of note section or note segment, instead of assuming alignment based on ELF file class. Tested on i686 and x86-64. bfd/ PR binutils/22444 * elf.c (elf_read_notes): Add an argument for note aligment. (elf_parse_notes): Likewise. (_bfd_elf_make_section_from_shdr): Pass section aligment to elf_parse_notes. (bfd_section_from_phdr): Pass segment aligment to elf_read_notes. (elf_parse_notes): Add an argument for note aligment. Use ELF_NOTE_DESC_OFFSET to get the offset of the note descriptor. Use ELF_NOTE_NEXT_OFFSET to get the offset of the next note entry. (elf_read_notes): Add an argument for note aligment and pass it to elf_parse_notes. binutils/ PR binutils/22444 * readelf.c (process_notes_at): Use ELF_NOTE_DESC_OFFSET to get the offset of the note descriptor. Use ELF_NOTE_NEXT_OFFSET to get the offset of the next note entry. include/ PR binutils/22444 * elf/external.h (ELF_ALIGN_UP): New. (ELF_NOTE_DESC_OFFSET): Likewise. (ELF_NOTE_NEXT_OFFSET): Likewise.
2017-11-23Avoid bogus compile time warning from clang by initialising local data ↵Pavel I. Kryukov
structure using memset. PR 22485 * readelf.c (process_archive): Use memset to initiaise thin_filedata structure.
2017-11-21Add a test for PR binutils/22451H.J. Lu
Check in the object file generated from the older assembler as a compressed file. PR binutils/22451 * testsuite/binutils-all/x86-64/objects.exp: New file. * testsuite/binutils-all/x86-64/pr22451.o.bz2: Likewise.
2017-11-21[ARC] [COMMITTED] Update test pattern patching.claziss
2017-11-21 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/binutils-all/arc/objdump.exp: Update pattern matching expression.
2017-11-21Add ability to follow dwo links to readelf/objdump.Nick Clifton
* dwarf.c (dwo_name, dwo_dir, dwo_id, dwo_id_len): New variables. (read_and_display_attr_value): Record dwo variables if requested. (display_augmentation_data): Rename to display_data and make generic. (load_dwo_file): New function. Loads a separate dwarf object file. (load_separate_debug_file): Add reporting and loading of separate dwarf objet files. * readelf.c (process_section_headers): Add do_debug_links to list of flags requiring a debug dump. (display_debug_section): Tidy up code. * doc/debug.options.texi: Add note that dwo links will also be followed. * testsuite/binutils-all/debuglink.s: Tidy code. * testsuite/binutils-all/dwo.s: New test file. * testsuite/binutils-all/readelf.wk2: New file - expected output from readelf. * testsuite/binutils-all/readelf.exp: Run the new test.
2017-11-19PR22443, Global buffer overflow in _bfd_elf_get_symbol_version_stringAlan Modra
Symbols like *ABS* defined in bfd/section.c:global_syms are not elf_symbol_type. They can appear on relocs and perhaps other places in an ELF bfd, so a number of places in nm.c and objdump.c are wrong to cast an asymbol based on the bfd being ELF. I think we lose nothing by excluding all section symbols, not just the global_syms. PR 22443 * nm.c (sort_symbols_by_size): Don't attempt to access section symbol internal_elf_sym. (print_symbol): Likewise. Don't call bfd_get_symbol_version_string for section symbols. * objdump.c (compare_symbols): Don't attempt to access section symbol internal_elf_sym. (objdump_print_symname): Don't call bfd_get_symbol_version_string for section symbols.
2017-11-17Finish fixing riscv gas lns-common-1 failure, and lns-duplicate.Jim Wilson
binutils/ * readelf.c (elf/riscv.h): Alphabetize include. (is_32bit_inplace_add_reloc, is_32bit_inplace_sub_reloc) (is_64bit_inplace_add_reloc, is_64bit_inplace_sub_reloc) (is_16bit_inplace_add_reloc, is_16bit_inplace_sub_reloc) (is_8bit_inplace_add_reloc, is_8bit_inplace_sub_reloc): New. (apply_relocations): New locals reloc_inplace and reloc_subtract. Call the new functions and set the new locals. Call byte_get if reloc_inplace. Subtract sym->st_value if reloc_subtract.
2017-11-17Fix a memory leak when processing archives.Nick Clifton
PR 22449 * ar.c (write_archive): Free the temporary file name.
2017-11-17Fix a snafu in a previous update to readelf that stopped it from printing ↵Nick Clifton
archive member names along with the archive file name. -- This patch causes problems for glibc linknamespace tests because of how it changes the output format of readelf on .a files. Previously, "readelf -W -s libc.a" would produce output starting e.g.: File: /scratch/jmyers/glibc/many8/build/glibcs/x86_64-linux-gnu/glibc/libc.a(init-first.o) Symbol table '.symtab' contains 30 entries: and continuing with symbol information for each object in that .a file. After this commit, instead it starts: File: /scratch/jmyers/glibc/many8/build/glibcs/x86_64-linux-gnu/glibc/libc.a Symbol table '.symtab' contains 30 entries: and every object's symbol information starts with the same File: line, missing any information about which object's symbols (within libc.a) are being listed. I think the previous File: lines that said libc.a(init-first.o) etc., identifying the particular object within libc.a, were clearly preferable, and the glibc linknamespace tests rely on having that information about the individual object within libc.a. -- binutils * readelf.c (process_archive): Include member name in the file_name of the filedata structure.
2017-11-15objcopy memory leakAlan Modra
PR 22426 * objcopy.c (copy_main): Free tmpname.
2017-11-15Add support to readelf and objdump for following links to separate debug ↵Nick Clifton
information files. Hi Guys, I am applying the rather large patch attached to this email to enhance the readelf and objdump programs so that they now have the ability to follow links to separate debug info files. (As requested by PR 15152). So for example whereas before we had this output: $ readelf -wi main.exe Contents of the .debug_info section: [...] <15> DW_AT_comp_dir : (alt indirect string, offset: 0x30c) [...] With the new option enabled we get: $ readelf -wiK main.exe main.exe: Found separate debug info file: dwz.debug Contents of the .debug_info section (loaded from main.exe): [...] <15> DW_AT_comp_dir : (alt indirect string, offset: 0x30c) /home/nickc/Downloads/dwzm [...] The link following feature also means that we can get two lots of output if the same section exists in both the main file and the separate debug info file: $ readelf -wiK main.exe main.exe: Found separate debug info file: dwz.debug Contents of the .debug_info section (loaded from main.exe): [...] Contents of the .debug_info section (loaded from dwz.debug): [...] The patch also adds the ability to display the contents of debuglink sections: $ readelf -wk main.exe Contents of the .gnu_debugaltlink section: Separate debug info file: dwz.debug Build-ID (0x14 bytes): c4 a8 89 8d 64 cf 70 8a 35 68 21 f2 ed 24 45 3e 18 7a 7a 93 Naturally there are long versions of these options (=follow-links and =links). The documentation has been updated as well, and since both readelf and objdump use the same set of debug display options, I have moved the text into a separate file. There are also a couple of new binutils tests to exercise the new behaviour. There are a couple of missing features in the current patch however, although I do intend to address them in follow up submissions: Firstly the code does not check the build-id inside separate debug info files when it is searching for a file specified by a .gnu_debugaltlink section. It just assumes that if the file is there, then it contains the information being sought. Secondly I have not checked the DWARF-5 version of these link features, so there will probably be code to add there. Thirdly I have only implemented link following for the DW_FORM_GNU_strp_alt format. Other alternate formats (eg DW_FORM_GNU_ref_alt) have yet to be implemented. Lastly, whilst implementing this feature I found it necessary to move some of the global variables used by readelf (eg section_headers) into a structure that can be passed around. I have moved all of the global variables that were necessary to get the patch working, but I need to complete the operation and move the remaining, file-specific variables (eg dynamic_strings). Cheers Nick binutils PR 15152 * dwarf.h (enum dwarf_section_display_enum): Add gnu_debuglink, gnu_debugaltlink and separate_debug_str. (struct dwarf_section): Add filename field. Add prototypes for load_separate_debug_file, close_debug_file and open_debug_file. * dwarf.c (do_debug_links): New. (do_follow_links): New. (separate_debug_file, separate_debug_filename): New. (fetch_alt_indirect_string): New function. Retrieves a string from the debug string table in the separate debug info file. (read_and_display_attr_value): Use it with DW_FORM_GNU_strp_alt. (load_debug_section_with_follow): New function. Like load_debug_section, but if the first attempt fails, then tries again in the separate debug info file. (introduce): New function. (process_debug_info): Use load_debug_section_with_follow and introduce. (load_debug_info): Likewise. (display_debug_lines_raw): Likewise. (display_debug_lines_decoded): Likewise. (display_debug_macinfo): Likewise. (display_debug_macro): Likewise. (display_debug_abbrev): Likewise. (display_debug_loc): Likewise. (display_debug_str): Likewise. (display_debug_aranges): Likewise. (display_debug_addr); Likewise. (display_debug_frames): Likewise. (display_gdb_index): Likewise. (process_cu_tu_index): Likewise. (load_cu_tu_indexes): Likewise. (display_debug_links): New function. Displays the contents of a .gnu_debuglink or .gnu_debugaltlink section. (calc_gnu_debuglink_ctc32):New function. Calculates a CRC32 value. (check_gnu_debuglink): New function. Checks the CRC of a potential separate debug info file. (parse_gnu_debuglink): New function. Reads a CRC value out of a .gnu_debuglink section. (check_gnu_debugaltlink): New function. (parse_gnu_debugaltlink): New function. Reads the build-id value out of a .gnu_debugaltlink section. (load_separate_debug_info): New function. Finds and loads a separate debug info file. (load_separate_debug_file): New function. Attempts to find and follow a link to a separate debug info file. (free_debug_memory): Free the separate debug info file information. (opts_table): Add "follow-links" and "links". (dwarf_select_sections_by_letters): Add "k" and "K". (debug_displays): Reformat. Add .gnu-debuglink and .gnu_debugaltlink. Add an extra entry for .debug_str in a separate debug info file. * doc/binutils.texi: Move description of debug dump features common to both readelf and objdump into... * objdump.c (usage): Add -Wk and -WK. (load_specific_debug_section): Initialise the filename field in the dwarf_section structure. (close_debug_file): New function. (open_debug_file): New function. (dump_dwarf): Load and dump the separate debug info sections. * readelf.c (struct filedata): New structure. Contains various variables that used to be global: (current_file_size, string_table, string_table_length, elf_header) (section_headers, program_headers, dump_sects, num_dump_sects): Move into filedata structure. (cmdline): New global variable. Contains list of sections to dump by number, as specified on the command line. Add filedata parameter to most functions. (load_debug_section): Load the string table if it has not already been retrieved. (close_file): New function. (close_debug_file): New function. (open_file): New function. (open_debug_file): New function. (process_object): Process sections in any separate debug info files. * doc/debug.options.texi: New file. Add description of =links and =follow-links options. * NEWS: Mention the new feature. * elfcomm.c: Have the byte gte functions take a const pointer. * elfcomm.h: Update prototypes. * testsuite/binutils-all/dw5.W: Update expected output. * testsuite/binutils-all/objdump.WL: Update expected output. * testsuite/binutils-all/objdump.exp: Add test of -WK and -Wk. * testsuite/binutils-all/readelf.exp: Add test of -wK and -wk. * testsuite/binutils-all/readelf.k: New file. * testsuite/binutils-all/objdump.Wk: New file. * testsuite/binutils-all/objdump.WK2: New file. * testsuite/binutils-all/linkdebug.s: New file. * testsuite/binutils-all/debuglink.s: New file. gas * testsuite/gas/avr/large-debug-line-table.d: Update expected output. * testsuite/gas/elf/dwarf2-11.d: Likewise. * testsuite/gas/elf/dwarf2-12.d: Likewise. * testsuite/gas/elf/dwarf2-13.d: Likewise. * testsuite/gas/elf/dwarf2-14.d: Likewise. * testsuite/gas/elf/dwarf2-15.d: Likewise. * testsuite/gas/elf/dwarf2-16.d: Likewise. * testsuite/gas/elf/dwarf2-17.d: Likewise. * testsuite/gas/elf/dwarf2-18.d: Likewise. * testsuite/gas/elf/dwarf2-5.d: Likewise. * testsuite/gas/elf/dwarf2-6.d: Likewise. * testsuite/gas/elf/dwarf2-7.d: Likewise. ld * testsuite/ld-avr/gc-section-debugline.d: Update expected output.
2017-11-10Fix riscv binutils xfail for debug_ranges test.Jim Wilson
binutils/ * testsuite/binutils-all/objdump.exp: Expect the debug_ranges test to pass.
2017-11-07Fix typo in my email address.Jim Wilson
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 Dabbelt
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 Modra
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 Modra
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 printingclaziss
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 Clifton
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 Cho
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 Bowman
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 Clifton
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 Clifton
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 Modra
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 Marchi
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 Modra
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 Botcazou
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 Clifton
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 Clifton
* MAINTAINERS: Move Svein Seldal to Past Maintainers section.
2017-10-18PR22303, print_core_note out of bounds readAlan Modra
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.