Commit Graph

102015 Commits

Author SHA1 Message Date
Simon Marchi 940da03e32 gdb: remove TYPE_FIELD_TYPE macro
Remove the `TYPE_FIELD_TYPE` macro, changing all the call sites to use
`type::field` and `field::type` directly.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_FIELD_TYPE): Remove.  Change all call sites
	to use type::field and field::type instead.

Change-Id: Ifda6226a25c811cfd334a756a9fbc5c0afdddff3
2020-06-08 15:26:31 -04:00
Simon Marchi b6cdac4b80 gdb: remove FIELD_TYPE macro
Remove the `FIELD_TYPE` macro, changing all the call sites to use
`field::type` directly.

gdb/ChangeLog:

	* gdbtypes.h (FIELD_TYPE): Remove.  Change all call sites
	to use field::type instead.

Change-Id: I7673fedaa276e485189c87991a9043495da22ef5
2020-06-08 15:26:06 -04:00
Simon Marchi 5d14b6e5d6 gdb: add field::type / field::set_type
Add the `type` and `set_type` methods on `struct field`, in order to
remoremove the `FIELD_TYPE` macro.  In this patch, the `FIELD_TYPE`
macro is changed to use `field::type`, so all the call sites that are
useused to set the field's type are changed to use `field::set_type`.
The next patch will remove `FIELD_TYPE` completely.

Note that because of the name clash between the existing field named
`type` and the new method, I renamed the field `m_type`.  It is not
private per-se, because we can't make `struct field` a non-POD yet, but
it should be considered private anyway (not accessed outside `struct
field`).

gdb/ChangeLog:

	* gdbtypes.h (struct field) <type, set_type>: New methods.
	Rename `type` field to...
	<m_type>: ... this.  Change references throughout to use type or
	set_type methods.
	(FIELD_TYPE): Use field::type.  Change call sites that modify
	the field's type to use field::set_type instead.

Change-Id: Ie21f866e3b7f8a51ea49b722d07d272a724459a0
2020-06-08 15:26:04 -04:00
Simon Marchi 3d967001ec gdb: remove TYPE_INDEX_TYPE macro
Remove `TYPE_INDEX_TYPE` macro, changing all the call sites to use
`type::index_type` directly.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_INDEX_TYPE): Remove.  Change all call sites
	to use type::index_type instead.

Change-Id: I56715df0bdec89463cda6bd341dac0e01b2faf84
2020-06-08 15:26:01 -04:00
Simon Marchi 262abc0d67 gdb: add type::index_type / type::set_index_type
Add the `index_type` and `set_index_type` methods on `struct type`, in
order to remove the `TYPE_INDEX_TYPE` macro.  In this patch, the
`TYPE_INDEX_TYPE` macro is changed to use `type::index_type`, so all the
call sites that are used to set the type's index type are changed to use
`type::set_index_type`.  The next patch will remove `TYPE_INDEX_TYPE`
completely.

gdb/ChangeLog:

	* gdbtypes.h (struct type) <index_type, set_index_type>: New
	methods.
	(TYPE_INDEX_TYPE): Use type::index_type.
	* gdbtypes.c (create_array_type_with_stride): Likewise.

Change-Id: I93bdca9de9f3e143d2ccea59310c63745315e18d
2020-06-08 15:25:50 -04:00
Alex Coplan 26417f1919 [PATCH] arm: Add DFB instruction for ARMv8-R
gas/ChangeLog:
2020-06-08  Alex Coplan  <alex.coplan@arm.com>

	* config/tc-arm.c (insns): Add dfb.
	* testsuite/gas/arm/dfb.d: New test.
	* testsuite/gas/arm/dfb.s: Input for test.

opcodes/ChangeLog:
2020-06-08  Alex Coplan  <alex.coplan@arm.com>

	* arm-dis.c (arm_opcodes): Add dfb.
	(thumb32_opcodes): Add dfb.
2020-06-08 15:16:29 +01:00
H.J. Lu 9bcc30e417 ELF: Move tlsdesc_plt/tlsdesc_got to elf_link_hash_table
All ELF backends with TLS descriptor support have

  /* The offset into splt of the PLT entry for the TLS descriptor
     resolver.  Special values are 0, if not necessary (or not found
     to be necessary yet), and -1 if needed but not determined
     yet.  */
  bfd_vma tlsdesc_plt;

  /* The GOT offset for the lazy trampoline.  Communicated to the
     loader via DT_TLSDESC_GOT.  The magic value (bfd_vma) -1
     indicates an offset is not allocated.  */
  bfd_vma tlsdesc_got;

in symbol hash entry.  Move tlsdesc_plt/tlsdesc_got to elf_link_hash_entry
to reduce code duplication.

	* elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt and
	tlsdesc_got.
	* elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt
	and dt_tlsdesc_got.
	(elf32_arm_size_dynamic_sections): Updated.  Clear
	root.tlsdesc_plt for DF_BIND_NOW.
	(elf32_arm_finish_dynamic_sections): Updated.
	(elf32_arm_output_arch_local_syms): Likewise.
	* elf32-nds32.c (nds32_elf_size_dynamic_sections): Updated.
	Clear root.tlsdesc_plt for DF_BIND_NOW.
	(nds32_elf_finish_dynamic_sections): Updated.
	* elf32-nds32.h (elf_nds32_link_hash_table): Remove
	dt_tlsdesc_plt and dt_tlsdesc_got.
	* elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated.
	* elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove
	tlsdesc_plt and dt_tlsdesc_got.
	(elfNN_aarch64_allocate_dynrelocs): Updated.
	(elfNN_aarch64_finish_dynamic_sections): Likewise.
	(elfNN_aarch64_size_dynamic_sections): Updated.  Clear
	root.tlsdesc_plt for DF_BIND_NOW.  Don't check DF_BIND_NOW
	twice.
	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
	(_bfd_x86_elf_size_dynamic_sections): Likewise.
	(_bfd_x86_elf_finish_dynamic_sections): Likewise.
	* elfxx-x86.h (elf_x86_link_hash_table): Remove tlsdesc_plt and
	tlsdesc_got.
2020-06-08 04:30:56 -07:00
Nick Clifton b37a771440 Fix a typo in the description of the strings program.
PR 26093
	* doc/binutils.texi (strings): Fix typo.
2020-06-08 11:32:15 +01:00
Nick Clifton c4b2f181c3 Fix an illegal memory access when parsing corrupt DWARF debug information.
PR 26086
	* dwarf.c (process_debug_info): Check that there is space in the
	debug_information array before filling in an entry.
2020-06-08 11:24:06 +01:00
Nick Clifton 9f3e7dbcba Fix a gas testsuite failure for PE based targets which cannot assemble the cfi-i386-2 test.
* testsuite/gas/cfi/cfi-i386-2.d: Skip for PE based targets.
2020-06-08 10:25:57 +01:00
Jan Beulich dd6b8a0bc2 x86: also handle %k<N> and %bnd<N> in debugging helpers
Adjustment of this function was missed when support for the respective
registers was added.
2020-06-08 08:40:58 +02:00
Jan Beulich 73c7637595 x86: simplify check_byte_reg()
With the introduction of what right now is the very first conditional
in the function's loop (commit dc821c5f9a ["x86: replace Reg8, Reg16,
Reg32, and Reg64"]), the last if() in the same loop has become
pointless - retain just its body.
2020-06-08 08:40:22 +02:00
Jan Beulich 22e00a3f4d x86: restrict %tr<N> visibility
First of all, these registers have never been available on any 64-bit
CPU, and hence should not be recognized in 64-bit mode. But even before
that they had already disappeared - also don't recognize them when 586
or 686 architectures were explicitly set.
2020-06-08 08:39:57 +02:00
Jan Beulich 1ab84e0251 ix86: enable 2nd CFI test
While putting together the previous patch I noticed that this test,
forever since its introduction, was dead. Update it so it will pass,
and enable it.
2020-06-08 08:39:23 +02:00
Jan Beulich af32b72209 x86: also allow %st(N) in CFI directives
In 0e0eea7820 ("x86: x87-related adjustments") I screwed up CFI
directives with FPU support disabled, by moving the conditional there
across a check of "allow_pseudo_reg". Add the missing check.
2020-06-08 08:38:54 +02:00
Jan Beulich 8a6fb3f9bb x86: restrict use of register aliases
Register aliases (created e.g. via .set) check their target register at
the time of creation of the alias. While this makes sense, it's not
enough: The underlying register must also be "visible" at the time of
use. Wrong use of such aliases would lead to internal errors in e.g.
add_prefix() or build_modrm_byte().

Split the checking part of parse_real_register() into a new helper
function and use it also from the latter part of parse_register() (at
the same time replacing a minor open coded part of it).

Since parse_register() returning NULL already has a meaning, a fake new
"bad register" indicator gets added, which all callers need to check
for.
2020-06-08 08:37:47 +02:00
GDB Administrator 334a017304 Automatic date update in version.in 2020-06-08 00:00:07 +00:00
H.J. Lu 845b83d7eb elf32-tic6x.c: Define the default elf32_bed to elf32_tic6x_bed
Get

00000000000007c0 d elf32_tic6x_bed
0000000000000000 d elf32_tic6x_elf_bed
00000000000003e0 d elf32_tic6x_linux_bed

instead of

00000000000007c0 d elf32_bed
0000000000000000 d elf32_tic6x_elf_bed
00000000000003e0 d elf32_tic6x_linux_bed

	* elf32-tic6x.c (elf32_bed): Defined the default to
	elf32_tic6x_bed.
2020-06-07 14:53:58 -07:00
H.J. Lu 597344c9a4 ld: Pass $LFLAGS to PR ld/21703 shared test
$LFLAGS is needed for -shared test.  This fixes

FAIL: PR ld/21703 shared

for tic6x-*-elf.

	* testsuite/ld-elf/shared.exp: Pass $LFLAGS to PR ld/21703
	shared test.
2020-06-07 14:50:01 -07:00
H.J. Lu 656e4a22f3 ld: Xfail pr20995 and pr20995-2 for tic6x-*-*
Xfail pr20995 and pr20995-2 for tic6x-*-* since GNU_RELRO is not
supported.

	* testsuite/ld-elf/shared.exp: Xfail pr20995/pr20995-2 for
	tic6x-*-*.
2020-06-07 11:52:18 -07:00
H.J. Lu 0fd91d25e2 pr11304.d: Skip tic6x-*-elf
Since address 0x800000 overlaps with .heap section on tic6x-*-elf, skip
pr11304.d on tic6x-*-elf.

	* testsuite/ld-elf/pr11304.d: Skip tic6x-*-elf.
2020-06-07 08:47:02 -07:00
H.J. Lu 9b8a8575b4 elf64-hppa: Replace plt_sec/plt_rel_sec with root.splt/root.srelplt
elf64-hppa should use root.splt and root.srelplt instead of plt_sec and
plt_rel_sec so that elflink.c can see splt and srelplt.  This fixed:

FAIL: ld-elf/pr19539

	* elf64-hppa.c (elf64_hppa_link_hash_table): Remove plt_sec and
	plt_rel_sec.
	(elf64_hppa_check_relocs): Replace plt_sec/plt_rel_sec with
	root.splt/root.srelplt.
	(elf64_hppa_create_dynamic_sections): Likewise.
	(elf64_hppa_size_dynamic_sections): Likewise.
	(elf64_hppa_finish_dynamic_symbol): Likewise.
	(elf_hppa_final_link): Likewise.
	(elf_hppa_final_link_relocate): Likewise.
2020-06-07 08:06:22 -07:00
Tom Tromey 82836c928f Remove unused parameter from generic_val_print_float
generic_val_print_float has an "embedded_offset" parameter, but it can
only ever be 0.  I believe it is a leftover from the val_print
removal.  This patch removes this parameter.

gdb/ChangeLog
2020-06-07  Tom Tromey  <tom@tromey.com>

	* valprint.c (generic_val_print_float): Remove "embedded_offset"
	parameter.
	(generic_value_print): Update.
2020-06-07 08:22:46 -06:00
H.J. Lu bcab203d31 Remove is_vxworks from _bfd_sparc_elf_link_hash_table
Replace is_vxworks with elf.target_os == is_vxworks.

	* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Updated.
	* elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Remove
	is_vxworks.
2020-06-06 17:42:31 -07:00
GDB Administrator 20955c7cb8 Automatic date update in version.in 2020-06-07 00:00:08 +00:00
H.J. Lu 90c14f0c3a ELF: Add target_os to elf_link_hash_table/elf_backend_data
Add target_os to elf_backend_data to identify target OS.  Add target_os,
to elf_link_hash_table to identify target OS for linker output.

	* elf-bfd.h (elf_target_os): New.
	(elf_link_hash_table): Add target_os.
	(elf_backend_data): Add target_os.
	* elf32-arm.c (elf32_arm_link_hash_table): Remove vxworks_p,
	symbian_p and nacl_p.
	(create_got_section): Updated.
	(elf32_arm_create_dynamic_sections): Likewise.
	(arm_type_of_stub): Likewise.
	(elf32_arm_create_or_find_stub_sec): Likewise.
	(elf32_arm_allocate_plt_entry): Likewise.
	(elf32_arm_populate_plt_entry): Likewise.
	(elf32_arm_final_link_relocate): Likewise.
	(elf32_arm_check_relocs): Likewise.
	(allocate_dynrelocs_for_symbol): Likewise.
	(elf32_arm_finish_dynamic_symbol): Likewise.
	(elf32_arm_finish_dynamic_sections): Likewise.
	(elf32_arm_output_plt_map_1): Likewise.
	(elf32_arm_output_arch_local_syms): Likewise.
	(elf32_arm_add_symbol_hook): Likewise.
	(elf32_arm_nacl_link_hash_table_create): Likewise.
	(elf32_arm_vxworks_link_hash_table_create): Likewise.
	(elf32_arm_symbian_link_hash_table_create): Likewise.
	(ELF_TARGET_OS): New.
	* elf32-i386.c (elf_i386_arch_bed): Removed.
	(elf_backend_arch_data): Likewise.
	(elf_i386_solaris_arch_bed): Likewise.
	(elf_i386_nacl_arch_bed): Likewise.
	(elf_i386_vxworks_arch_bed): Likewise.
	(elf_i386_relocate_section): Updated.
	(elf_i386_finish_dynamic_sections): Likewise.
	(elf_i386_get_synthetic_symtab): Likewise.
	(elf_i386_link_setup_gnu_properties): Likewise.
	(ELF_TARGET_OS): New.
	* elf32-mips.c (ELF_TARGET_OS): New.
	* elf32-ppc.c (ppc_elf_link_hash_table): Remove is_vxworks.
	(ppc_elf_create_got): Updated.
	(ppc_elf_create_dynamic_sections): Likewise.
	(ppc_elf_check_relocs): Likewise.
	(ppc_elf_adjust_dynamic_symbol): Likewise.
	(ppc_elf_size_dynamic_sections): Likewise.
	(ppc_elf_relocate_section): Likewise.
	(ppc_elf_finish_dynamic_sections): Likewise.
	(ppc_elf_vxworks_link_hash_table_create): Likewise.
	(ELF_TARGET_OS): New.
	* elf32-sh.c (elf_sh_link_hash_table): Remove vxworks_p.
	(sh_elf_link_hash_table_create): Updated.
	(sh_elf_create_dynamic_sections): Likewise.
	(allocate_dynrelocs): Likewise.
	(sh_elf_size_dynamic_sections): Likewise.
	(sh_elf_relocate_section): Likewise.
	(sh_elf_finish_dynamic_symbol): Likewise.
	(sh_elf_finish_dynamic_sections): Likewise.
	(ELF_TARGET_OS): New.
	* elf32-sparc.c (elf32_sparc_vxworks_link_hash_table_create):
	Removed.
	(bfd_elf32_bfd_link_hash_table_create): Likewise.
	(ELF_TARGET_OS): New.
	* elf64-x86-64.c (elf_x86_64_arch_bed): Removed.
	(elf_x86_64_solaris_arch_bed): Likewise.
	(elf_x86_64_nacl_arch_bed): Likewise.
	(elf_x86_64_finish_dynamic_sections): Updated.
	(elf_x86_64_get_synthetic_symtab): Likewise.
	(elf_x86_64_link_setup_gnu_properties): Likewise.
	(ELF_TARGET_OS): New.
	* elflink.c (_bfd_elf_link_hash_table_init): Initialize
	target_o.
	* elfxx-mips.c (mips_elf_link_hash_table): Remove is_vxworks.
	(MIPS_ELF_REL_DYN_NAME): Updated.
	(ELF_MIPS_GP_OFFSET): Likewise.
	(mips_elf_create_local_got_entry): Likewise.
	(mips_elf_allocate_dynamic_relocations): Likewise.
	(mips_elf_count_got_symbols): Likewise.
	(is_gott_symbol): Likewise.
	(mips_elf_calculate_relocation): Likewise.
	(mips_elf_create_dynamic_relocation): Likewise.
	(_bfd_mips_elf_check_relocs): Likewise.
	(allocate_dynrelocs): Likewise.
	(_bfd_mips_elf_adjust_dynamic_symbol): Likewise.
	(mips_elf_lay_out_got): Likewise.
	(mips_elf_set_plt_sym_value): Likewise.
	(_bfd_mips_elf_size_dynamic_sections): Likewise.
	(_bfd_mips_elf_finish_dynamic_symbol): Likewise.
	(_bfd_mips_elf_finish_dynamic_sections): Likewise.
	(_bfd_mips_elf_final_link): Likewise.
	(_bfd_mips_init_file_header): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_create_dynamic_sections):
	Likewise.
	(allocate_dynrelocs): Likewise.
	(_bfd_sparc_elf_size_dynamic_sections): Likewise.
	(_bfd_sparc_elf_relocate_section): Likewise.
	(_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
	(sparc_finish_dyn): Likewise.
	(_bfd_sparc_elf_finish_dynamic_sections): Likewise.
	* elfxx-target.h (ELF_TARGET_OS): New.
	(elfNN_bed): Add ELF_TARGET_OS.
	* elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated.
	(_bfd_x86_elf_link_hash_table_create): Likewise.
	(_bfd_x86_elf_size_dynamic_sections): Likewise.
	(_bfd_x86_elf_finish_dynamic_sections): Likewise.
	(_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
	(_bfd_x86_elf_link_setup_gnu_properties): Likewise.
	* elfxx-x86.h (elf_x86_target_os): Removed.
	(elf_x86_backend_data): Likewise.
	(get_elf_x86_backend_data): Likewise.
	(elf_x86_link_hash_table): Remove target_os.
2020-06-06 06:45:38 -07:00
Alan Modra 1424c35d07 Power10 tidies
binutils/
	* doc/binutils.texi (PowerPC -M option): Mention power10 and pwr10.
gas/
	* config/tc-ppc.c (md_show_usage): Mention -mpower10 and -mpwr10.
	* doc/c-ppc.texi: Likewise.
opcodes/
	* ppc-dis.c (ppc_opts): Accept -mpwr10/-Mpwr10.
2020-06-06 14:44:32 +09:30
Alan Modra 87c69f9732 Rename PowerPC64 pcrel GOT TLS relocations
These relocations should have had REL in their names, to reflect the
fact that they are pc-relative.  Fix that now by adding _PCREL.
I've added some back-compatibility code to support anyone using
.reloc with the old relocations.

include/
	* elf/ppc64.h (elf_ppc64_reloc_type): Rename
	R_PPC64_GOT_TLSGD34 to R_PPC64_GOT_TLSGD_PCREL34,
	R_PPC64_GOT_TLSLD34 to R_PPC64_GOT_TLSLD_PCREL34,
	R_PPC64_GOT_TPREL34 to R_PPC64_GOT_TPREL_PCREL34, and
	R_PPC64_GOT_DTPREL34 to R_PPC64_GOT_DTPREL_PCREL34.
bfd/
	* reloc.c: Rename
	BFD_RELOC_PPC64_GOT_TLSGD34 to BFD_RELOC_PPC64_GOT_TLSGD_PCREL34,
	BFD_RELOC_PPC64_GOT_TLSLD34 to BFD_RELOC_PPC64_GOT_TLSLD_PCREL34,
	BFD_RELOC_PPC64_GOT_TPREL34 to BFD_RELOC_PPC64_GOT_TPREL_PCREL34,
	BFD_RELOC_PPC64_GOT_DTPREL34 to BFD_RELOC_PPC64_GOT_DTPREL_PCREL34.
	* elf64-ppc.c: Update throughout for reloc renaming.
	(ppc64_elf_reloc_name_lookup): Handle old reloc names.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.
gas/
	* config/tc-ppc.c: Update throughout for reloc renaming.
elfcpp/
	* powerpc.h: Rename
	R_PPC64_GOT_TLSGD34 to R_PPC64_GOT_TLSGD_PCREL34,
	R_PPC64_GOT_TLSLD34 to R_PPC64_GOT_TLSLD_PCREL34,
	R_PPC64_GOT_TPREL34 to R_PPC64_GOT_TPREL_PCREL34, and
	R_PPC64_GOT_DTPREL34 to R_PPC64_GOT_DTPREL_PCREL34.
gold/
	* powerpc.cc: Update throughout for reloc renaming.
2020-06-06 14:44:32 +09:30
Alan Modra 1fc47f8089 Re: PR13802, referred common symbol not UNDefined
It looks like this one was previously just swept under the rug.  Prior
to git commit c4b126b87a, the arm backend emitted an absolute
dynamic symbol "foo" with value zero for what was originally a common
symbol.  That was just wrong.

The patch also removes an xfail for bfin-linux-uclibc.

	PR 13802
	* testsuite/ld-elf/comm-data.exp: Don't xfail arm or bfin-linux.
2020-06-06 14:44:32 +09:30
Alan Modra 070558eb0d ld -plugin options when plugins are disabled
This patch makes ld accept and ignore -plugin options when configured
with --disable-plugins.  The idea is to allow using a linker built
without plugin support with a gcc built with plugin support.  Quite
obviously such a combination won't work if using LTO, but gcc has a
habit of passing a bunch of -plugin and -plugin-opt arguments to ld
even when not generating or linking LTO objects.

Why do I want to do this?  Well, it lets me and other binutils
developers answer the question as to whether plugin support breaks
binutils in some areas.  Which it does for some targets.

	* lexsup.c (ld_options): Accept -plugin and -plugin-opt when
	!ENABLE_PLUGINS.
	* testsuite/lib/ld-lib.exp (check_plugin_api_available): Adjust.
2020-06-06 11:28:08 +09:30
GDB Administrator 62b5b3d836 Automatic date update in version.in 2020-06-06 00:00:17 +00:00
Andrew Burgess 940dace9cf Revert "gdb/python: Avoid use after free in py-tui.c"
This reverts commit 982a38f60b.

I missed that the title being assigned too was a std::string, and so
there is no leak.
2020-06-05 21:12:55 +01:00
Andrew Burgess 982a38f60b gdb/python: Avoid use after free in py-tui.c
When setting the window title of a tui frame we do this:

  gdb::unique_xmalloc_ptr<char> value
    = python_string_to_host_string (<python-object>);
  ...
  win->window->title = value.get ();

The problem here is that 'get ()' only borrows the pointer from value,
when value goes out of scope the pointer will be freed.  As a result,
the tui frame will be left with a pointer to undefined memory
contents.

Instead we should be using 'value.release ()' to take ownership of the
pointer from value.

gdb/ChangeLog:

	* python/py-tui.c (gdbpy_tui_set_title): Use release, not get, to
	avoid use after free.
2020-06-05 19:21:20 +01:00
Jose E. Marchesi f1919c56e1 gas: avoid GCC 10 warning stringop-overflow in tc-bpf.c
The GAS struct frag ends with a field `fr_literal' whose purpose is to
mark the begining of the frag's data:

struct frag {
  ...
  /* Data begins here.  */
  char fr_literal[1];
};

The code in gas/config/tc-bpf.c recently committed:

where = fixP->fx_frag->fr_literal + fixP->fx_where;
where[1] = target_big_endian ? 0x01 : 0x10;

triggers the stringop-overflow warning in GCC 10+, since the compiler
assumes the size of the modified buffer is 1 byte.  This patch
slightly modifies the code to make tc-bpf.c buildable with GCC 10+.

2020-06-05  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-bpf.c (md_apply_fix): Avoid GCC 10 warning
	stringop-overflow.
2020-06-05 16:23:30 +02:00
H.J. Lu 8a4ba3a142 bfin: Initialize picrel to silence GCC warning 2020-06-05 06:22:56 -07:00
H.J. Lu 981f151804 bfin: Skip non SEC_ALLOC section
* elf32-bfin.c (bfinfdpic_relocate_section): Skip non SEC_ALLOC
	section.
2020-06-05 05:30:25 -07:00
Tom de Vries 82f06518c4 [gdb/NEWS] Fix typos
Fix a few typos in gdb/NEWS.

gdb/ChangeLog:

2020-06-05  Tom de Vries  <tdevries@suse.de>

	* NEWS: Fix typos.
2020-06-05 12:24:20 +02:00
Joel Anderson 8affa48ac7 Fix a potential infinite loop in the Windows resource parser.
PR 26082
	* mclex.c (yylex): Add test for an empty input stream.
2020-06-05 11:11:03 +01:00
Nick Clifton 9c65eeacd8 Fix a use before initialization bug in the pdp11.c source file.
* pdp11.c (aout_link_add_symbols): Fix use before initialisation
	bug.
2020-06-05 10:08:26 +01:00
Alan Modra d3d1cc7b13 bpf stack smashing detected
* cgen-dis.c (hash_insn_array): Increase size of buf.  Assert
	size is large enough.
2020-06-05 16:22:46 +09:30
Stephen Casner 8eca5c7d9f Fix unresolved test in binutils for pdp11.
* binutils/testsuite/binutils-all/pr25662-pdp11.s: Alternate source file
for test using section pseudo-ops compatible with pdp11.
* binutils/testsuite/binutils-all/objcopy.exp: Select alternate source.
2020-06-04 23:41:57 -07:00
Nelson Chu 412857647f RISC-V: The object without priv spec attributes can be linked with any object.
bfd/
	* elfnn-riscv.c (riscv_merge_attributes): Add new boolean
	priv_may_conflict, in_priv_zero and out_priv_zero to decide whether
	the object can be linked according to it's priv attributes.  The object
	without any priv spec attributes can be linked with others.  If the first
	input object doesn't contain any priv attributes, then we need to copy
	the setting from the next input one.  Also report more detailed error
	messages to user.

	ld/
	* testsuite/ld-riscv-elf/attr-merge-priv-spec.d: Rename to
	attr-merge-priv-spec-01.d.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-c.s: Set priv spec
	to 1.11.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-d.s: Empty priv spec
	setting.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-02.d: New testcase.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-03.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Likewise.
	* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
2020-06-05 12:20:53 +08:00
Nelson Chu 3fc6c3dc2a RISC-V: Don't generate the ELF privilege attributes when no CSR are used.
gas/
	* config/tc-riscv.c (explicit_csr): New static boolean.
	Used to indicate CSR are explictly used.
	(riscv_ip): Set explicit_csr to TRUE if any CSR is used.
	(riscv_write_out_attrs): If we already have set elf priv
	attributes, then generate them.  Otherwise, don't generate
	them when no CSR are used.

	* testsuite/gas/riscv/attribute-01.d: Remove the priv attributes.
	* testsuite/gas/riscv/attribute-02.d: Likewise.
	* testsuite/gas/riscv/attribute-03.d: Likewise.
	* testsuite/gas/riscv/attribute-04.d: Likewise.
	* testsuite/gas/riscv/attribute-05.d: Likewise.
	* testsuite/gas/riscv/attribute-06.d: Likewise.
	* testsuite/gas/riscv/attribute-07.d: Likewise.
	* testsuite/gas/riscv/attribute-08.d: Likewise.
	* testsuite/gas/riscv/attribute-09.d: Likewise.
	* testsuite/gas/riscv/attribute-10.d: Likewise.
	* testsuite/gas/riscv/attribute-unknown.d: Likewise.
	* testsuite/gas/riscv/attribute-11.s: New testcase.
	* testsuite/gas/riscv/attribute-11.d: New testcase.  The CSR is
	used, so we should output the ELF priv attributes.
	* testsuite/gas/riscv/attribute-12.d: New testcase.  The CSR is
	used, so output the priv attributes according to the -mpriv-spec.
	* testsuite/gas/riscv/attribute-13.d: New testcase.  The CSR isn't
	used, so ignore the -mpriv-spec setting.

	ld/
	* testsuite/ld-riscv-elf/attr-merge-arch-01.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-arch-03.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-stack-align.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-01.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-02.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-03.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-04.d: Likewise.
	* testsuite/ld-riscv-elf/attr-merge-strict-align-05.d: Likewise.
	* testsuite/ld-riscv-elf/call-relax.d: Add -mno-arch-attr.
2020-06-05 12:14:44 +08:00
Stephen Casner a975c88e65 Extend pdp11-aout symbol table format and code for .stab symbols.
* bfd/pdp11.c (pdp11_external_nlist): Repurposed e_unused to e_desc.
(N_STAB, is_stab): Needed new function is_stab to disambiguate
normal vs. .stab symbol table type values, replacing N_STAB mask.
(translate_from_native_sym_flags): Determine correct section for
different .stab types.
(translate_to_native_sym_flags): Leave .stab types intact.
(translate_symbol_table): Error if symbol indicates overlay;
store desc field from .stab symbols.
(write_syms): Output desc field with symbol.
(aout_link_check_ar_symbols): Skip .stab symbols.
(aout_link_add_symbols): Correctly distinguish .stab symbols.
(aout_link_write_other_symbol): Write 0 for desk and ovly fields.
(aout_link_write_symbols): Write 0 for desk and ovly fields;
correctly distinguish .stab symbols and select calculate their
section and value; and copy desc and ovly fields from input symbol
to output symbol.
2020-06-04 18:12:32 -07:00
GDB Administrator 470e738f6d Automatic date update in version.in 2020-06-05 00:00:19 +00:00
Stephen Casner 3b9313c420 Correct a comment.
* bfd/aoutx.h (translate_symbol_table): Comment had external and
internal swapped.
* bfd/pdp11.c (translate_symbol_table): Likewise.
2020-06-04 12:34:17 -07:00
H.J. Lu d413a6233a gas: Fix ip2k-elf and xstormy16-elf build
Fix ip2k-elf and xstormy16-elf build due to

commit e9bffec9af
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date:   Thu Jun 4 16:15:53 2020 +0200

    opcodes: discriminate endianness and insn-endianness in CGEN ports

	* config/tc-ip2k. (ip2k_apply_fix): Pass endianness to
	cgen_get_insn_value.
	* config/tc-xstormy16.c (xstormy16_md_apply_fix): Pass
	endianness to cgen_get_insn_value and cgen_put_insn_value.
2020-06-04 11:15:06 -07:00
Simon Marchi f8c4185131 gdb: really share partial symtabs when using .gdb_index or .debug_names
Fix/follow-up to commit 17ee85fc2a ("Share DWARF partial symtabs").

In the non-index case, where GDB builds partial symbols from scratch,
two objfiles around the same BFD correctly share partial symtabs.  The
first objfile, which has to do all the work, saves a reference to the
created partial symtabs in the shared per_bfd object (at the end of
dwarf2_build_psymtabs).  The second objfile, when it reaches
dwarf2_build_psymtabs, sees that there are already partial symtabs built
for this BFD and just uses it.

However, that commit missed implementing the same sharing for cases
where GDB uses .gdb_index or .debug_names to build the partial symtabs.

This patch fixes it by having the first objfile to use the BFD set
per_bfd->partial_symtabs at the end of dwarf2_read_gdb_index /
dwarf2_read_debug_names.  For the subsequent objfiles using that BFD,
the partial symtabs are then picked up in dwarf2_initialize_objfile.

This patch adds a test that mimics how the issue was originally
triggered:

  1. Load the test file twice, such that the second objfile re-uses the
     per_bfd object created for the first objfile.
  2. Run to some point where in the backtrace there is a frame for a
     function that's in a CU that's not yet read in.
  3. Check that this frame's information is complete in the "backtrace"
     output.

Step 2 requires an address -> symbol lookup which uses the addrmap at
objfile->partial_symtabs->psymtabs_addrmap.  If the
objfile->partial_symtabs link is not properly setup (as is the case
before this patch), the symbol for that frame won't be found and we'll
get a frame with incomplete information.

The test fails without the fix when using boards "cc-with-gdb-index" and
"cc-with-debug-names".

gdb/ChangeLog:

	* dwarf2/read.c (dwarf2_read_gdb_index): Save partial_symtabs in
	the per_bfd object.
	(dwarf2_read_debug_names): Likewise.
	(dwarf2_initialize_objfile): Use partial_symtabs from per_bfd
	object when re-using a per_bfd object with an index.

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/share-psymtabs-bt.exp: New file.
	* gdb.dwarf2/share-psymtabs-bt.c: New file.
	* gdb.dwarf2/share-psymtabs-bt-2.c: New file.

Change-Id: Ibb26210e2dfc03b80ba9fa56b875ba4cc58c0352
2020-06-04 13:58:48 -04:00
H.J. Lu add5f777de x86: Remove target_id from elf_x86_link_hash_table
Since target_id in elf_x86_link_hash_table is the same as hash_table_id
in elf_link_hash_table, we can use elf.hash_table_id instead of target_id.

	* elfxx-x86.h (elf_x86_link_hash_table): Remove target_id.
	(is_x86_elf): Check elf.hash_table_id instead of target_id.
	* elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Updated.
2020-06-04 09:56:25 -07:00
Tom de Vries 1c07a73f66 [gdb/testsuite] Remove path names from error messages in gdb_file_cmd
In gdb_file_cmd, perror is called with error message strings using $arg and
$GDB, both of which contain path names, which makes comparison of gdb.sum
files more difficult.

Fix this by using:
- [file tail $arg] instead of $arg
- GDB instead of $GDB.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-06-04  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (gdb_file_cmd): Avoid path names in error messages.
2020-06-04 17:37:53 +02:00