Commit Graph

3600 Commits

Author SHA1 Message Date
Kamil Rytarowski 06d949ec31 Implement NT_NETBSDCORE_LWPSTATUS (NetBSD-Core)
bfd/ChangeLog:

	* elf.c (elfcore_grok_netbsd_note): Add support for
	NT_NETBSDCORE_LWPSTATUS notes.

binutils/ChangeLog:

	* readelf.c (get_netbsd_elfcore_note_type): Add support for
	NT_NETBSDCORE_LWPSTATUS notes.

include/ChangeLog:

	* elf/common.h (NT_NETBSDCORE_LWPSTATUS): New define.
2020-03-14 00:31:16 +01:00
Alan Modra fd486f32d1 asan: more readelf leaks
* elfcomm.c (get_archive_member_name): Always return malloc'd
	string or NULL.
	* elfedit.c (process_archive): Tidy memory on all return paths.
	* readelf.c (process_archive): Likewise.
	(process_symbol_table): Likewise.
	(ba_cache): New, replacing ..
	(get_symbol_for_build_attribute): ..static vars here.  Free
	strtab and symtab before loading new ones.  Reject symtab without
	valid strtab in loop, breaking out of loop on valid symtab.
	(process_file): Free ba_cache symtab and strtab here, resetting
	ba_cache.
2020-03-13 14:26:24 +10:30
Alan Modra 8fb879cd16 asan: readelf leaks
* readelf.c (process_section_headers): Don't just set
	filedata->section_headers NULL, free it first.  Similarly for
	dynamic_symbols, dynamic_strings, dynamic_syminfo and
	symtab_shndx_list.  Zero associated counts too.
	(process_object): Free symtab_shndx_list.
	(process_file): Free various allocated filedata tables.
2020-03-12 17:00:40 +10:30
Nick Clifton 5496f3c635 Add support for generating DWARF-5 format directory and file name tables from the assembler.
PR 25611
	PR 25614
	* dwarf.h (DWARF2_Internal_LineInfo): Add li_address_size and
	li_segment_size fields.
	* dwarf.c (read_debug_line_header): Record the address size and
	segment selector size values (if present) in the lineinfo
	structure.
	(display_formatted_table): Warn if the format count is empty but
	the table itself is not empty.
	Display the format count and entry count at the start of the table
	dump.
	(display_debug_lines_raw): Display the address size and segement
	selector size fields, if present.
	* testsuite/binutils-all/dw5.W: Update expected output.

gas	* dwarf2dbg.c (DWARF2_FILE_TIME_NAME): Default to -1.
	(DWARF2_FILE_SIZE_NAME): Default to -1.
	(DWARF2_LINE_VERSION): Default to the current dwarf level or 3,
	whichever is higher.
	(DWARF2_LINE_MAX_OPS_PER_INSN): Provide a default value of 1.
	(NUM_MD5_BYTES): Define.
	(struct file entry): Add md5 field.
	(get_filenum): Delete and replace with...
	(get_basename): New function.
	(get_directory_table_entry): New function.
	(allocate_filenum): New function.
	(allocate_filename_to_slot): New function.
	(dwarf2_where): Use new functions.
	(dwarf2_directive_filename): Add support for extended .file
	pseudo-op.
	(dwarf2_directive_loc): Allow the use of file number zero with
	DWARF 5 or higher.
	(out_file_list): Rename to...
	(out_dir_and_file_list): Add DWARF 5 support.
	(out_debug_line): Emit extra values into the section header for
	DWARF 5.
	(out_debug_str): Allow for file 0 to be used with DWARF 5.
	* doc/as.texi (.file): Update the description of this pseudo-op.
	* testsuite/gas/elf-dwarf-5-file0.s: Add more lines.
	* testsuite/gas/elf-dwarf-5-file0.d: Update expected dump output.
	* testsuite/gas/lns/lns-diag-1.l: Update expected error message.
	* NEWS: Mention the new feature.
2020-03-11 10:17:14 +00:00
Alan Modra 9cc89dc0ac PR25651, objcopy SIGSEGV in copy_object
With the right set of options, the second block of code dealing with
padding can see a different section count.  So don't use the new count.
Since I was editing those lines, I've also changed the code allocating
arrays a little.
    array = malloc (n * sizeof (*array));
for an array of ints is just better than
    array = malloc (n * sizeof (int));
It's easier to write correctly in the first place and more robust
against code changes that might modify the array element type.

	PR 25651
	* objcopy.c (copy_object): Test "gaps" not gap_fill_set or
	pad_to_set on second block of code dealing with padding.
	Replace "c" with "num_sec" and don't recalculate number of
	sections on second block.  Size arrays using sizeof (element)
	rather than sizeof (element type).
2020-03-11 15:01:15 +10:30
Alan Modra 41da082238 objdump disassembly of files without symbols
ubsan complains about memcpy with a NULL src even when size is zero.

	* objdump.c (disassemble_section): Don't call qsort unless
	sym count is at least two.
	(disassemble_data): Don't call memcpy with NULL src.
2020-03-10 13:54:01 +10:30
Alan Modra 9509988993 PR25645, readelf segfault reading fuzzed alpha-vms binary
PR 25645
	* readelf.c (dump_ia64_vms_dynamic_fixups): Pass size and nmemb
	to get_data rather than multiplying.
	(dump_ia64_vms_dynamic_relocs): Likewise.
	(process_version_sections): Correct order of size and nmemb args
	in get_data call.
	(process_mips_specific): Likewise.
2020-03-09 21:38:48 +10:30
H.J. Lu a15de1f599 readelf.c: Fix a typo in comments
* readelf.c (get_dynamic_data): Replace "memory chekers" with
	"memory checkers" in comments.
2020-03-08 18:43:42 -07:00
Simon Marchi 9979ab6663 binutils: doc: move artifacts back to MAINTAINERCLEANFILES
In commit 2b44a6a237 (" binutils: doc: make `make clean` clean more
things"), I moved the doc build artifacts to MOSTLYCLEANFILES, which
made them get removed by "make clean".

Because generating binutils.info requires makeinfo, and we do not want
to require makeinfo when building from the tarball, binutils.info should
not get removed by "make clean" (otherwise, it won't be included in the
tarball).

And to be consistent with other projects (e.g. ld and gas), we also want
to ship the built man pages in the tarball.

This patch puts back all these in MAINTAINERCLEANFILES, so that they are
bundled in the tarball, and only cleaned if you use "make
maintainer-clean".

Tested by building a source release and confirming they are present.

binutils/ChangeLog:

	PR 25491
	* doc/Makefile.am: Rename MOSTLYCLEANFILES to MAINTAINERCLEANFILES.
	* doc/Makefile.in: Re-generate.
2020-03-06 22:06:34 -05:00
Nick Clifton a0dcf29705 Fix an abort triggered when objcopy is used to set the "share" section flag on an ELF section.
binutils* objcopy.c (check_new_section_flags): New function.  Reject the
	SEC_COFF_SHARED flag if the target is not a COFF binary.
	(copy_object): Call check_new_section_flags.
	(setup_section): Likewise.
	* doc/binutils.texi (objcopy): Add a note that the 'share' section
	flag cannot be applied to ELF binaries.

bfd	* elf.c (_bfd_elf_set_section_contents): Replace call to abort
	with error messages and failure return values.
2020-03-06 10:09:22 +00:00
Alan Modra a9b90127e8 PR25637, objcopy : SIGSEGV in copy_object
PR 25637
	* objcopy.c (filter_symbols): Correct rem_leading_char logic.
2020-03-06 10:34:19 +10:30
Alan Modra d1faf7ca0a PR25629, objcopy : SIGSEGV in filter_symbols
PR 25629
	* objcopy.c (filter_symbols): Don't segfault on NULL
	prefix_symbols_string.
2020-03-05 15:23:22 +10:30
Christian Eggers eef64366e1 objcopy: Fix for pr19005 on machines with more than one octet per byte.
On machines with more than one octet per byte, objcopy fills only a part
of the gap between sections.

	* objcopy.c (copy_object): Convert from bytes to octets for
	--gap-fill and --pad-to.
2020-03-04 10:59:30 +10:30
Nick Clifton 5be2b2f549 Remove a call to abort which can be triggered by running objdump on a corrupt input file.
PR 25625
	* prdbg.c (pr_tag_type): Remove call to abort.
2020-03-03 16:11:12 +00:00
Aaron Merey b312fea191 The procedure to find an unused port for the debuginfod tests is susceptible to a TOCTOU failure. Change port finding in order to avoid this. Also use 'expect' to interact with the server process since we now use the server's output to determine whether a port is in use.
* binutils/testsuite/binutils-all/debuginfod.exp: Improve port
	selection.
2020-03-02 12:46:47 +00:00
Nick Clifton ba3265d04c Restore readelf's string dump to previous behaviour where newlines were caused line breaks.
PR 25543
	* readelf.c (dump_section_as_strings): Display new-line characters
	as \n and then insert a line break.
	* testsuite/binutils-all/pr25543.s: New test.
	* testsuite/binutils-all/pr25543.d: Test driver.
	* testsuite/binutils-all/readelf.exp: Run the new test.
2020-03-02 10:02:02 +00:00
Nick Clifton 736990c442 Fix an illegal memory access by readelf when displaying the contents of a corrupt IA64 binary.
PR 25526
	* readelf.c (process_ia64_vms_dynamic_relocs): Check to see if
	get_data is unable to load the string table.
2020-02-27 16:28:25 +00:00
Alan Modra dc1e8a474f Indent labels
Labels don't go in the first column according to standard emacs C
indent rules, and I got annoyed enough at seeing diff -p show a label
rather than the function name to fix this.

bfd/
	* aoutx.h: Indent labels correctly.  Format error strings.
	* archive.c: Likewise.
	* archive64.c: Likewise.
	* coff-arm.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff-stgo32.c: Likewise.
	* cpu-arm.c: Likewise.
	* dwarf2.c: Likewise.
	* elf-ifunc.c: Likewise.
	* elf-properties.c: Likewise.
	* elf-s390-common.c: Likewise.
	* elf-strtab.c: Likewise.
	* elf.c: Likewise.
	* elf32-arm.c: Likewise.
	* elf32-bfin.c: Likewise.
	* elf32-cr16.c: Likewise.
	* elf32-csky.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-msp430.c: Likewise.
	* elf32-nds32.c: Likewise.
	* elf32-nios2.c: Likewise.
	* elf32-pru.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-ia64-vms.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elfcode.h: Likewise.
	* elfcore.h: Likewise.
	* elflink.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfnn-ia64.c: Likewise.
	* elfnn-riscv.c: Likewise.
	* elfxx-mips.c: Likewise.
	* elfxx-sparc.c: Likewise.
	* elfxx-x86.c: Likewise.
	* i386lynx.c: Likewise.
	* merge.c: Likewise.
	* pdp11.c: Likewise.
	* plugin.c: Likewise.
	* reloc.c: Likewise.
binutils/
	* elfedit.c: Indent labels correctly.
	* readelf.c: Likewise.
	* resres.c: Likewise.
gas/
	* config/obj-elf.c: Indent labels correctly.
	* config/obj-macho.c: Likewise.
	* config/tc-aarch64.c: Likewise.
	* config/tc-alpha.c: Likewise.
	* config/tc-arm.c: Likewise.
	* config/tc-cr16.c: Likewise.
	* config/tc-crx.c: Likewise.
	* config/tc-frv.c: Likewise.
	* config/tc-i386-intel.c: Likewise.
	* config/tc-i386.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-mn10200.c: Likewise.
	* config/tc-mn10300.c: Likewise.
	* config/tc-nds32.c: Likewise.
	* config/tc-riscv.c: Likewise.
	* config/tc-s12z.c: Likewise.
	* config/tc-xtensa.c: Likewise.
	* config/tc-z80.c: Likewise.
	* read.c: Likewise.
	* symbols.c: Likewise.
	* write.c: Likewise.
ld/
	* emultempl/cskyelf.em: Indent labels correctly.
	* ldfile.c: Likewise.
	* ldlang.c: Likewise.
	* plugin.c: Likewise.
opcodes/
	* aarch64-asm.c: Indent labels correctly.
	* aarch64-dis.c: Likewise.
	* aarch64-gen.c: Likewise.
	* aarch64-opc.c: Likewise.
	* alpha-dis.c: Likewise.
	* i386-dis.c: Likewise.
	* nds32-asm.c: Likewise.
	* nfp-dis.c: Likewise.
	* visium-dis.c: Likewise.
2020-02-26 10:37:25 +10:30
H.J. Lu ecda90163e Don't call lto-wrapper for ar and ranlib
Since ar and ranlib don't need to know symbol types to work properly,
we should avoid calling lto-wrapper for them to speed them up.

bfd/

	PR binutils/25584
	* plugin.c (need_lto_wrapper_p): New.
	(bfd_plugin_set_program_name): Add an int argument to set
	need_lto_wrapper_p.
	(get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't
	set.
	* plugin.h (bfd_plugin_set_program_name): Add an int argument.

binutils/

	PR binutils/25584
	* ar.c (main): Pass 0 to bfd_plugin_set_program_name.
	* nm.c (main): Pass 1 to bfd_plugin_set_program_name.
2020-02-25 03:31:40 -08:00
Nick Clifton 83d4d556e2 Fix a spelling mistake in the binutils documentation.
PR 25499
	* doc/binutils.texi (objdump): Fix typo in description of
	objdump's -g option.
2020-02-24 14:39:34 +00:00
Nelson Chu bd0cf5a6ba RISC-V: Support the ISA-dependent CSR checking.
According to the riscv privilege spec, some CSR are only valid when rv32 or
the specific extension is set.  We extend the DECLARE_CSR and DECLARE_CSR_ALIAS
to record more informaton we need, and then check whether the CSR is valid
according to these information.  We report warning message when the CSR is
invalid, so we have a choice between error and warning by --fatal-warnings
option.  Also, a --no-warn/-W option is used to turn the warnings off, if
people don't want the warnings.

	gas/
	* config/tc-riscv.c (enum riscv_csr_class): New enum.  Used to decide
	whether or not this CSR is legal in the current ISA string.
	(struct riscv_csr_extra): New structure to hold all extra information
	of CSR.
	(riscv_init_csr_hash): New function.  According to the DECLARE_CSR and
	DECLARE_CSR_ALIAS, insert CSR extra information into csr_extra_hash.
	Call hash_reg_name to insert CSR address into reg_names_hash.
	(md_begin): Call riscv_init_csr_hashes for each DECLARE_CSR.
	(reg_csr_lookup_internal, riscv_csr_class_check): New functions.
	Decide whether the CSR is valid according to the csr_extra_hash.
	(init_opcode_hash): Update 'if (hash_error != NULL)' as hash_error is
	not a boolean.  This is same as riscv_init_csr_hash, so keep the
	consistent usage.

	* testsuite/gas/riscv/csr-dw-regnums.d: Add -march=rv32if option.
	* testsuite/gas/riscv/priv-reg.d: Add f-ext by -march option.
	* testsuite/gas/riscv/priv-reg-fail-fext.d: New testcase.  The source
	file is `priv-reg.s`, and the ISA is rv32i without f-ext, so the
	f-ext CSR are not allowed.
	* testsuite/gas/riscv/priv-reg-fail-fext.l: Likewise.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.d: New testcase.  The
	source file is `priv-reg.s`, and the ISA is rv64if, so the
	rv32-only CSR are not allowed.
	* testsuite/gas/riscv/priv-reg-fail-rv32-only.l: Likewise.

	include/
	* opcode/riscv-opc.h: Extend DECLARE_CSR and DECLARE_CSR_ALIAS to
	record riscv_csr_class.

	opcodes/
	* riscv-dis.c (print_insn_args): Updated since the DECLARE_CSR is changed.

	gdb/
	* riscv-tdep.c: Updated since the DECLARE_CSR is changed.
	* riscv-tdep.h: Likewise.
	* features/riscv/rebuild-csr-xml.sh: Generate the 64bit-csr.xml without
	rv32-only CSR.
	* features/riscv/64bit-csr.xml: Regernated.

	binutils/
	* dwarf.c: Updated since the DECLARE_CSR is changed.
2020-02-20 16:49:09 -08:00
Eric Christopher 741cb83912 2020-02-19 Jordan Rupprecht <rupprecht@google.com>
* objdump.c (show_line): call bfd_demangle when using do_demangle.
2020-02-19 13:57:26 -08:00
Andrew Burgess 9f1528a1bd Merge changes from GCC for the config/ directory
GCC's config/ChangeLog since the last time this merge was done
(in the binutils-gdb commit 0b4d000cc4) is included at the
end of this commit message.

It is worth noting that the binutils-gdb commit 301a9420d9
added the file config/debuginfod.m4 which is not present in GCC's
config/ directory.  This file is preserved, unmodified, after this
commit.

In order to regenerate all of the configure files, I configured with
--enable-maintainer-mode, and built the 'all' target.  I then did the
same thing on a source tree without this patch, and only committed
those files that changed when this patch was added.

GCC's config/ChangeLog entries:

  2020-02-12  Sandra Loosemore  <sandra@codesourcery.com>

  	PR libstdc++/79193
  	PR libstdc++/88999

  	* no-executables.m4: Use a non-empty program to test for linker
  	support.

  2020-02-01  Andrew Burgess  <andrew.burgess@embecosm.com>

  	* lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Update shell syntax.

  2020-01-27  Andrew Burgess  <andrew.burgess@embecosm.com>

  	* lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Add new
  	--with-libXXX-type=... option.  Use this to guide the selection of
  	either a shared library or a static library.

  2020-01-24  Maciej W. Rozycki  <macro@wdc.com>

  	* toolexeclibdir.m4: New file.

  2019-09-10  Christophe Lyon  <christophe.lyon@st.com>

  	* futex.m4: Handle *-uclinux*.
  	* tls.m4 (GCC_CHECK_TLS): Likewise.

  2019-09-06  Florian Weimer  <fweimer@redhat.com>

  	* futex.m4 (GCC_LINUX_FUTEX): Include <unistd.h> for the syscall
  	function.

  2019-07-08  Richard Sandiford  <richard.sandiford@arm.com>

  	* bootstrap-Og.mk: New file.

  2019-06-25  Kwok Cheung Yeung  <kcy@codesourcery.com>
              Andrew Stubbs  <ams@codesourcery.com>

  	* gthr.m4 (GCC_AC_THREAD_HEADER): Add case for gcn.

  2019-05-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

  	* ax_count_cpus.m4: New file.

  2019-05-02  Richard Biener  <rguenther@suse.de>

  	PR bootstrap/85574
  	* bootstrap-lto.mk (extra-compare): Set to gcc/lto1$(exeext).

  2019-04-16  Martin Liska  <mliska@suse.cz>

  	* bootstrap-lto-lean.mk: Filter out -flto in STAGEtrain_CFLAGS.

  2019-04-09  Martin Liska  <mliska@suse.cz>

  	* bootstrap-lto-lean.mk: New file.

  2019-03-02  Johannes Pfau  <johannespfau@gmail.com>

  	* mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code.

  2018-10-31  Joseph Myers  <joseph@codesourcery.com>

  	PR bootstrap/82856
  	* math.m4, tls.m4: Use AC_LANG_SOURCE.

  	Merge from binutils-gdb:
  	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

  	* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.

config/ChangeLog:

	* ax_count_cpus.m4: New file, backported from GCC.
	* bootstrap-Og.mk: New file, backported from GCC.
	* bootstrap-lto-lean.mk: New file, backported from GCC.
	* bootstrap-lto.mk: Changes backported from GCC.
	* futex.m4: Changes backported from GCC.
	* gthr.m4: Changes backported from GCC.
	* lib-link.m4: Changes backported from GCC.
	* mh-mingw: Changes backported from GCC.
	* no-executables.m4: Changes backported from GCC.
	* tls.m4: Changes backported from GCC.
	* toolexeclibdir.m4: New file, backported from GCC.

binutils/ChangeLog:

	* configure: Regenerate.

gdb/ChangeLog:

	* configure: Regenerate.

gdbserver/ChangeLog:

	* configure: Regenerate.

gdbsupport/ChangeLog:

	* configure: Regenerate.

intl/ChangeLog:

	* configure: Regenerate.

libiberty/ChangeLog:

	* configure: Regenerate.

zlib/ChangeLog.bin-gdb:

	* configure: Regenerate.
2020-02-19 17:51:24 +00:00
Fangrui Song 3a5d12fbb4 Allow objcopy's --set-section-flags options to add or remove the SHF_EXCLUDE flag of ELF sections.
* objcopy.c (parse_flags): Handle "exclude".
	* doc/binutils.texi: Document the support.
2020-02-10 16:22:00 +00:00
Aaron Merey 46471187e4 More debuginfod tests fixes.
Start server before setting environment variable.
	Specify tmpdir as the location of the server's
	database.
	Check additional server metrics at start-up.
2020-02-10 15:24:57 +00:00
Aaron Merey 678d457fb7 Fix potential problem with binutils debuginfod tests.
* binutils/testsuite/binutils-all/debuginfod.exp:
	Replace set ::env with setenv.
2020-02-10 15:20:41 +00:00
Nick Clifton e8319fde71 Update release making notes.
* README-how-to-make-a-release: Add note about updating the
  GAS/NEWS URL in the next release.
2020-02-07 15:33:45 +00:00
Sergey Belyashov 9fc0b501af Add support for the GBZ80 and Z80N variants of the Z80 architecture, and add DWARF debug info support to the Z80 assembler.
PR 25469
bfd	* archures.c: Add GBZ80 and Z80N machine values.
	* reloc.c: Add BFD_RELOC_Z80_16_BE.
	* coff-z80.c: Add support for new reloc.
	* coffcode.h: Add support for new machine values.
	* cpu-z80.c: Add support for new machine names.
	* elf32-z80.c: Add support for new reloc.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.

binutils* readelf.c (get_machine_flags): Add support for Z80N machine
	number.

gas	* config/tc-z80.c: Add -gbz80 command line option to generate code
	for the GameBoy Z80.  Add support for generating DWARF.
	* config/tc-z80.h: Add support for DWARF debug information
	generation.
	* doc/c-z80.texi: Document new command line option.
	* testsuite/gas/z80/gbz80_all.d: New file.
	* testsuite/gas/z80/gbz80_all.s: New file.
	* testsuite/gas/z80/z80.exp: Run the new tests.
	* testsuite/gas/z80/z80n_all.d: New file.
	* testsuite/gas/z80/z80n_all.s: New file.
	* testsuite/gas/z80/z80n_reloc.d: New file.

include	* coff/internal.h (R_IMM16BE): Define.
	* elf/z80.h (EF_Z80_MACH_Z80N): Define.
	(R_Z80_16_BE): New reloc.

ld	* emulparams/elf32z80.sh: Use z80 emulation.
	* emultempl/z80.em: Make generic to both COFF and ELF Z80 emulations.
	* emultempl/z80elf.em: Delete.
	* testsuite/ld-elf/pr22450.d: Expect to fail for the Z80.
	* testsuite/ld-elf/sec64k.exp: Fix Z80 assembly.
	* testsuite/ld-unique/pr21529.s: Avoid register name conflict.
	* testsuite/ld-unique/unique.s: Likewise.
	* testsuite/ld-unique/unique_empty.s: Likewise.
	* testsuite/ld-unique/unique_shared.s: Likewise.
	* testsuite/ld-unique/unique.d: Updated expected output.
	* testsuite/ld-z80/arch_z80n.d: New file.
	* testsuite/ld-z80/comb_arch_z80_z80n.d: New file.
	* testsuite/ld-z80/labels.s: Add more labels.
	* testsuite/ld-z80/relocs.s: Add more reloc tests.
	* testsuite/ld-z80/relocs_f_z80n.d: New file

opcodes	* z80-dis.c: Add support for GBZ80 opcodes.
2020-02-07 14:53:46 +00:00
Nick Clifton e1104d08fe Silcence a compile time warning message building the binutils with gcc-10 on an s390 host.
* dwarf.c (display_debug_lines_decoded): Force a NUL termination
	of the truncated file name.
2020-02-07 12:49:42 +00:00
Nick Clifton c2e6f74465 Fix attributation of previous delta 2020-02-06 13:34:00 +00:00
Thomas Troeger ece128295e Jump visualization: Handle the case where the disassembled bytes occupy two lines.
* objdump.c (print_jump_visualisation): New function.
	(disassemble_bytes): Call new function.
2020-02-06 13:17:19 +00:00
Alan Modra 02e0be6901 mbind gas tests and supports_gnu_osabi testsuite infrastructure
With the addition of section16 tests we have multiple tests
advertising themselves as "mbind sections" and "mbind section
contents".  This patch fixes that, and fails on quite a few targets
that force an OSABI value.  It's a pain specifying all the relevant
arm targets on an xfail line, so I wrote supports_gnu_osabi.

binutils/
	* testsuite/lib/binutils-common.exp (match_target): Accept '!' before
	TCL procedure.
	(supports_gnu_osabi): New procedure.
	(is_generic): New, from ld-lib.exp.
	(supports_gnu_unique): Use the above.
gas/
	* testsuite/gas/elf/section12a.d: Use supports_gnu_osabi in
	xfail, and rename test.
	* testsuite/gas/elf/section12b.d: Likewise.
	* testsuite/gas/elf/section16a.d: Likewise.
	* testsuite/gas/elf/section16b.d: Likewise.
ld/
	* testsuite/lib/ld-lib.exp (is_generic): Delete.
	* testsuite/ld-unique/unique.exp: Exclude tic6x.
2020-02-06 13:57:37 +10:30
Alan Modra e8b791227f Missing objdump dependency od-elf32_avr
* Makefile.am (CFILES): Add od-elf32_avr.c.
	* Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
2020-02-04 21:56:29 +10:30
Andreas Schwab 27a45f4276 readelf: add missing newlines to error messages
* readelf.c (dump_relocations, dump_relocations)
	(decode_arm_unwind_bytecode, process_dynamic_section)
	(get_symbol_visibility, get_alpha_symbol_other): Add newline to
	error message.
2020-02-03 19:06:41 +01:00
Sergei Trofimovich 0b398d69ac binutils: drop redundant 'program_name' definition (-fno-common)
* coffdump.c (program_name): Drop redundant definition.
	* srconv.c (program_name): Likewise
	* sysdump.c (program_name): Likewise

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2020-02-03 15:59:14 +10:30
H.J. Lu a8c4d40b57 ELF: Add support for unique section ID to assembler
Clang's integrated assembler supports multiple section with the same
name:

	.section .text,"ax",@progbits,unique,1
	nop
	.section .text,"ax",@progbits,unique,2
	nop

"unique,N" assigns the number, N, as the section ID, to a section.  The
valid values of the section ID are between 0 and 4294967295.  It can be
used to distinguish different sections with the same section name.

This is useful with -fno-unique-section-names -ffunction-sections.
-ffunction-sections by default generates .text.foo, .text.bar, etc.
Using the same string can save lots of space in .strtab.

This patch adds section_id to bfd_section and reuses the linker
internal bit in BFD section flags, SEC_LINKER_CREATED, for assmebler
internal use to mark valid section_id.  It also updates objdump to
compare section pointers if 2 sections comes from the same file since
2 different sections can have the same section name.

bfd/

	PR gas/25380
	* bfd-in2.h: Regenerated.
	* ecoff.c (bfd_debug_section): Add section_id.
	* section.c (bfd_section): Add section_id.
	(SEC_ASSEMBLER_SECTION_ID): New.
	(BFD_FAKE_SECTION): Add section_id.

binutils/

	PR gas/25380
	* objdump.c (sym_ok): Return FALSE if 2 sections are in the
	same file with different section pointers.

gas/

	PR gas/25380
	* config/obj-elf.c (section_match): Removed.
	(get_section): Also match SEC_ASSEMBLER_SECTION_ID and
	section_id.
	(obj_elf_change_section): Replace info and group_name arguments
	with match_p.  Also update the section ID and flags from match_p.
	(obj_elf_section): Handle "unique,N".  Update call to
	obj_elf_change_section.
	* config/obj-elf.h (elf_section_match): New.
	(obj_elf_change_section): Updated.
	* config/tc-arm.c (start_unwind_section): Update call to
	obj_elf_change_section.
	* config/tc-ia64.c (obj_elf_vms_common): Likewise.
	* config/tc-microblaze.c (microblaze_s_data): Likewise.
	(microblaze_s_sdata): Likewise.
	(microblaze_s_rdata): Likewise.
	(microblaze_s_bss): Likewise.
	* config/tc-mips.c (s_change_section): Likewise.
	* config/tc-msp430.c (msp430_profiler): Likewise.
	* config/tc-rx.c (parse_rx_section): Likewise.
	* config/tc-tic6x.c (tic6x_start_unwind_section): Likewise.
	* doc/as.texi: Document "unique,N" in .section directive.
	* testsuite/gas/elf/elf.exp: Run "unique,N" tests.
	* testsuite/gas/elf/section15.d: New file.
	* testsuite/gas/elf/section15.s: Likewise.
	* testsuite/gas/elf/section16.s: Likewise.
	* testsuite/gas/elf/section16a.d: Likewise.
	* testsuite/gas/elf/section16b.d: Likewise.
	* testsuite/gas/elf/section17.d: Likewise.
	* testsuite/gas/elf/section17.l: Likewise.
	* testsuite/gas/elf/section17.s: Likewise.
	* testsuite/gas/i386/unique.d: Likewise.
	* testsuite/gas/i386/unique.s: Likewise.
	* testsuite/gas/i386/x86-64-unique.d: Likewise.
	* testsuite/gas/i386/i386.exp: Run unique and x86-64-unique.

ld/

	PR gas/25380
	* testsuite/ld-i386/pr22001-1c.S: Use "unique,N" in .section
	directives.
	* testsuite/ld-i386/tls-gd1.S: Likewise.
	* testsuite/ld-x86-64/pr21481b.S: Likewise.
2020-02-02 17:08:01 -08:00
Nick Clifton cb6ad9bb59 Update release making documentation 2020-02-01 13:14:16 +00:00
Nick Clifton 53943f32cc Updated translations for some of the binutils sub-directories 2020-01-31 14:45:51 +00:00
Nick Clifton 55be8fd0d2 Improve warning message from debuginfod support in readelf.
* readelf.c (get_build_id): Simplify warning message about corrupt
	notes encountered whilst scanning for the build-id.
2020-01-28 11:30:55 +00:00
Roland McGrath 82ef9cad78 Fix objcopy --merge-notes dependency on qsort implementation behavior.
binutils/
	* objcopy.c (compare_gnu_build_notes): Fix comparison results
	for overlapping ranges so that (A == B) == (B == A) holds.
2020-01-27 11:14:33 -08:00
Alan Modra e3696f67ab Replace deprecated tcl case statements with switch statements
binutils/
	* testsuite/lib/binutils-common.exp (big_or_little_endian): Replace
	case statement with switch statement.
gas/
	* testsuite/gas/all/gas.exp: Replace case statements with switch
	statements.
	* testsuite/gas/elf/elf.exp: Likewise.
	* testsuite/gas/macros/macros.exp: Likewise.
	* testsuite/lib/gas-defs.exp: Likewise.
ld/
	* testsuite/ld-elfvers/vers.exp: Replace case statements with
	switch statements.
	* testsuite/ld-ifunc/ifunc.exp: Likewise.
	* testsuite/ld-unique/unique.exp: Likewise.
2020-01-27 22:52:15 +10:30
Nick Clifton 2f796de6da Fix issue with warning messages about corrupt debuginfod notes.
* readelf.c (get_build_id): Fix warning messages about corrupt
	notes.
2020-01-24 11:55:12 +00:00
Nick Clifton 24e648d4b8 Updated translations for various binutils sub-directories. 2020-01-23 14:33:36 +00:00
Yuri Chornoivan c48acf6f26 PR25417, Fix minor typos
PR 25417
binutils/
	* readelf.c (get_alpha_symbol_other): Fix error message typo.
ld/
	* ldlang.c (ldlang_open_ctf): Fix error message typo.
	* emultempl/z80elf.em (z80_elf_after_open): Likewise.
2020-01-22 17:14:08 +10:30
Nick Clifton 26916852e1 Updated translations for various binutils sub-directories 2020-01-20 15:10:23 +00:00
Nick Clifton b248e9ce9a Update the notes on how to create a branch prior to a new release. 2020-01-18 14:37:55 +00:00
Nick Clifton 1b1bb2c67b Update version to 2.34.50. Regenerate configure and .pot files. 2020-01-18 14:12:07 +00:00
Nick Clifton ae77468624 Add markers for 2.34 branch to the NEWS files and ChangeLogs. 2020-01-18 13:50:25 +00:00
Thomas Troeger 82a9ed2050 Improve the performance of the ascii art jump visualizer.
* objdump.c (jump_info_visualize_address): Discard jumps that are
	no longer needed.
	(disassemble_bytes): Only compute the maximum level if jumps were
	detected.
2020-01-17 15:27:31 +00:00
Nick Clifton c87c17c1c2 Moev declaration of loop variable outside of the loop.
* objdump.c (disassemble_bytes): Remove C99-ism.
2020-01-13 17:28:41 +00:00