Commit Graph

16022 Commits

Author SHA1 Message Date
GDB Administrator 07a78c5956 Automatic date update in version.in 2020-05-18 00:00:14 +00:00
GDB Administrator 966dc1a27c Automatic date update in version.in 2020-05-17 00:00:06 +00:00
GDB Administrator 1c5dd7a572 Automatic date update in version.in 2020-05-16 00:00:09 +00:00
Nelson Chu fc46e8bd35 RISC-V: Add elfNN_riscv_mkobject to initialize RISC-V tdata.
For now we only have one char pointer in RISC-V tdata, so it should be fine.
But once we need more elements in tdata, then we may get some uninitialize
or unexpected values.  I do meet the same problem when extending the RISC-V
tdata.

	bfd/
	elfnn-riscv.c (elfNN_riscv_mkobject):  New function.  We need this
	to initialize RISC-V tdata.
2020-05-14 10:39:54 +08:00
GDB Administrator 4ac31493c8 Automatic date update in version.in 2020-05-14 00:00:16 +00:00
GDB Administrator 09f20ec886 Automatic date update in version.in 2020-05-13 00:00:18 +00:00
Gunther Nikl 533f049e00 [PATCH] bfd: Fix 64-bit relocation handling for a.out
* aoutx.h (NAME (aout, swap_std_reloc_out)): Reject an unsupported
	relocation size.
2020-05-12 12:18:09 +01:00
GDB Administrator a1becf61f7 Automatic date update in version.in 2020-05-12 00:00:11 +00:00
Alan Modra 94ba9882d5 Power10 VSX 32-byte storage access
bfd/
	* elf64-ppc.c (xlate_pcrel_opt): Handle lxvp and stxvp.
opcodes/
	* ppc-opc.c (insert_xtp, extract_xtp): New functions.
	(XTP, DQXP, DQXP_MASK): Define.
	(powerpc_opcodes): Add lxvp, stxvp, lxvpx, stxvpx.
	(prefix_opcodes): Add plxvp and pstxvp.
gas/
	* testsuite/gas/ppc/vsx_32byte.d,
	* testsuite/gas/ppc/vsx_32byte.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
ld/
	* testsuite/ld-powerpc/pcrelopt.s: Add lxvp and stxvp.
	* testsuite/ld-powerpc/pcrelopt.d: Update.
2020-05-11 21:08:37 +09:30
Alan Modra 7c1f422735 PowerPC Rename powerxx to power10
Now that ISA3.1 is out we can finish with the powerxx silliness.

bfd/
	* elf64-ppc.c: Rename powerxx to power10 throughout.
gas/
	* config/tc-ppc.c (md_assemble): Update for PPC_OPCODE_POWER10
	renaming.
	* testsuite/gas/ppc/prefix-align.d: Use -mpower10/-Mpower10 in
	place of -mfuture/-Mfuture.
	* testsuite/gas/ppc/prefix-pcrel.d: Likewise.
	* testsuite/gas/ppc/prefix-reloc.d: Likewise.
gold/
	* powerpc.cc: Rename powerxx to power10 throughout.
include/
	* elf/ppc64.h: Update comment.
	* opcode/ppc.h (PPC_OPCODE_POWER10): Rename from PPC_OPCODE_POWERXX.
ld/
	* testsuite/ld-powerpc/callstub-1.d: Use -mpower10/-Mpower10 in
	place of -mfuture/-Mfuture.
	* testsuite/ld-powerpc/notoc2.d: Likewise.
	* testsuite/ld-powerpc/powerpc.exp: Likewise.
	* testsuite/ld-powerpc/tlsgd.d: Likewise.
	* testsuite/ld-powerpc/tlsie.d: Likewise.
	* testsuite/ld-powerpc/tlsld.d: Likewise.
opcodes/
	* ppc-dis.c (ppc_opts): Add "power10" entry.
	(print_insn_powerpc): Update for PPC_OPCODE_POWER10 renaming.
	* ppc-opc.c (POWER10): Rename from POWERXX.  Update all uses.
2020-05-11 21:08:36 +09:30
Alan Modra 4d5acb1ea5 PR25961, buffer overflow in coff_swap_aux_in
PR 25961
	* coffgen.c (coff_get_normalized_symtab): Check that buffer
	contains required number of auxents before processing any auxent.
	* coffswap.h (coff_swap_aux_in <C_FILE>): Only swap in extended
	file name from auxents for PE.
2020-05-11 18:11:26 +09:30
GDB Administrator b59cca2581 Automatic date update in version.in 2020-05-11 00:00:07 +00:00
GDB Administrator 1ea1aee1ed Automatic date update in version.in 2020-05-10 00:00:15 +00:00
GDB Administrator b326e6b0de Automatic date update in version.in 2020-05-09 00:00:12 +00:00
GDB Administrator cee2106c5b Automatic date update in version.in 2020-05-08 00:00:14 +00:00
GDB Administrator 1d5bcf8d88 Automatic date update in version.in 2020-05-07 00:00:12 +00:00
GDB Administrator 4167d44ce2 Automatic date update in version.in 2020-05-06 00:00:06 +00:00
GDB Administrator dc7148375d Automatic date update in version.in 2020-05-05 00:00:06 +00:00
Gunther Nikl 7242fa8aa7 [PATCH] bfd: tweak SET_ARCH_MACH of aout-cris.c
* aout-cris.c (DEFAULT_ARCH): Delete define.
	(MY_set_arch_mach): Likewise.
	(SET_ARCH_MACH): Use bfd_set_arch_mach with an explicit architecture
	of bfd_arch_cris.
	(swap_ext_reloc_in): Add casts to r_index extraction. Mask valid bits
	of r_type before the shift.
2020-05-04 16:07:26 +01:00
Wilco Dijkstra cff69cf4cf [binutils-gdb][ld][AArch64] Fix group_sections algorithm
PR ld/25665
	* bfd/elfnn-aarch64.c (group_sections): Copy implementation
	from elf32-arm.c.
	* testsuite/ld-aarch64/aarch64-elf.exp: Add new test.
	* testsuite/ld-aarch64/farcall-group.s: New large group test.
	* testsuite/ld-aarch64/farcall-group.d: Likewise.
2020-05-04 15:51:56 +01:00
GDB Administrator c3bf7d31de Automatic date update in version.in 2020-05-04 00:00:06 +00:00
GDB Administrator c69ad65744 Automatic date update in version.in 2020-05-03 00:00:07 +00:00
GDB Administrator a4be18526b Automatic date update in version.in 2020-05-02 00:00:07 +00:00
Alan Modra a2714d6cca PR25900, RISC-V: null pointer dereference
PR 25900
	* elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
	accessing root.u.def of symbols.  Also check root.u.def.section
	is non-NULL.  Reverse tests so as to make the logic positive.
2020-05-01 15:32:36 +09:30
Alan Modra a8acd6eeb6 PR25882, .gnu.attributes are not checked for shared libraries
This allows backend merge_private_bfd_data to examine shared library
e_flags and/or .gnu.attributes.  ARM and PowerPC have done so when
using ld.gold for a long time.

(The tic6x change below is dead code due to the earlier FIXME,
but this is probably one of the changes needed there.)

	PR 25882
bfd/
	* elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer
	Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output.
ld/
	* ldlang.c (lang_check): Call bfd_merge_private_bfd_data for
	shared libraries.
2020-05-01 15:32:36 +09:30
Alan Modra 6b728d3286 FIXME for merging of e_flags and .gnu.attributes
Code in the linker, present before the addition of .gnu.attributes
support, results in shared libraries not being considered by BFD when
merging e_flags and .gnu.attributes from input files to the output.
That doesn't seem correct to me, but I don't know enough about all the
various ABIs to change the behaviour with any confidence.  So this
patch merely punts on dynamic objects in merge_private_bfd_data target
functions, with a FIXME for maintainer attention.

I haven't excluded shared libraries from being considered where the
target merge_private_bfd_data (a) already has code dealing with shared
libraries, or (b) where that function just sets the output to the most
constraining arch/mach combination and other fairly trivial merges, or
(c) when the target has no shared library linker support.

In (a) are: arc, arm, aarch64, riscv, sparc.
In (b) are: bpf, cris, csky, m32r, m68k, mn10300, nios2, tilegx,
	    tilepro, vax, visium, xtensa.
In (c) are: bpf, cr16, h8300, iq2000, m32c, m68hc11, m68hc12, mcore,
	    mep, msp430, mt, rl78, rx, v850.

	PR 25882
	* elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
	* elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
	* elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
	* elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
	* elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
	* elf32-sh.c (sh_elf_merge_private_data): Likewise.
	* elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
	* elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
2020-05-01 15:32:36 +09:30
Alan Modra 91ed9b71fa ppc32 merging of e_flags from dynamic objects
EF_PPC_RELOCATABLE and similar flags, if present in an input shared
library, don't have any relevance as far as the output file is
concerned.

Currently, dynamic objects aren't seen in merge_private_bfd_data.
This patch is in preparation for a change to that.

	PR 25882
	* elf32-ppc.c (ppc_elf_merge_private_bfd_data): Ignore e_flags
	from shared libraries.
2020-05-01 15:32:36 +09:30
GDB Administrator eb47d2fa97 Automatic date update in version.in 2020-05-01 00:00:16 +00:00
Max Filippov d548f47df4 xtensa: fix XTENSA_NDIFF handling for PR ld/25861
Fields marked with XTENSA_NDIFF relocations are not negated, they only
have sign bits removed. Don't negate their values when relaxation is
performed. Don't add sign bits when the value is zero. Report overflow
when the result has negative sign but all significant bits are zero.

2020-04-29  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* elf32-xtensa.c (relax_section): Don't negate diff_value for
	XTENSA_NDIFF relocations. Don't add sign bits whe diff_value
	equals 0. Report overflow when the result has negative sign but
	all significant bits are zero.

ld/
	* testsuite/ld-xtensa/relax-diff1.d: New test definition.
	* testsuite/ld-xtensa/relax-diff1.s: New test source.
	* testsuite/ld-xtensa/relax-ndiff.d: New test definition.
	* testsuite/ld-xtensa/relax-ndiff.s: New test source.
	* testsuite/ld-xtensa/xtensa.exp: (relax-diff1)
	(relax-ndiff): New tests.
2020-04-29 18:34:23 -07:00
GDB Administrator 44e33ab45d Automatic date update in version.in 2020-04-30 00:00:11 +00:00
Gunther Nikl dfa85db14c bfd: Fix 64-bit relocation handling for a.out
* aoutx.h (swap_std_reloc_out): Special case 64 bit relocations.
	(aout_link_reloc_link_order): Likewise. Make r_length an unsigned.
2020-04-29 14:42:41 +01:00
GDB Administrator 03549f57b6 Automatic date update in version.in 2020-04-29 00:00:12 +00:00
GDB Administrator 30b57e1bea Automatic date update in version.in 2020-04-28 00:00:10 +00:00
Alan Modra 48e5bada0a alpha-vms: divide by zero
The zero check was on the wrong operand.  And, yes, the second operand
popped is supposed to be divided by the first operand popped.

	* vms-alpha.c (_bfd_vms_slurp_etir): Correct divide by zero check.
	Emit warning message.
2020-04-28 08:35:34 +09:30
Tamar Christina 251dae9107 x86: Add i386 PE big-object support
The 64-bit version of binutils got support for the PE COFF BIG OBJ format a
couple of years ago.   The BIG OBJ format is a slightly different COFF format
which extends the size of the number of section field in the header from a
uint16_t to a uint32_t and so greatly increases the number of sections allowed.

However the 32-bit version of bfd never got support for this.  The GHC Haskell
compiler generates a great deal of symbols due to it's use of
-ffunction-sections and -fdata-sections.

This meant that we could not build the 32-bit version of the GHC Compiler for
many releases now as binutils didn't have this support.

This patch adds the support to the 32-bit port of binutils as well and also does
come cleanup in the code.

bfd/ChangeLog:

	* coff-i386.c (COFF_WITH_PE_BIGOBJ): New.
	* coff-x86_64.c (COFF_WITH_PE_BIGOBJ): New.
	* config.bfd (targ_selvecs): Rename x86_64_pe_be_vec
	to x86_64_pe_big_vec as it not a big-endian format.
	(vec i386_pe_big_vec): New.
	* configure.ac: Likewise.
	* targets.c: Likewise.
	* configure: Regenerate.
	* pe-i386.c (TARGET_SYM_BIG, TARGET_NAME_BIG,
	COFF_WITH_PE_BIGOBJ): New.
	* pe-x86_64.c (TARGET_SYM_BIG, TARGET_NAME_BIG):
	New.
	(x86_64_pe_be_vec): Moved.

gas/ChangeLog:

	* NEWS: Add news entry for big-obj.
	* config/tc-i386.c (i386_target_format): Support new format.
	* doc/c-i386.texi: Add i386 support.
	* testsuite/gas/pe/big-obj.d: Rename test to not be x64 specific.
	* testsuite/gas/pe/pe.exp (big-obj): Make test run on i386 as well.

ld/ChangeLog:

	* pe-dll.c (pe_detail_list):  Add pe-bigobj-i386.
2020-04-27 17:41:39 +01:00
GDB Administrator 25e29062d2 Automatic date update in version.in 2020-04-27 00:00:15 +00:00
GDB Administrator ec9c4d8322 Automatic date update in version.in 2020-04-26 00:00:07 +00:00
GDB Administrator 617769d62f Automatic date update in version.in 2020-04-25 00:00:08 +00:00
GDB Administrator 5e5bbc7e79 Automatic date update in version.in 2020-04-24 00:00:20 +00:00
Anton Kolesov 2745674244 arc: Add support for ARC HS extra registers in core files
When a coredump is generated, there are a few registers in
ARC HS that are put under a special section, namely ".reg-v2".
It is for backward compatibility reasons with older tools that
we have decided not to extend the generic ".reg" section.

This patch makes it possible to display the information better
regarding that section.  Compare the output of "readelf" without
and with these changes:

$ readelf -n core     # without the patch
  ...
  LINUX    0x0000000c  Unknown note type: (0x00000600)
   description data: 78 08 00 00 2f 6c 64 2d 75 43 6c 69

$ readelf -n core     # with the patch
  ...
  LINUX    0x0000000c  NT_ARC_V2 (ARC HS accumulator/extra registers)
   description data: 78 08 00 00 2f 6c 64 2d 75 43 6c 69

In another commit (soon to be submitted), GDB will makes use of these
changes to parse the extra section and its registers.

bfd/ChangeLog
2020-03-26  Anton Kolesov  <anton.kolesov@synopsys.com>

	* elf-bfd.h (elfcore_write_arc_v2): Add prototype.
	* elf.c (elfcore_grok_arc_v2): New function.
	(elfcore_grok_note): Call the new function to handle the corresponding
	note.
	(elfcore_write_arc_v2): New function.
	(elfcore_write_register_note): Call the new function to handle the
	corresponding pseudo-sections.

binutils/ChangeLog
2020-03-26  Anton Kolesov  <anton.kolesov@synopsys.com>

	* readelf.c (get_note_type): Handle NT_ARC_V2.

include/elf/ChangeLog
2020-03-26  Anton Kolesov  <anton.kolesov@synopsys.com>

	* common.h (NT_ARC_V2): New macro definitions.
2020-04-23 11:09:09 +03:00
Max Filippov 30ce8e47fa xtensa: fix PR ld/25861
Introduce new relaxations XTENSA_PDIFF{8,16,32} for positive differences
(subtracted symbol precedes diminished symbol) and XTENSA_NDIFF{8,16,32}
for negative differences (subtracted symbol follows diminished symbol).
Don't generate XTENSA_DIFF relocations in the assembler, generate
XTENSA_PDIFF or XTENSA_NDIFF based on relative symbol position.

Handle XTENSA_DIFF in BFD for compatibility with old object files.
Handle XTENSA_PDIFF and XTENSA_NDIFF in BFD, treating difference value
as unsigned.

2020-04-22  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* bfd-in2.h: Regenerated.
	* elf32-xtensa.c (elf_howto_table): New entries for
	R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}.
	(elf_xtensa_reloc_type_lookup, elf_xtensa_do_reloc)
	(relax_section): Add cases for R_XTENSA_PDIFF{8,16,32} and
	R_XTENSA_NDIFF{8,16,32}.
	* libbfd.h (bfd_reloc_code_real_names): Add names for
	BFD_RELOC_XTENSA_PDIFF{8,16,32} and
	BFD_RELOC_XTENSA_NDIFF{8,16,32}.
	* reloc.c: Add documentation for BFD_RELOC_XTENSA_PDIFF{8,16,32}
	and BFD_RELOC_XTENSA_NDIFF{8,16,32}.

binutils/
	* readelf.c (is_none_reloc): Recognize
	BFD_RELOC_XTENSA_PDIFF{8,16,32} and
	BFD_RELOC_XTENSA_NDIFF{8,16,32}.

gas/
	* config/tc-xtensa.c (md_apply_fix): Replace
	BFD_RELOC_XTENSA_DIFF{8,16,32} generation with
	BFD_RELOC_XTENSA_PDIFF{8,16,32} and
	BFD_RELOC_XTENSA_NDIFF{8,16,32} generation.
	* testsuite/gas/xtensa/loc.d: Replace BFD_RELOC_XTENSA_DIFF16
	with BFD_RELOC_XTENSA_PDIFF16 in the expected output.

include/
	* elf/xtensa.h (elf_xtensa_reloc_type): New entries for
	R_XTENSA_PDIFF{8,16,32} and R_XTENSA_NDIFF{8,16,32}.

ld/
	* testsuite/ld-xtensa/relax-loc.d: New test definition.
	* testsuite/ld-xtensa/relax-loc.s: New test source.
	* testsuite/ld-xtensa/xtensa.exp (relax-loc): New test.
2020-04-22 18:46:45 -07:00
GDB Administrator e44f65e3c5 Automatic date update in version.in 2020-04-23 00:00:10 +00:00
GDB Administrator 259f1c5dca Automatic date update in version.in 2020-04-22 00:00:10 +00:00
Tamar Christina c36876fe5b BFD: Exclude sections with no content from compress check.
The check in bfd_get_full_section_contents is trying to check that we don't
allocate more space for a section than the size of the section is on disk.

Previously we excluded linker created sections since they didn't have a size on
disk.  However we also need to exclude sections with no content as well such as
the BSS section.  Space for these would not have been allocated by the assembler
and so the check would incorrectly fail.

bfd/ChangeLog:

	PR binutils/24753
	* compress.c (bfd_get_full_section_contents): Exclude sections with no
	content.

gas/ChangeLog:

	PR binutils/24753
	* testsuite/gas/arm/pr24753.d: New test.
	* testsuite/gas/arm/pr24753.s: New test.
2020-04-21 15:17:18 +01:00
H.J. Lu 6f6fd151cb elf: Strip zero-sized dynamic sections
ELF size_dynamic_sections is called by the ELF backend linker after all
the linker input files have been seen but before the section sizes have
been set.  After the sections sizes have been set, target-specific,
global optimizations may make some dynamic sections zero-sized if they
are no longer needed.

Add ELF strip_zero_sized_dynamic_sections so that ELF backend linker can
strip zero-sized dynamic sections after the sections sizes have been set.

bfd/

	PR ld/25849
	* elf-bfd.h (elf_backend_data): Add
	elf_backend_strip_zero_sized_dynamic_sections.
	(_bfd_elf_strip_zero_sized_dynamic_sections): New prototype.
	* elf64-alpha.c (elf_backend_strip_zero_sized_dynamic_sections):
	New macro.
	* elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): New
	function.
	* elfxx-target.h (elf_backend_strip_zero_sized_dynamic_sections):
	New macro.
	(elfNN_bed): Add elf_backend_strip_zero_sized_dynamic_sections.

ld/

	PR ld/25849
	* ldelfgen.c (ldelf_map_segments): Call
	elf_backend_strip_zero_sized_dynamic_sections.
	* testsuite/ld-alpha/tlsbinr.rd: Updated.
2020-04-21 05:24:03 -07:00
H.J. Lu 1f7f2abbc3 alpha: Warn DT_TEXTREL with -M
This fixes:

FAIL: DT_TEXTREL map file warning

	* elf64-alpha.c (alpha_elf_reloc_entry): Replace reltext with
	sec.
	(elf64_alpha_check_relocs): Set sec instead of reltext.  Warn
	DT_TEXTREL with -M.
	(elf64_alpha_calc_dynrel_sizes): Warn DT_TEXTREL with -M.
2020-04-21 05:20:23 -07:00
Nick Clifton e04f33c09f Updated Serbian translation for the BFD directory. 2020-04-21 11:48:31 +01:00
Alan Modra fad3d2c1b2 Remove SH-5 remnants
git commit 211dc24b87 removed most sh5 and sh64 SuperH support, after
they were obsoleted by git commit 2b213129c5.  This patch removes a
few remaining pieces that should have gone with 211dc24b87.

include/
	* elf/sh.h (STO_SH5_ISA32, SHF_SH5_ISA32, SHF_SH5_ISA32_MIXED),
	(SHT_SH5_CR_SORTED, STT_DATALABEL): Delete.
bfd/
	* elf32-sh.c (sh_elf_relocate_section): Remove STO_SH5_ISA32
	processing.
2020-04-21 11:35:43 +09:30
GDB Administrator 0ff8f4b9f0 Automatic date update in version.in 2020-04-21 00:00:11 +00:00
Stephen Casner 23c8270e9d When bfd/pdp11.c was copied from bfd/aoutx.h, the #defines for external symbol types N_TEXT etc. were #undef'd and then #define'd with new values. But N_STAB was not changed even though the new value for N_EXT overlapped with it. This caused aout_link_write_symbols() to treat global symbols referenced in the source but defined in a linker script as undefined.
Separately, in translate_symbol_table() the 16-bit symbol values were sign extended to unsigned long (e.g., 64 bits) when they really should be treated as unsigned so the value remains 16 bits.

	PR 25828
	* pdp11.c (N_STAB): Modify value to avoid conflict with N_EXT
	causing globals from linker script to be treated as debug symbols.
	(translate_symbol_table): Don't sign-extend symbol values from 16
	to 64 bits in nm output.
2020-04-20 12:49:50 +01:00