Commit Graph

102340 Commits

Author SHA1 Message Date
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
Jose E. Marchesi 7d8b91fda9 gas: simplify code in tc-bpf.c:md_apply_fix
2020-06-04  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-bpf.c (md_apply_fix): Simplify and avoid using
	cgen_put_insn_value.
2020-06-04 16:34:16 +02:00
Tom de Vries 95146b5da2 [gdb/testsuite] Fix error handling in gdb_file_cmd
Consider a gdb_load patch to call the gdb_file_cmd twice:
...
 proc gdb_load { arg } {
     if { $arg != "" } {
+       set res [gdb_file_cmd $arg]
+       if { $res != 0 } {
+           return $res
+       }
        return [gdb_file_cmd $arg]
     }
     return 0
 }
...

When running test-case gdb.base/index-cache.exp, we run into:
...
ERROR: Couldn't load outputs/gdb.base/index-cache/index-cache, other program \
  already loaded (timeout).
FAIL: gdb.base/index-cache.exp: test_cache_enabled_miss: check index-cache \
  stats (GDB internal error)
ERROR: Couldn't load outputs/gdb.base/index-cache/index-cache, other program \
  already loaded (timeout).
...

The first timeout in more detail:
...
(gdb) file outputs/gdb.base/index-cache/index-cache^M
Load new symbol table from "index-cache"? (y or n) y^M
Reading symbols from index-cache...^M
src/gdb/dwarf2/read.c:2540: internal-error: \
  void create_cus_from_index(dwarf2_per_bfd*, const gdb_byte*, offset_type, \
                             const gdb_byte*, offset_type): \
  Assertion `per_bfd->all_comp_units.empty ()' failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) ERROR: Couldn't load index-cache, \
  other program already loaded (timeout).
...

Proc gdb_file_cmd has a gdb_expect handling the result of the file command,
and if the result is a "Load new symbol table from index-cache? (y or n) "
prompt, it sends a "y" and enters in a nested gdb_expect to handle the
result.

The first gdb_expect contains code to handle "A problem internal to GDB has
been detected", but the second one doesn't, which causes the timeout.

Fix this by removing the nested gdb_expect, and using exp_continue instead,
such that we have instead:
...
ERROR: Couldn't load outputs/gdb.base/index-cache/index-cache -- with new \
  symbol table into gdb (GDB internal error).
ERROR: Couldn't load outputs/gdb.base/index-cache/index-cache -- with new \
  symbol table into gdb (GDB internal error).
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* lib/gdb.exp (gdb_file_cmd): Replace incomplete gdb_expect by
	exp_continue.
2020-06-04 16:33:55 +02:00
Jose E. Marchesi d8740be159 cpu,gas,opcodes: remove no longer needed workaround from the BPF port
cpu/ChangeLog:

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

	* bpf.cpu (define-bpf-isa): Set base-insn-bitsize to 64.
	* bpf.opc (bpf_print_insn): Do not set endian_code here.

gas/ChangeLog:

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

	* config/tc-bpf.c (md_begin): Pass CGEN_CPU_OPEN_INSN_ENDIAN to
	bpf_cgen_cpu_open.
	(md_assemble): Remove no longer needed hack.

opcodes/ChangeLog:

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

	* disassemble.c (disassemble_init_for_target): Set endian_code for
	bpf targets.
	* bpf-desc.c: Regenerate.
	* bpf-opc.c: Likewise.
	* bpf-dis.c: Likewise.
2020-06-04 16:17:42 +02:00
Jose E. Marchesi e9bffec9af opcodes: discriminate endianness and insn-endianness in CGEN ports
The CGEN support code in opcodes accesses instruction contents using a
couple of functions defined in cgen-opc.c: cgen_get_insn_value and
cgen_put_insn_value.  These functions use the "instruction endianness"
in the CPU description to order the read/written bytes.

The process of writing an instruction to the object file is:

  a) cgen_put_insn_value        ;; Writes out the opcodes.
  b) ARCH_cgen_insert_operand
       insert_normal
         insert_1
           cgen_put_insn_value  ;; Writes out the bytes of the
                                ;; operand.

Likewise, the process of reading an instruction from the object file
is:

  a) cgen_get_insn_value        ;; Reads the opcodes.
  b) ARCH_cgen_extract_operand
       extract_normal
         extract_1
           cgen_get_insn_value  ;; Reads in the bytes of the
                                ;; operand.

As can be seen above, cgen_{get,put}_insn_value are used to both
process the instruction opcodes (the constant fields conforming the
base instruction) and also the values of the instruction operands,
such as immediates.

This is problematic for architectures in which the endianness of
instructions is different to the endianness of data.  An example is
BPF, where instructions are always encoded big-endian but the data may
be either big or little.

This patch changes the cgen_{get,put}_insn_value functions in order to
get an extra argument with the endianness to use, and adapts the
existin callers to these functions in order to provide cd->endian or
cd->insn_endian, whatever appropriate.  Callers like extract_1 and
insert_1 pass cd->endian (since they are reading/writing operand
values) while callers reading/writing the base instruction pass
cd->insn_endian instead.

A few little adjustments have been needed in some existing CGEN based
ports:
* The BPF assembler uses cgen_put_insn_value.  It has been adapted to
  pass the new endian argument.
* The mep port has code in mep.opc that uses cgen_{get,put}_insn_value.
  It has been adapted to pass the new endianargument.  Ditto for a
  call in the assembler.

Tested with --enable-targets=all.
Regested in all supported targets.
No regressions.

include/ChangeLog:

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

	* opcode/cgen.h: Get an `endian' argument in both
	cgen_get_insn_value and cgen_put_insn_value.

opcodes/ChangeLog:

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

	* cgen-opc.c (cgen_get_insn_value): Get an `endian' argument.
	(cgen_put_insn_value): Likewise.
	(cgen_lookup_insn): Pass endianness to cgen_{get,put}_insn_value.
	* cgen-dis.in (print_insn): Likewise.
	* cgen-ibld.in (insert_1): Likewise.
	(insert_1): Likewise.
	(insert_insn_normal): Likewise.
	(extract_1): Likewise.
	* bpf-dis.c: Regenerate.
	* bpf-ibld.c: Likewise.
	* bpf-ibld.c: Likewise.
	* cgen-dis.in: Likewise.
	* cgen-ibld.in: Likewise.
	* cgen-opc.c: Likewise.
	* epiphany-dis.c: Likewise.
	* epiphany-ibld.c: Likewise.
	* fr30-dis.c: Likewise.
	* fr30-ibld.c: Likewise.
	* frv-dis.c: Likewise.
	* frv-ibld.c: Likewise.
	* ip2k-dis.c: Likewise.
	* ip2k-ibld.c: Likewise.
	* iq2000-dis.c: Likewise.
	* iq2000-ibld.c: Likewise.
	* lm32-dis.c: Likewise.
	* lm32-ibld.c: Likewise.
	* m32c-dis.c: Likewise.
	* m32c-ibld.c: Likewise.
	* m32r-dis.c: Likewise.
	* m32r-ibld.c: Likewise.
	* mep-dis.c: Likewise.
	* mep-ibld.c: Likewise.
	* mt-dis.c: Likewise.
	* mt-ibld.c: Likewise.
	* or1k-dis.c: Likewise.
	* or1k-ibld.c: Likewise.
	* xc16x-dis.c: Likewise.
	* xc16x-ibld.c: Likewise.
	* xstormy16-dis.c: Likewise.
	* xstormy16-ibld.c: Likewise.

gas/ChangeLog:

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

	* cgen.c (gas_cgen_finish_insn): Pass the endianness to
	cgen_put_insn_value.
	(gas_cgen_md_apply_fix): Likewise.
	(gas_cgen_md_apply_fix): Likewise.
	* config/tc-bpf.c (md_apply_fix): Pass data endianness to
	cgen_put_insn_value.
	* config/tc-mep.c (mep_check_ivc2_scheduling): Pass endianness to
	cgen_put_insn_value.

cpu/ChangeLog:

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

	* mep.opc (print_slot_insn): Pass the insn endianness to
	cgen_get_insn_value.
2020-06-04 16:17:42 +02:00
Jose E. Marchesi b3db6d07be opcodes: support insn endianness in cgen_cpu_open
This patch adds support for a new CGEN_OPEN_INSN_ENDIAN argument
for @arch@_cgen_cpu_open.  This is useful for architectures in
which the endianness of the instruction words is not the same
than the endianness used for data.

An accompanying patch has been sent to the CGEN mailing list that
adds support for this argument on the CGEN side [1].  Its been
already pre-approved [2], and will be applied simultaneously with
this binutils series.

[1] https://sourceware.org/pipermail/cgen/2020q2/002733.html
[2] https://sourceware.org/pipermail/cgen/2020q2/002737.html

include/ChangeLog:

2020-06-04  Jose E. Marchesi  <jemarch@gnu.org>

	* opcode/cgen.h (enum cgen_cpu_open_arg): New value
	CGEN_CPU_OPEN_INSN_ENDIAN.

opcodes/ChangeLog:

2020-06-04  Jose E. Marchesi  <jemarch@gnu.org>

	* cgen-dis.in (cpu_desc_list): New field `insn_endian'.
	(print_insn_): Handle instruction endian.
	* bpf-dis.c: Regenerate.
	* bpf-desc.c: Regenerate.
	* epiphany-dis.c: Likewise.
	* epiphany-desc.c: Likewise.
	* fr30-dis.c: Likewise.
	* fr30-desc.c: Likewise.
	* frv-dis.c: Likewise.
	* frv-desc.c: Likewise.
	* ip2k-dis.c: Likewise.
	* ip2k-desc.c: Likewise.
	* iq2000-dis.c: Likewise.
	* iq2000-desc.c: Likewise.
	* lm32-dis.c: Likewise.
	* lm32-desc.c: Likewise.
	* m32c-dis.c: Likewise.
	* m32c-desc.c: Likewise.
	* m32r-dis.c: Likewise.
	* m32r-desc.c: Likewise.
	* mep-dis.c: Likewise.
	* mep-desc.c: Likewise.
	* mt-dis.c: Likewise.
	* mt-desc.c: Likewise.
	* or1k-dis.c: Likewise.
	* or1k-desc.c: Likewise.
	* xc16x-dis.c: Likewise.
	* xc16x-desc.c: Likewise.
	* xstormy16-dis.c: Likewise.
	* xstormy16-desc.c: Likewise.

binutils/ChangeLog:

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

	* objdump.c (disassemble_data): Set disasm_info.endian_code to
        disasm_info.endian after the latter is initialized to the
        endianness reported by BFD.
2020-06-04 16:17:42 +02:00
Tom de Vries 0cfcd4f003 [gdb/testsuite] Fix use of fail in gdb_cmd_file
When building gdb using this patch:
...
 static void
 file_command (const char *arg, int from_tty)
 {
+  gdb_assert (0);
...
and running the testsuite, we run into:
...
Running src/gdb/testsuite/gdb.ada/O2_float_param.exp ...
PASS: gdb.ada/O2_float_param.exp: compilation foo.adb
FAIL: gdb.ada/O2_float_param.exp: (outputs/gdb.ada/O2_float_param/foo) \
  (GDB internal error)
PATH: gdb.ada/O2_float_param.exp: (outputs/gdb.ada/O2_float_param/foo) \
  (GDB internal error)
FAIL: gdb.ada/O2_float_param.exp: frame
...

The FAIL detecting the GDB internal error is generated by this clause in
gdb_file_cmd:
...
       -re "A problem internal to GDB has been detected" {
           fail "($arg) (GDB internal error)"
           gdb_internal_error_resync
           return -1
       }
...

The fail message has no text outside parenthesis, and could be considered
empty.  Also, it's the only clause in the gdb_expect that uses fail, the
rest uses perror.

Fix this by replacing the fail by perror, such that we have:
...
Running src/gdb/testsuite/gdb.ada/O2_float_param.exp ...
PASS: gdb.ada/O2_float_param.exp: compilation foo.adb
ERROR: Couldn't load outputs/gdb.ada/O2_float_param/foo into \
  gdb (GDB internal error).
UNRESOLVED: gdb.ada/O2_float_param.exp: frame
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* lib/gdb.exp (gdb_file_cmd): Use perror instead of fail.
2020-06-04 16:13:14 +02:00
H.J. Lu c4b126b87a ELF: Don't check relocations in non-loaded, non-alloced sections
Don't do anything special with non-loaded, non-alloced sections.
In particular, any relocs in such sections should not affect GOT
and PLT reference counting (ie. we don't allow them to create GOT
or PLT entries), there's no possibility or desire to optimize TLS
relocs, and there's not much point in propagating relocs to shared
libs that the dynamic linker won't relocate.

Since check_relocs is no longer called on non-loaded, non-alloced
sections, remove SEC_ALLOC check.  Resolve relocation in debug section
against symbol defined in shared library to 0.

bfd/

	PR ld/26080
	* elf-m10300.c (mn10300_elf_relocate_section): Resolve relocation
	in debug section against symbol defined in shared library to 0.
	* elf32-i386.c (elf_i386_check_relocs): Remove SEC_ALLOC check.
	* elf32-lm32.c (lm32_elf_check_relocs): Likewise.
	* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
	* elf32-nds32.c (nds32_elf_check_relocs): Likewise.
	* elf32-nios2.c (nios2_elf32_check_relocs): Likewise.
	* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
	* elf32-ppc.c (ppc_elf_check_relocs): Likewise.
	* elf32-sh.c (sh_elf_check_relocs): Likewise.
	* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
	* elf64-alpha.c (elf64_alpha_check_relocs): Likewise.
	* elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
	* elf32-vax.c (elf_vax_check_relocs): Set non_got_ref for non-GOT
	reference.
	(elf_vax_adjust_dynamic_symbol): Generate a copy reloc only if
	there is non-GOT reference.
	* elflink.c (_bfd_elf_link_check_relocs): Skip non-loaded,
	non-alloced sections.

ld/

	PR ld/26080
	* testsuite/ld-elf/comm-data.exp: Remove copy_reloc.
	* testsuite/ld-elf/comm-data2r.rd: Removed.
	* testsuite/ld-elf/comm-data2r.sd: Likewise.
	* testsuite/ld-elf/comm-data2r.xd: Likewise.
2020-06-04 05:58:47 -07:00
Alan Modra 1cf67587a0 tcl global directive outside proc body does nothing (gas)
* testsuite/config/default.exp: Remove global directive outside
	proc body.
	* testsuite/gas/mep/complex-relocs.exp: Likewise.
	* testsuite/gas/microblaze/relax_size.exp: Likewise.
	* testsuite/gas/microblaze/reloc_sym.exp: Likewise.
	* testsuite/gas/mt/relocs.exp: Likewise.
	* testsuite/gas/rx/rx.exp: Likewise.
2020-06-04 16:11:38 +09:30
Alan Modra 0a4f37af5c tcl global directive outside proc body does nothing (binutils)
* testsuite/binutils-all/i386/i386.exp
	* testsuite/binutils-all/x86-64/objects.exp
	* testsuite/binutils-all/x86-64/x86-64.exp
2020-06-04 16:11:23 +09:30
Alan Modra e2c8dab6ae tcl global directive outside proc body does nothing (ld)
* testsuite/config/default.exp: Remove global directive outside
	proc body.
	* testsuite/ld-bootstrap/bootstrap.exp: Likewise.
	* testsuite/ld-elf/compress.exp: Likewise.
	* testsuite/ld-elf/elf.exp: Likewise.
	* testsuite/ld-elf/exclude.exp: Likewise.
	* testsuite/ld-elf/frame.exp: Likewise.
	* testsuite/ld-elf/indirect.exp: Likewise.
	* testsuite/ld-elf/linux-x86.exp: Likewise.
	* testsuite/ld-elf/shared.exp: Likewise.
	* testsuite/ld-elf/tls.exp: Likewise.
	* testsuite/ld-elf/tls_common.exp: Likewise.
	* testsuite/ld-elfcomm/elfcomm.exp: Likewise.
	* testsuite/ld-elfweak/elfweak.exp: Likewise.
	* testsuite/ld-frv/fdpic.exp: Likewise.
	* testsuite/ld-frv/tls.exp: Likewise.
	* testsuite/ld-gc/gc.exp: Likewise.
	* testsuite/ld-i386/i386.exp: Likewise.
	* testsuite/ld-i386/no-plt.exp: Likewise.
	* testsuite/ld-ifunc/ifunc.exp: Likewise.
	* testsuite/ld-mips-elf/mips-elf-flags.exp: Likewise.
	* testsuite/ld-nios2/nios2.exp: Likewise.
	* testsuite/ld-plugin/lto.exp: Likewise.
	* testsuite/ld-plugin/plugin.exp: Likewise.
	* testsuite/ld-powerpc/export-class.exp: Likewise.
	* testsuite/ld-scripts/align.exp: Likewise.
	* testsuite/ld-scripts/crossref.exp: Likewise.
	* testsuite/ld-scripts/defined.exp: Likewise.
	* testsuite/ld-scripts/overlay-size.exp: Likewise.
	* testsuite/ld-scripts/provide.exp: Likewise.
	* testsuite/ld-scripts/weak.exp: Likewise.
	* testsuite/ld-selective/selective.exp: Likewise.
	* testsuite/ld-sh/rd-sh.exp: Likewise.
	* testsuite/ld-size/size.exp: Likewise.
	* testsuite/ld-srec/srec.exp: Likewise.
	* testsuite/ld-x86-64/mpx.exp: Likewise.
	* testsuite/ld-x86-64/no-plt.exp: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
2020-06-04 16:11:19 +09:30
Alan Modra a0c0ad5670 ld-dynamic test fixes
* testsuite/ld-dynamic/export-dynamic-symbol-2.d: Match output for
	mips-sgi-irix6.
	* testsuite/ld-dynamic/export-dynamic-symbol-glob.d: Likewise.
	* testsuite/ld-dynamic/export-dynamic-symbol-list-2.d: Likewise.
	* testsuite/ld-dynamic/export-dynamic-symbol-list-glob.d: Likewise.
	* testsuite/ld-dynamic/export-dynamic-symbol.exp: Exclude targets
	with poor PIE support.
2020-06-04 14:13:04 +09:30
Alan Modra 60f207b4a9 ld testsuite fails with default-PIE compiler
* testsuite/ld-plugin/lto.exp (pr12758.exe): Add NOPIE_LDFLAGS.
	* testsuite/ld-unique/unique.exp: Add NOPIE_LDFLAGS to unique
	executable and dynamic executable tests.
2020-06-04 10:20:48 +09:30
Alan Modra 7eea15c514 Correct PR number in changelog 2020-06-04 10:20:48 +09:30
Stephen Casner 31af1e68af Copy several years of fixes from bfd/aoutx.h to bfd/pdp11.c.
* pdp11.c (some_aout_object_p): 4c1534c7a2 - Don't set EXEC_P for
files with relocs.
(aout_get_external_symbols): 6b8f0fd579 - Return if count is zero.
0301ce1486 PR 22306 - Handle stringsize of zero, and error for any
other size that doesn't qcover the header word.
bf82069dce PR 23056 - Allocate an extra byte at the end of the
string table, and zero it.
(translate_symbol_table): 0d329c0a83 PR 22887 - Print an error
message and set bfd_error on finding an invalid name string offset.
(add_to_stringtab): INLINE -> inline
(pdp11_aout_swap_reloc_in): 116acb2c26 PR 22887 - Correct r_index
bound check.
(squirt_out_relocs): e2996cc315 PR 20921 - Check for and report
any relocs that could not be recognised.
92744f0580 PR 20929 - Check for relocs	without an associated symbol.
(find_nearest_line):  808346fcfc PR 23055 - Check that the symbol
name exists and is long enough, before attempting to see if it is
for a .o file.
c386442122 - Correct case for N_SO being the last symbol.
50455f1ab2 PR 20891 - Handle the case where the main file name
and the directory name are both empty.
e82ab856bb PR 20892 - Handle the case where function name is empty.
(aout_link_add_symbols): e517df3dbf PR 19629 - Check for out of
range string table offsets.
531336e3a0 PR 20909 - Fix off-by-one error in check for an
illegal string offset.
(aout_link_includes_newfunc): Add comment.
(pdp11_aout_link_input_section): ad756e3f9e - Return with an error
on unexpected relocation type rather than ASSERT.
2020-06-03 17:43:45 -07:00
GDB Administrator fda3f1174e Automatic date update in version.in 2020-06-04 00:00:15 +00:00
Tom de Vries f9b5d5ea18 [gdb/symtab] Fix missing breakpoint location for inlined function
Consider the test-case contained in this patch.

With -readnow, we have two breakpoint locations:
...
$ gdb -readnow -batch breakpoint-locs -ex "b N1::C1::baz" -ex "info break"
Breakpoint 1 at 0x4004cb: N1::C1::baz. (2 locations)
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   <MULTIPLE>
1.1                         y   0x00000000004004cb in N1::C1::baz() \
                                                     at breakpoint-locs.h:6
1.2                         y   0x00000000004004f0 in N1::C1::baz() \
                                                     at breakpoint-locs.h:6
...

But without -readnow, we have instead only one breakpoint location:
...
$ gdb -batch breakpoint-locs -ex "b N1::C1::baz" -ex "info break"
Breakpoint 1 at 0x4004f0: file breakpoint-locs.h, line 6.
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x00000000004004f0 in N1::C1::baz() \
                                                     at breakpoint-locs.h:6
...

The relevant dwarf is this bit:
...
 <0><d2>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <d8>   DW_AT_name        : breakpoint-locs.cc
 <1><f4>: Abbrev Number: 2 (DW_TAG_namespace)
    <f5>   DW_AT_name        : N1
 <2><fe>: Abbrev Number: 3 (DW_TAG_class_type)
    <ff>   DW_AT_name        : C1
 <3><109>: Abbrev Number: 4 (DW_TAG_subprogram)
    <10a>   DW_AT_name        : baz
    <110>   DW_AT_linkage_name: _ZN2N12C13bazEv
 <2><116>: Abbrev Number: 5 (DW_TAG_subprogram)
    <117>   DW_AT_name        : foo
    <11d>   DW_AT_linkage_name: _ZN2N13fooEv
 <1><146>: Abbrev Number: 8 (DW_TAG_subprogram)
    <147>   DW_AT_specification: <0x116>
    <14b>   DW_AT_low_pc      : 0x4004c7
    <153>   DW_AT_high_pc     : 0x10
 <2><161>: Abbrev Number: 9 (DW_TAG_inlined_subroutine)
    <162>   DW_AT_abstract_origin: <0x194>
    <166>   DW_AT_low_pc      : 0x4004cb
    <16e>   DW_AT_high_pc     : 0x9
 <1><194>: Abbrev Number: 12 (DW_TAG_subprogram)
    <195>   DW_AT_specification: <0x109>
    <199>   DW_AT_inline      : 3       (declared as inline and inlined)
...

The missing breakpoint location is specified by DIE 0x161, which is ignored by
the partial DIE reader because it's a child of a DW_TAG_subprogram DIE (at
0x146, for foo).

Fix this by not ignoring the DIE during partial DIE reading.

Tested on x86_64-linux.

gdb/ChangeLog:

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

	PR symtab/26046
	* dwarf2/read.c (scan_partial_symbols): Recurse into DW_TAG_subprogram
	children for C++.
	(load_partial_dies): Don't skip DW_TAG_inlined_subroutine child of
	DW_TAG_subprogram.

gdb/testsuite/ChangeLog:

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

	PR symtab/26046
	* gdb.cp/breakpoint-locs-2.cc: New test.
	* gdb.cp/breakpoint-locs.cc: New test.
	* gdb.cp/breakpoint-locs.exp: New file.
	* gdb.cp/breakpoint-locs.h: New test.
2020-06-03 23:50:16 +02:00
Stephen Casner 338d56a848 * gas/doc/c-riscv.texi (RISC-V-Options): Fix non-ASCII apostrophe. 2020-06-03 13:42:54 -07:00
H.J. Lu d4d8aee345 nios2: Call _bfd_elf_maybe_set_textrel to set DF_TEXTREL
Call _bfd_elf_maybe_set_textrel to set DF_TEXTREL by scanning dynamic
relocations in read-only section.

	PR ld/26066
	* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Call
	_bfd_elf_maybe_set_textrel to set DF_TEXTREL.
2020-06-03 09:25:51 -07:00
H.J. Lu 58ee44efbc nios2: Don't check relocations in non-loaded, non-alloced sections
Don't do anything special with non-loaded, non-alloced sections.
In particular, any relocs in such sections should not affect GOT
and PLT reference counting (ie. we don't allow them to create GOT
or PLT entries), there's no possibility or desire to optimize TLS
relocs, and there's not much point in propagating relocs to shared
libs that the dynamic linker won't relocate.

	PR ld/26066
	* elf32-nios2.c (nios2_elf32_check_relocs): Skip non-loaded,
	non-alloced sections.
2020-06-03 09:21:14 -07:00
H.J. Lu 9a6896021d frv: Don't generate dynamic relocation for non SEC_ALLOC sections
Don't generate dynamic relocations for non SEC_ALLOC sections because
run-time loader won't process them.

	* elf32-frv.c (elf32_frv_relocate_section): Don't generate
	dynamic relocations for non SEC_ALLOC sections.
2020-06-03 09:12:53 -07:00
H.J. Lu 50d036364f arc: Don't generate dynamic relocation for non SEC_ALLOC sections
Don't generate dynamic relocations for non SEC_ALLOC sections because
run-time loader won't process them.

	* elf32-arc.c (elf_arc_relocate_section): Don't generate dynamic
	relocations for non SEC_ALLOC sections.
2020-06-03 09:10:03 -07:00
Joel Anderson 913e0fd473 [PATCH] fix windmc typedef bug
While a typedef can be specified in message files for the messages following
with the `MessageIdTypedef` directive, only the last typedef was honored by
windmc. This corrects this behavior, matching mc.exe functionality.

	* windmc.h (struct mc_node): Add id_typecast field.
	* mcparse.y (message): Initialise the id_typecast field.
	* windmc.c (write_dbg): Use the id_typecast field as a parameter
	when calling write_dbg_define.
	(write_header): Likewise.
2020-06-03 16:44:37 +01:00
Tom de Vries 5144dfba28 [gdb/testsuite] Fix use of verbose in gdb/jit-*.exp
When running the gdb/jit-*.exp tests with runtest -v, I get:
...
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/jit-elf-so.exp: one_jit_test-1: maintenance print objfiles
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/jit-elf-so.exp: one_jit_test-2: maintenance print objfiles
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/jit-elf.exp: one_jit_test-1: maintenance print objfiles
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/jit-elf.exp: one_jit_test-2: maintenance print objfiles
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/jit-elf.exp: attach: one_jit_test-2: maintenance print objfiles
ERROR: internal buffer is full.
UNRESOLVED: gdb.base/jit-elf.exp: PIE: one_jit_test-1: maintenance print objfiles
FAIL: gdb.base/jit-reader.exp: jit-reader-load
FAIL: gdb.base/jit-reader.exp: with jit-reader: before mangling: bt works
FAIL: gdb.base/jit-reader.exp: with jit-reader: after mangling: bt works
FAIL: gdb.base/jit-reader.exp: with jit-reader again: jit-reader-load
FAIL: gdb.base/jit-reader.exp: with jit-reader again: bt
...

This is the consequence of the use of global verbose in these tests, which is
used to change the actual test, rather than be more verbose about it.

Fix this by defining a global test_verbose in each test, and using that
instead.

Tested on x86_64-linux using runtest -v.

gdb/testsuite/ChangeLog:

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

	PR testsuite/25609
	* gdb.base/jit-elf-so.exp: Don't modify testing behaviour based on
	value of global verbose.
	* gdb.base/jit-elf.exp: Same.
	* gdb.base/jit-reader.exp: Same.
2020-06-03 17:18:52 +02:00
Nick Clifton 4ee4189f86 Updated Serbian translation for the opcodes sub-directory 2020-06-03 15:29:09 +01:00
Gunther Nikl 0bff75284e This patch set for the generic BFD a.out backend removes a dead #define and makes aoutx.h self-contained: [PATCH 1/2]: bfd: remove unused NO_WRITE_HEADER_KLUDGE #define [PATCH 2/2]: bfd: make aoutx.h self-contained
* aout64.c (BMAGIC, QMAGIC): Do not define.
	* aoutx.h (N_IS_BMAGIC, N_SET_QMAGIC): New defines.
	(NAME (aout, some_aout_object_p)): Use N_IS_QMAGIC and N_IS_BMAGIC
	to check the file format.
	(adjust_z_magic): Use N_SET_QMAGIC to set file format.
	* i386aout.c (NO_WRITE_HEADER_KLUDGE): Delete define.
	* libaout.h (NO_WRITE_HEADER_KLUDGE): Do not define.
2020-06-03 15:24:58 +01:00