aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2018-02-13PR22836, "-r -s" doesn't work with -g3 using GCC 7Alan Modra6-0/+61
This fixes the case where all of a group is removed with ld -r, the situation in the PR, and failures where part of a group is removed that contain relocs. bfd/ PR 22836 * elf.c (_bfd_elf_fixup_group_sections): Account for removed relocation sections. If size reduces to just the flag word, remove that too and mark with SEC_EXCLUDE. * elflink.c (bfd_elf_final_link): Strip empty group sections. binutils/ * testsuite/binutils-all/group-7.s, * testsuite/binutils-all/group-7a.d, * testsuite/binutils-all/group-7b.d, * testsuite/binutils-all/group-7c.d: New tests. * testsuite/binutils-all/objcopy.exp: Run them. ld/ * testsuite/ld-elf/pr22836-2.d, * testsuite/ld-elf/pr22836-2.s: New test.
2018-02-08Speed up readelf and objdump by not looking for DWO links unless the user ↵Nick Clifton2-0/+12
has requested that they be displayed/followed. PR 22802 * dwarf.c (load_separate_debug_file): Return early if the user is not interested in debug links.
2018-02-06Replace reachable assertion with a test and return of NULL.Nick Clifton2-1/+21
PR 22793 * readelf.c (find_section): Replace assertion with test and return of NULL. (find_section_by_address): Add test of section header table existance. (find_section_by_type): Likewise. (find_section_in_set): Likewise.
2018-02-05MIPS/BFD: Correctly report unsupported `.reginfo' section sizeMaciej W. Rozycki5-0/+27
Report an error when an unsupported `.reginfo' section size is found in `_bfd_mips_elf_section_processing', removing an assertion that triggers at elfxx-mips.c:7105 in GAS when assembling input like: .section .reginfo .word 0xdeadbeef and in `objcopy --rename-section' when renaming an incorrectly sized section to `.reginfo'. bfd/ * elfxx-mips.c (_bfd_mips_elf_section_processing): For SHT_MIPS_REGINFO sections don't assert the correct size and report an error instead. binutils/ * testsuite/binutils-all/mips/mips-reginfo.d: New test. * testsuite/binutils-all/mips/mips-reginfo-n32.d: New test. * testsuite/binutils-all/mips/mips-reginfo.s: New test source. * testsuite/binutils-all/mips/mips.exp: Run the new tests. gas/ * testsuite/gas/mips/reginfo-2.d: New test. * testsuite/gas/mips/reginfo-2-n32.d: New test. * testsuite/gas/mips/reginfo-2.l: New test stderr output. * testsuite/gas/mips/reginfo-2.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests.
2018-02-05binutils/testsuite: Support stderr options with `run_dump_test'Maciej W. Rozycki3-43/+157
Add support for the `error', `error_output', `warning' and `warning_output' options for `run_dump_test' input files, based on the version of the procedure in ld/testsuite/lib/ld-lib.exp and providing compatible semantics. These options apply to PROG under test and let test cases specify output expected on stderr as well as express a requirement for PROG to exit unsuccessfully. Messages to match against can be supplied either inline or fetched from a named file. Update procedure description in the introductory comment accordingly. As the exit status from `remote_exec' is regrettably lost in our default implementation of `binutils_run', which is user-overridable, avoid changing this procedure's API and use a global `binutils_run_status' variable to pass the status up to the caller, similarly to how `binutils_run_failed' is handled. Document the new variable in the respective introductory comments. binutils/ * testsuite/config/default.exp (binutils_run): Document `binutils_run_status'. * testsuite/lib/utils-lib.exp (default_binutils_run): Likewise, and set it. (run_dump_test): Add `error', `error_output', `warning' and `warning_output' options. Update documentation accordingly.
2018-02-02binutils/riscv: Register names in DWARF outputAndrew Burgess4-0/+40
Adds a register name table for RiscV so that objdump and readelf can both use better register names. binutils/ChangeLog: * dwarf.c (dwarf_regnames_riscv): New register name table. (init_dwarf_regnames_riscv): New function. (init_dwarf_regnames): Add call to initialise RiscV register names. * dwarf.h (init_dwarf_regnames_riscv): Declare. * objdump.c (dump_dwarf): Add call to initialise RiscV register names.
2018-02-01PR22769, crash when running 32-bit objdump on corrupted fileAlan Modra2-2/+11
PR 22769 * objdump.c (load_specific_debug_section): Check for overflow when adding one to section size for a string section terminator.
2018-01-30Update description of nm's symbol bss type letters.Nick Clifton2-2/+12
PR 22734 * doc/binutils.texi (nm): Update description to point out that zero-initialized values can also be shown as type B, b, S or s since they can be stored in the BSS section.
2018-01-3032-bit objcopy build failAlan Modra2-2/+7
* objcopy.c (merge_gnu_build_notes): Use (bfd_vma) -1 as "artificially large" end address.
2018-01-28Update release notes with a reminder to check the gpg key being used.Nick Clifton2-2/+13
* README-how-to-make-a-release: Add note about checking gpg key and the results of gnupload.
2018-01-27Update documentation on making a releaseNick Clifton2-4/+100
2018-01-26Update notes on making a releaseNick Clifton2-24/+46
2018-01-22binutils/doc: Fix a "using" typo in `objcopy --rename-section' descriptionMaciej W. Rozycki2-1/+6
binutils/ * doc/binutils.texi (objcopy): Fix a typo in `--rename-section' option description.
2018-01-22MAINTAINERS: Update my company e-mail addressMaciej W. Rozycki2-1/+5
Following my recent transition from Imagination Technologies to the reincarnated MIPS company update MAINTAINERS entries accordingly. binutils/ * MAINTAINERS: Update my company e-mail address. gdb/ * MAINTAINERS: Update my company e-mail address. sim/ * MAINTAINERS: Update my company e-mail address.
2018-01-22Update Swedish translation for the binutils sub-directoryNick Clifton2-1640/+2082
2018-01-18Update Bulgarian translation of the binutils sub-directoryNick Clifton3-1606/+2057
2018-01-16binutils release procedure: Add AI to update branch name in crontabJoel Brobecker2-6/+24
binutils/ChangeLog: * README-how-to-make-a-release: Add reminder to update the branch name in gdbadmin's crontab on sourceware.
2018-01-16Update translations for various binutils components.Nick Clifton2-1652/+2167
ld * po/pt_BR.po: Updated Brazilian Portugese translation. opcodes * po/pt_BR.po: Updated Brazilian Portugese translation. * po/de.po: Updated German translation. gas * po/fr.po: Updated French translation. binutils* po/fr.po: Updated French translation.
2018-01-16Remove trailing spaces in binutils/README-how-to-make-a-releaseJoel Brobecker2-15/+19
binutils/ChangeLog: * README-how-to-make-a-release: Remove trailing spaces.
2018-01-15Update Ukranian translations for bfd, binutils, gas, gold, ld and opcodesNick Clifton2-1644/+2262
2018-01-13Update notes on how to make a releaseNick Clifton2-12/+10
2018-01-13Update pot filesNick Clifton2-1562/+1976
2018-01-13Bump version number to 2.30.51Nick Clifton3-10/+15
bfd/ * version.m4: Bump version to 2.30.51 * configure: Regenerate. binutils/ * configure: Regenerate. gas/ * configure: Regenerate. gprof/ * configure: Regenerate. ld/ * configure: Regenerate. opcodes/ * configure: Regenerate.
2018-01-13Add note about 2.30 branch creation to changelogsNick Clifton2-0/+2
2018-01-13Add 2.30 markers to NEWS files.Nick Clifton4-3/+14
binutils/ * NEWS: Add marker for 2.30. gas/ * NEWS: Add marker for 2.30. ld/ * NEWS: Add marker for 2.30.
2018-01-12Add notes on how to make a branch and a pre-release snapshot.Nick Clifton3-0/+80
* README-how-to-make-a-release: Add notes on how to make the branch and prelease snapshot. * BRANCHES: Add binutils-2_29-branch.
2018-01-10Update top level configure files by synchronizing them with gcc.Nick Clifton2-1/+10
. * config-ml.in: Sync with gcc sources. * config.guess: Likewise. * config.sub: Likewise. * configure.ac: Likewise. * configure: Regenerate. config * Sync with GCC sources: 2017-11-14 Boris Kolpackov <boris@codesynthesis.com> * gcc-plugin.m4: Add support for MinGW. 2017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com> * cet.m4: New file. 2017-11-15 Alexandre Oliva <aoliva@redhat.com> * bootstrap-debug-lean.mk (do-compare): Use the contrib/compare-debug script. 2017-10-24 H.J. Lu <hongjiu.lu@intel.com> * bootstrap-cet.mk: New file. 2017-06-19 Martin Liska <mliska@suse.cz> * bootstrap-lto-noplugin.mk: Enable -flto in all PGO stages. * bootstrap-lto.mk: Likewise. 2017-06-03 Eric Botcazou <ebotcazou@adacore.com> * mt-android: New file. 2017-02-13 Richard Biener <rguenther@suse.de> * isl.m4: Remove support for ISL 0.14. 2017-01-19 Uros Bizjak <ubizjak@gmail.com> PR target/78478 * ax_check_define.m4: New file. 2017-01-17 Jakub Jelinek <jakub@redhat.com> PR other/79046 * acx.m4 (GCC_BASE_VER): New m4 function. (ACX_TOOL_DIRS): Require GCC_BASE_VER, for --with-gcc-major-version-only use just major number from BASE-VER. 2017-01-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> PR go/78978 * hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): New macro.
2018-01-03Fix compile time warning introduced by previous delta.Nick Clifton2-2/+7
* objcopy.c (merge_gnu_build_notes): Add cast to maximum address constants.
2018-01-03Add support for v3 binary annotation notes.Nick Clifton19-278/+741
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 Modra141-141/+145
2018-01-03ChangeLog rotationAlan Modra2-1874/+1888
2017-12-19Stop readelf from complaining about relocation sections with an sh_info ↵Nick Clifton2-5/+15
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 Modra12-290/+323
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 Clifton2-0/+23
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 Modra3-26/+23
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 Li3-0/+33
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 Clifton3-8/+29
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 Wilson2-0/+18
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 Modra2-6/+17
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 Pikozh2-0/+5
* doc/binutils.texi: Add --strip-unneeded to objcopy synopsis.
2017-11-30Prevent an illegal memory access in readelf when attempting to parse a ↵Nick Clifton2-0/+10
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 Clifton2-1/+17
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 Stroe2-4/+10
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. Lu2-16/+39
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 Clifton2-11/+29
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. Lu2-3/+8
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. Lu2-2/+13
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 Marchi2-13/+2
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. Lu2-2/+13
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. Kryukov2-1/+9
structure using memset. PR 22485 * readelf.c (process_archive): Use memset to initiaise thin_filedata structure.