Commit Graph

3131 Commits

Author SHA1 Message Date
Maciej W. Rozycki 1ea332d693 binutils/doc: Fix a "using" typo in `objcopy --rename-section' description
binutils/
	* doc/binutils.texi (objcopy): Fix a typo in `--rename-section'
	option description.
2018-01-22 21:08:26 +00:00
Maciej W. Rozycki d65ce302ab MAINTAINERS: Update my company e-mail address
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-22 15:39:18 +00:00
Nick Clifton f433138f1f Update Swedish translation for the binutils sub-directory 2018-01-22 13:48:15 +00:00
Nick Clifton 7ab8203798 Update Bulgarian translation of the binutils sub-directory 2018-01-18 09:38:59 +00:00
Joel Brobecker 0dd86f32bc binutils release procedure: Add AI to update branch name in crontab
binutils/ChangeLog:

        * README-how-to-make-a-release: Add reminder to update the
        branch name in gdbadmin's crontab on sourceware.
2018-01-16 14:19:37 +01:00
Nick Clifton f6efed019b Update translations for various binutils components.
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-16 12:45:44 +00:00
Joel Brobecker a960d29fb7 Remove trailing spaces in binutils/README-how-to-make-a-release
binutils/ChangeLog:

        * README-how-to-make-a-release: Remove trailing spaces.
2018-01-16 12:20:01 +01:00
Nick Clifton 616dcb87ab Update Ukranian translations for bfd, binutils, gas, gold, ld and opcodes 2018-01-15 12:09:11 +00:00
Nick Clifton 19e2900bd3 Update notes on how to make a release 2018-01-13 14:29:27 +00:00
Nick Clifton 3957a4963f Update pot files 2018-01-13 13:56:48 +00:00
Nick Clifton 769c7ea507 Bump version number to 2.30.51
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-13 13:31:12 +00:00
Nick Clifton faf766e317 Add note about 2.30 branch creation to changelogs 2018-01-13 13:26:38 +00:00
Nick Clifton 9176ac5bfc Add 2.30 markers to NEWS files.
binutils/
	* NEWS: Add marker for 2.30.

gas/
	* NEWS: Add marker for 2.30.

ld/
	* NEWS: Add marker for 2.30.
2018-01-13 13:20:55 +00:00
Nick Clifton 98ab9e9603 Add notes on how to make a branch and a pre-release snapshot.
* 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-12 17:52:38 +00:00
Nick Clifton bf41f30dde Update top level configure files by synchronizing them with gcc.
.	* 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-10 15:29:21 +00:00
Nick Clifton f13974bda3 Fix compile time warning introduced by previous delta.
* objcopy.c (merge_gnu_build_notes): Add cast to maximum address
	constants.
2018-01-03 17:32:59 +00:00
Nick Clifton 6f156d7a4a Add support for v3 binary annotation notes.
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-03 10:30:07 +00:00
Alan Modra 219d1afa89 Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
Alan Modra 1e56386871 ChangeLog rotation 2018-01-03 17:49:42 +10:30
Nick Clifton bef7475fbd Stop readelf from complaining about relocation sections with an sh_info 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-19 09:48:40 +00:00
Alan Modra f795c49463 Test binutils_assemble return value
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-19 06:51:33 +10:30
Nick Clifton c54207d326 Decode expression lists used with DW_AT_byte_size and other DWARF attributes.
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-18 17:57:18 +00:00
Alan Modra 4baeffab22 binutils nm testsuite tidy
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-14 22:29:42 +10:30
Renlin Li 4c5ae11b42 [Binutils][Objdump]Check symbol section information while search a mapping 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-11 15:42:47 +00:00
Nick Clifton 2d054e6bfd Fix stripping relocs in a file with mergeable notes.
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-08 10:07:14 +00:00
Jim Wilson 1c9c7ce078 Objcopy interleave fails if section address not multiple of interleave.
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-06 10:34:36 -08:00
Alan Modra 9c1ce10850 PR22552, readelf heap buffer overflow in load_debug_section
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-06 18:05:18 +10:30
Oleksandr Pikozh 0fbdde9429 Add --strip-unneeded to objcopy synopsis
* doc/binutils.texi: Add --strip-unneeded to objcopy synopsis.
2017-12-01 19:08:42 +10:30
Nick Clifton f425ec6600 Prevent an illegal memory access in readelf when attempting to parse a corrupt ELF file.
PR 22510
	* readelf.c (load_debug_section): Fail if there are no section
	headers available.
2017-11-30 10:25:01 +00:00
Nick Clifton d785b7d4b8 Stop objdump from attempting to allocate a huge chunk of memory when parsing 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-29 12:40:43 +00:00
Stefan Stroe ca39c2f4dd Support --localedir, --datarootdir and --datadir
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-29 20:10:52 +10:30
H.J. Lu 82ed9683ec Properly handle note sections and segments
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-28 08:18:46 -08:00
Nick Clifton 4dff97b2ce Fix a seg-fault when displaying notes from a prorgam segment. Check for a 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-27 11:05:39 +00:00
H.J. Lu 2b63c337d9 Rename argument name from link to xlink
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-26 10:12:35 -08:00
H.J. Lu 276da9b31b Re-apply "elf: Properly compute offsets of note descriptor and next note"
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-24 14:52:15 -08:00
Simon Marchi 4e25ac038e Revert "elf: Properly compute offsets of note descriptor and next note"
This reverts commit 650444eb54.

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-24 15:43:51 -05:00
H.J. Lu 650444eb54 elf: Properly compute offsets of note descriptor and next note
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-24 06:41:52 -08:00
Pavel I. Kryukov eb02c04dc3 Avoid bogus compile time warning from clang by initialising local data structure using memset.
PR 22485
	* readelf.c (process_archive): Use memset to initiaise
	thin_filedata structure.
2017-11-23 15:53:04 +00:00
H.J. Lu d6251545e2 Add a test for PR binutils/22451
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 13:41:51 -08:00
claziss bd560f571f [ARC] [COMMITTED] Update test pattern patching.
2017-11-21  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/binutils-all/arc/objdump.exp: Update pattern matching
	expression.
2017-11-21 15:04:22 +01:00
Nick Clifton d85bf2ba86 Add ability to follow dwo links to readelf/objdump.
* 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-21 13:12:04 +00:00
Alan Modra 160b1a618a PR22443, Global buffer overflow in _bfd_elf_get_symbol_version_string
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-19 07:41:17 +10:30
Jim Wilson 033366417d Finish fixing riscv gas lns-common-1 failure, and lns-duplicate.
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-17 14:47:52 -08:00
Nick Clifton 3cfd3dd095 Fix a memory leak when processing archives.
PR 22449
	* ar.c (write_archive): Free the temporary file name.
2017-11-17 12:46:07 +00:00
Nick Clifton 6a6196fc71 Fix a snafu in a previous update to readelf that stopped it from printing 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-17 12:05:34 +00:00
Alan Modra be74fad95e objcopy memory leak
PR 22426
	* objcopy.c (copy_main): Free tmpname.
2017-11-15 22:30:27 +10:30
Nick Clifton dda8d76d0d Add support to readelf and objdump for following links to separate debug 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-15 11:34:03 +00:00
Jim Wilson f617a0f6ce Fix riscv binutils xfail for debug_ranges test.
binutils/
	* testsuite/binutils-all/objdump.exp: Expect the debug_ranges test to
	pass.
2017-11-10 19:24:45 -08:00
Jim Wilson 016f5a3777 Fix typo in my email address.
binutils/
	* MAINTAINERS (RISC-V): Fix typo in my email address.
2017-11-07 09:43:18 -08:00
Palmer Dabbelt 180093c763 RISC-V: Add Jim Wilson as a maintainer, and clean up our entries
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-07 09:22:04 -08:00