Commit Graph

16473 Commits

Author SHA1 Message Date
Nobody
ae2c13e275 Binutils 2.35 with MCST patches 2022-08-11 20:17:07 +03:00
97ccaa1a4c Merge db49701327 (not working) 2022-08-10 13:50:15 +03:00
Nobody
e0892d32d3 Binutils with MCST patches 2020-10-14 00:22:48 +03:00
GDB Administrator
db49701327 Automatic date update in version.in 2020-08-13 00:00:24 +00:00
Jose E. Marchesi
9fdc8d9659 bpf: fix false overflow in eBPF ELF backend linker
When performing DISP{16,32} relocations, the eBPF ELF backend linker
needs to convert the relocation from an address into a signed number
of 64-bit words (minus one) to jump.

Because of this unsigned-to-signed conversion, special care needs to
be taken when dividing to ensure the sign bits remain correct.
Otherwise, a false relocation overflow error can be triggered.

bfd/ChangeLog

2020-08-07  David Faust  <david.faust@oracle.com>

	* elf64-bpf.c (bpf_elf_relocate_section): Ensure signed division for
	DISP16 and DISP32 relocations.

ld/ChangeLog

2020-08-07  David Faust  <david.faust@oracle.com>

	* testsuite/ld-bpf/call-3.s: New file.
	* testsuite/ld-bpf/call-3.d: Likewise.
2020-08-12 15:42:24 +02:00
Jose E. Marchesi
9478b1cc94 bpf: relocation fixes for eBPF ELF backend
The eBPF ELF backend was not properly recording relocation addends
during installation, nor reading and applying them when performing
the final relocation. This lead to various issues with incorrect
relocations.

These issues are fixed with a new howto special function to install
the relocations, and updates to bpf_elf_relocate_section to read and
use the addends as recorded in the input_bfd.

bfd/ChangeLog

2020-08-05  David Faust  <david.faust@oracle.com>

	* elf64-bpf.c (bpf_elf_generic_reloc): New function.
	(bpf_elf_howto_table): Use it here.
	(bpf_elf_relocate_section): Use addends recorded in input_bfd for
	instruction and data relocations.

ld/ChangeLog

2020-08-05  David Faust  <david.faust@oracle.com>

	* testsuite/ld-bpf/call-2.s: New file.
	* testsuite/ld-bpf/call-2.d: Likewise.
	* testsuite/ld-bpf/reloc-data-be.d: Likewise.
	* testsuite/ld-bpf/reloc-data-le.d: Likewise.
	* testsuite/ld-bpf/reloc-data.s: Likewise.
	* testsuite/ld-bpf/reloc-insn-external-be.d: Likewise.
	* testsuite/ld-bpf/reloc-insn-external-le.d: Likewise.
	* testsuite/ld-bpf/reloc-insn-external.s: Likewise.
	* testsuite/ld-bpf/reloc-insn32-be.d: Likewise.
	* testsuite/ld-bpf/reloc-insn32-le.d: Likewise.
	* testsuite/ld-bpf/reloc-insn32.s: Likewise.
	* testsuite/ld-bpf/reloc-insn64-be.d: Likewise.
	* testsuite/ld-bpf/reloc-insn64-le.d: Likewise.
	* testsuite/ld-bpf/reloc-insn64.s: Likewise.
2020-08-12 15:41:34 +02:00
Nick Clifton
6ef598a264 Remove spurious text in changelog entry 2020-08-12 11:28:52 +01:00
GDB Administrator
69fbc94600 Automatic date update in version.in 2020-08-12 00:00:27 +00:00
GDB Administrator
5f3db80323 Automatic date update in version.in 2020-08-11 00:00:31 +00:00
GDB Administrator
5376cb0565 Automatic date update in version.in 2020-08-10 00:00:31 +00:00
GDB Administrator
3d28c67888 Automatic date update in version.in 2020-08-09 00:00:25 +00:00
GDB Administrator
8bac9a7749 Automatic date update in version.in 2020-08-08 00:00:24 +00:00
GDB Administrator
f088ae8969 Automatic date update in version.in 2020-08-07 00:00:27 +00:00
GDB Administrator
c91bff415f Automatic date update in version.in 2020-08-06 00:00:21 +00:00
GDB Administrator
34266d22bb Automatic date update in version.in 2020-08-05 00:00:29 +00:00
GDB Administrator
d4c09da802 Automatic date update in version.in 2020-08-04 00:00:28 +00:00
GDB Administrator
92f0ea10d6 Automatic date update in version.in 2020-08-03 00:00:23 +00:00
GDB Administrator
4d9145534f Automatic date update in version.in 2020-08-02 00:00:22 +00:00
GDB Administrator
41a4b8c852 Automatic date update in version.in 2020-08-01 00:00:24 +00:00
GDB Administrator
b54c2337de Automatic date update in version.in 2020-07-31 00:00:30 +00:00
Szabolcs Nagy
4d4f8ee981 aarch64: set sh_entsize of .plt to 0
On aarch64 the first PLT entry is 32 bytes, subsequent entries
are 16 bytes by default but can be 24 bytes with BTI or with
PAC-PLT.

sh_entsize of .plt was set to the PLT entry size, so in some
cases sh_size % sh_entsize != 0, which breaks some tools.

Note that PLT0 (and the TLSDESC stub code which is also in the
PLT) were historically not padded up to meet the sh_size
requirement, but to ensure that PLT stub code is aligned on
cache lines. Similar layout is present on other targets too
which just happens to make sh_size a multiple of sh_entsize and
it is not expected that sh_entsize of .plt is used for anything.

This patch sets sh_entsize of .plt to 0: the section does not
hold a table of fixed-size entries so other values are not
conforming in principle to the ELF spec.

bfd/ChangeLog:

	PR ld/26312
	* elfnn-aarch64.c (elfNN_aarch64_init_small_plt0_entry): Set sh_entsize
	to 0.
	(elfNN_aarch64_finish_dynamic_sections): Remove sh_entsize setting.

(cherry picked from commit 4d3bb35620e70d543d438bf21be1307f7ea0f5d0)
2020-07-30 17:41:29 +01:00
GDB Administrator
89a9065674 Automatic date update in version.in 2020-07-30 00:00:29 +00:00
GDB Administrator
5fca9e53fd Automatic date update in version.in 2020-07-29 00:00:27 +00:00
GDB Administrator
c4747a6a57 Automatic date update in version.in 2020-07-28 00:00:26 +00:00
GDB Administrator
e5980062a6 Automatic date update in version.in 2020-07-27 00:00:23 +00:00
GDB Administrator
770a87f8e3 Automatic date update in version.in 2020-07-26 00:00:30 +00:00
GDB Administrator
577a01f8f2 Automatic date update in version.in 2020-07-25 00:00:22 +00:00
Nick Clifton
279745e566 Set version to 2.35.0 and enable development 2020-07-24 12:05:01 +01:00
Nick Clifton
2cb5c79dad 2.35 Release 2020-07-24 10:36:01 +01:00
GDB Administrator
629c67644c Automatic date update in version.in 2020-07-24 00:00:23 +00:00
GDB Administrator
60955197a1 Automatic date update in version.in 2020-07-23 00:00:28 +00:00
GDB Administrator
544fb88902 Automatic date update in version.in 2020-07-22 00:00:23 +00:00
GDB Administrator
351b4f43aa Automatic date update in version.in 2020-07-21 00:00:27 +00:00
GDB Administrator
6c5963c20e Automatic date update in version.in 2020-07-20 00:00:25 +00:00
Alan Modra
d349c8e245 Power10 stub selection
This patch better supports mixing of power10 and non-power10 code,
as might be seen in a cpu-optimized library using ifuncs to select
functions optimized for a given cpu.  Using -Wl,--no-power10-stubs
isn't that good in this situation since non-power10 notoc stubs are
slower and larger than the power10 variants, which you'd like to use
on power10 code paths.

With this change, power10 pc-relative code that makes calls marked
@notoc uses power10 stubs if stubs are necessary, and other calls use
non-power10 instructions in stubs.  This will mean that if gcc is
generating code for -mcpu=power10 but with pc-rel disabled then you'll
get the older stubs even on power10 (unless you force with
-Wl,--power10-stubs).  That shouldn't be too big a problem: stubs that
use r2 are reasonable.  It's just the ones that set up addressing
using "mflr 12; bcl 20,31,.+4; mflr 11; mtlr 12" that should be
avoided if possible.

bfd/
	* elf64-ppc.c (struct ppc_link_hash_table): Add has_power10_relocs.
	(select_alt_stub): New function.
	(ppc_get_stub_entry): Use it here.
	(ppc64_elf_check_relocs): Set had_power10_relocs rather than
	power10_stubs.
	(ppc64_elf_size_stubs): Clear power10_stubs here instead.  Don't
	merge notoc stubs with other varieties when power10_stubs is "auto".
	Instead dup the stub hash table entry.
	(plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
	tests of power10_stubs.
ld/
	* emultempl/ppc64elf.em (power10-stubs): Accept optional "auto" arg.
	* ld.texi (power10-stubs): Update.
	* testsuite/ld-powerpc/callstub-1.d: Force --power10-stubs.
	* testsuite/ld-powerpc/callstub-2.d: Relax branch offset comparison.
	* testsuite/ld-powerpc/callstub-4.d: New test.
	* testsuite/ld-powerpc/notoc.d: Force --no-power10-stubs.
	* testsuite/ld-powerpc/notoc3.d,
	* testsuite/ld-powerpc/notoc3.s,
	* testsuite/ld-powerpc/notoc3.wf: New test.
	* testsuite/ld-powerpc/powerpc.exp: Run new tests.  Pass
	--no-power10-stubs for notoc link.

(cherry picked from commit e10a07b32dc1faed25b5bbcbbc47d68e2ff537b9)
2020-07-19 12:31:15 +09:30
GDB Administrator
c6e3e5b207 Automatic date update in version.in 2020-07-19 00:00:30 +00:00
GDB Administrator
3bd55357f3 Automatic date update in version.in 2020-07-18 00:00:26 +00:00
GDB Administrator
9e56d38f0d Automatic date update in version.in 2020-07-17 00:00:32 +00:00
GDB Administrator
11c62d7847 Automatic date update in version.in 2020-07-16 00:00:29 +00:00
Hans-Peter Nilsson
131af83de3 mmix bfd: fix bfd_assert for R_MMIX_PUSHJ_STUBBABLE against undef'd symbol
Spotted when inspecting gcc testsuite logs, but this already is
covered by the ld-mmix testsuite, it's just that the assert is ignored
since the regexp match is for a substring and not anchored.

With the anchors added but not the bugfix, the ld.log shows that the
asserts cause a non-match as intended:

Executing on host: sh -c {./ld-new   -LX/src/ld/testsuite/ld-mmix  -m elf64mmix -o tmpdir/dump tmpdir/undef-2.o tmpdir/start.o  2>&1}  /dev/null dump.tmp (timeout = 300)
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'
failed with: <./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'>, expected: <\A[^\n\r]*undefined reference to `undefd'\Z>
FAIL: ld-mmix/undef-2

Gone with the fix of course, leaving just the intended "undefined
reference" line.

I'm not going to add anchors manually for all the "error:" strings in
the test-suite, not even in the mmix parts.  Sorry, but I'll just do
it for *these* specific undefined-reference tests.

Just a thought: maybe the run_dump_test "error:" string should
*automatically* get anchor marks prepended and appended for a single
line match as in the patch, "\A[^\n\r]*" prepended and \Z appended
unless either anchor mark or \r or \n is present in the regexp?

Committed.

bfd:
	* elf64-mmix.c (mmix_elf_relax_section): Improve accounting for
	R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols.

ld/testsuite:
	* testsuite/ld-mmix/undef-1.d, testsuite/ld-mmix/undef-1m.d,
	testsuite/ld-mmix/undef-2.d, testsuite/ld-mmix/undef-2m.d: Add
	start- and end-anchors to error-string to match just a
	single-line error-message.

(cherry picked from commit a8a48c756c0da3a49008662e14ae582764ddd0bb)
2020-07-15 20:16:27 +02:00
Nick Clifton
78fede7066 Fix an illegal memory access in the BFD library which can be triggered by an attempt to parse a corrupt PE format file.
PR26240
	* coffgen.c (coff_get_normalized_symtab): Fix off-by-one error in
	check for aux entries that overflow the buufer.
2020-07-15 11:15:16 +01:00
GDB Administrator
d804c486ce Automatic date update in version.in 2020-07-15 00:00:27 +00:00
GDB Administrator
eadcc10bbd Automatic date update in version.in 2020-07-14 00:00:37 +00:00
GDB Administrator
d50b9573f4 Automatic date update in version.in 2020-07-13 00:00:24 +00:00
GDB Administrator
395330cb68 Automatic date update in version.in 2020-07-12 00:00:27 +00:00
GDB Administrator
2c7e98d60d Automatic date update in version.in 2020-07-11 00:00:28 +00:00
Alan Modra
8c1ec83fba PowerPC64 ld --no-power10-stubs
Needed for libraries that use ifuncs or other means to support
cpu-optimized versions of functions, some power10, some not, and those
functions make calls using linkage stubs.

bfd/
	* elf64-ppc.h (struct ppc64_elf_params): Add power10_stubs.
	* elf64-ppc.c (struct ppc_link_hash_table): Delete
	power10_stubs.
	(ppc64_elf_check_relocs): Adjust setting of power10_stubs.
	(plt_stub_size, ppc_build_one_stub, ppc_size_one_stub): Adjust
	uses of power10_stubs.
ld/
	* emultempl/ppc64elf.em (params): Init new field.
	(enum ppc64_opt): Add OPTION_POWER10_STUBS and OPTION_NO_POWER10_STUBS.
	(PARSE_AND_LIST_LONGOPTS): Support --power10-stubs and
	--no-power10-stubs.
	(PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Likewise.
	* testsuite/ld-powerpc/callstub-3.d: New test.
	* testsuite/ld-powerpc/powerpc.exp: Run it.

(cherry picked from commit d3b10ee787216d304a858246656ed2fdaecdfd93)
2020-07-10 12:09:58 +09:30
GDB Administrator
b8c0584c4b Automatic date update in version.in 2020-07-10 00:00:32 +00:00
Nick Clifton
e6c9c44869 Update French translation in the bfd sub-directory 2020-07-09 14:21:42 +01:00
GDB Administrator
3c4a3ee75f Automatic date update in version.in 2020-07-09 00:00:33 +00:00