]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 18 Apr 2022 00:00:56 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 17 Apr 2022 00:00:50 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 16 Apr 2022 00:00:50 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 15 Apr 2022 00:00:53 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 14 Apr 2022 00:01:03 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoLoongArch: Update ABI eflag in elf header.
Liuzhen Song [Wed, 13 Apr 2022 09:39:38 +0000 (10:39 +0100)] 
LoongArch: Update ABI eflag in elf header.

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 13 Apr 2022 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 12 Apr 2022 00:01:05 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 11 Apr 2022 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 10 Apr 2022 00:00:57 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 9 Apr 2022 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 8 Apr 2022 00:01:00 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoIBM zSystems: Add support for z16 as CPU name.
Andreas Krebbel [Thu, 7 Apr 2022 05:45:49 +0000 (07:45 +0200)] 
IBM zSystems: Add support for z16 as CPU name.

So far z16 was identified as arch14. After the machine has been
announced we can now add the real name.

(cherry picked from commit 69341966def7f6551bc4452684136831d6a6941c)

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 7 Apr 2022 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 6 Apr 2022 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 5 Apr 2022 00:00:53 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 4 Apr 2022 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 3 Apr 2022 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 2 Apr 2022 00:00:53 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 1 Apr 2022 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 31 Mar 2022 00:00:53 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 30 Mar 2022 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 29 Mar 2022 00:00:38 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 Mar 2022 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 Mar 2022 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 26 Mar 2022 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 25 Mar 2022 00:00:56 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agolibctf, ld: diagnose corrupted CTF header cth_strlen
Nick Alcock [Fri, 18 Mar 2022 00:49:11 +0000 (00:49 +0000)] 
libctf, ld: diagnose corrupted CTF header cth_strlen

The last section in a CTF dict is the string table, at an offset
represented by the cth_stroff header field.  Its length is recorded in
the next field, cth_strlen, and the two added together are taken as the
size of the CTF dict.  Upon opening a dict, we check that none of the
header offsets exceed this size, and we check when uncompressing a
compressed dict that the result of the uncompression is the same length:
but CTF dicts need not be compressed, and short ones are not.
Uncompressed dicts just use the ctf_size without checking it.  This
field is thankfully almost unused: it is mostly used when reserializing
a dict, which can't be done to dicts read off disk since they're
read-only.

However, when opening an uncompressed foreign-endian dict we have to
copy it out of the mmaped region it is stored in so we can endian-
swap it, and we use ctf_size when doing that.  When the cth_strlen is
corrupt, this can overrun.

Fix this by checking the ctf_size in all uncompressed cases, just as we
already do in the compressed case.  Add a new test.

This came to light because various corrupted-CTF raw-asm tests had an
incorrect cth_strlen: fix all of them so they produce the expected
error again.

libctf/
PR libctf/28933
* ctf-open.c (ctf_bufopen_internal): Always check uncompressed
CTF dict sizes against the section size in case the cth_strlen is
corrupt.

ld/
PR libctf/28933
* testsuite/ld-ctf/diag-strlen-invalid.*: New test,
derived from diag-cttname-invalid.s.
* testsuite/ld-ctf/diag-cttname-invalid.s: Fix incorrect cth_strlen.
* testsuite/ld-ctf/diag-cttname-null.s: Likewise.
* testsuite/ld-ctf/diag-cuname.s: Likewise.
* testsuite/ld-ctf/diag-parlabel.s: Likewise.
* testsuite/ld-ctf/diag-parname.s: Likewise.

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 24 Mar 2022 00:00:46 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agodlltool: Use the output name as basis for deterministic temp prefixes
Nick Clifton [Wed, 23 Mar 2022 11:39:49 +0000 (11:39 +0000)] 
dlltool: Use the output name as basis for deterministic temp prefixes

PR 28885
* dlltool.c (main): use imp_name rather than dll_name when
generating a temporary file name.

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 23 Mar 2022 00:00:44 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 22 Mar 2022 00:00:54 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Mar 2022 00:00:34 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Mar 2022 00:00:44 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Mar 2022 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Mar 2022 00:00:50 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 17 Mar 2022 00:01:05 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoUpdated Serbian (for binutils/) and Russian (for gprof/) translations
Nick Clifton [Wed, 16 Mar 2022 12:48:55 +0000 (12:48 +0000)] 
Updated Serbian (for binutils/) and Russian (for gprof/) translations

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 16 Mar 2022 00:01:01 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Mar 2022 00:01:11 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 14 Mar 2022 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoPR28959, obdump doesn't disassemble mftb instruction
Alan Modra [Sun, 13 Mar 2022 12:24:25 +0000 (22:54 +1030)] 
PR28959, obdump doesn't disassemble mftb instruction

Without a -M cpu option given, powerpc objdump defaults currently to
-Mpower10 but -Many is also given.  Commit 1ff6a3b8e562 regressed
-Many disassembly of instructions that are encoded differently
depending on cpu, such as mftb which has pre- and post-power4
encodings.

PR 28959
* ppc-dis.c (lookup_powerpc): Revert 2021-05-28 change.  Instead
only look at deprecated PPC_OPCODE_RAW bit when -Many.

(cherry picked from commit b508e46bf9c5b2cef5821b399dfc3b8009a81836)

3 years agoPowerPC64 DT_RELR relative reloc addresses
Alan Modra [Wed, 2 Mar 2022 13:34:57 +0000 (00:04 +1030)] 
PowerPC64 DT_RELR relative reloc addresses

Section addresses can change between ppc64_elf_size_stubs and
ppc64_elf_build_stubs due to .eh_frame editing.  The idea of stashing
r_offset final addresses calculated in ppc64_elf_size_stubs for use by
ppc64_elf_build_stubs was never a good idea.  Instead, we need to keep
section/offset pairs.

* elf64-ppc.c (struct ppc_link_hash_table): Delete relr_addr.
Add relr section/offset array.
(append_relr_off): Rewrite.  Update all callers.
(sort_relr): New function.
(ppc64_elf_size_stubs): Adjust to suit new relative reloc stash.
(ppc64_elf_build_stubs): Likewise.

(cherry picked from commit 0aac2413d39d9f6d9e6879a0daa6bd5dea3e0fe3)
(cherry picked from commit e26ff4b5a90a67fc440052f6101464939347b1f2)

3 years agoWork around gcc-4 warnings in elf64-ppc.c
Alan Modra [Wed, 9 Feb 2022 05:51:02 +0000 (16:21 +1030)] 
Work around gcc-4 warnings in elf64-ppc.c

elf64-ppc.c: In function 'ppc64_elf_size_dynamic_sections':
elf64-ppc.c:10309:45: error: value computed is not used [-Werror=unused-value]
     ++lgot_ents, ++lgot_masks, isym != NULL && isym++)

It is of course a silly warning, fixed in later versions of gcc.  I
wrote "isym != NULL && isym++" rather than the simpler "isym++" to
stop sanitisers complaining about incrementing a NULL pointer.  isym
is of course unused in any code path where it might start off as
NULL.  Sometimes you can't win.  So don't try to be clever in reading
local symbols only when needed.  99 times out of 100 they will be
cached anyway.

* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Avoid annoying
warnings by always reading local syms.
(ppc64_elf_layout_multitoc): Likewise.

(cherry picked from commit c9fecd62838e481d9902a7fba42a6928370c9b10)

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 13 Mar 2022 00:01:04 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 12 Mar 2022 00:00:57 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 11 Mar 2022 00:01:33 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 10 Mar 2022 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 9 Mar 2022 00:00:53 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 8 Mar 2022 00:01:29 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 7 Mar 2022 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 6 Mar 2022 00:00:51 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 5 Mar 2022 00:01:12 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 4 Mar 2022 00:00:59 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 3 Mar 2022 00:01:37 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 2 Mar 2022 00:01:18 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoRevert "Check thin archive element file size against archive header"
Alan Modra [Tue, 1 Mar 2022 11:24:34 +0000 (21:54 +1030)] 
Revert "Check thin archive element file size against archive header"

This reverts commit 48e3e6aec8a4f37d00ea6c0da3ab45e76490e3db.

PR 28929
* archive.c (_bfd_get_elt_at_filepos): Don't check thin archive
element file size.

(cherry picked from commit 581c5ba435538c23fe63d6884ff885b7ef333568)

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 1 Mar 2022 00:01:56 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 Feb 2022 00:01:05 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 Feb 2022 00:00:57 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 26 Feb 2022 00:01:15 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 25 Feb 2022 00:01:03 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 24 Feb 2022 00:00:50 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agobinutils 2.38 vs. ppc32 linux kernel
Alan Modra [Mon, 21 Feb 2022 00:28:57 +0000 (10:58 +1030)] 
binutils 2.38 vs. ppc32 linux kernel

Commit b25f942e18d6 made .machine more strict.  Weaken it again.

* config/tc-ppc.c (ppc_machine): Treat an early .machine specially,
keeping sticky options to work around gcc bugs.

(cherry picked from commit cebc89b9328eab994f6b0314c263f94e7949a553)

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 23 Feb 2022 00:01:33 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 22 Feb 2022 00:01:12 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Feb 2022 00:00:55 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Feb 2022 00:00:50 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Feb 2022 00:01:19 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Feb 2022 00:00:53 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoUpdated Serbian translations for the bfd, gold, ld and opcodes directories
Nick Clifton [Thu, 17 Feb 2022 15:17:48 +0000 (15:17 +0000)] 
Updated Serbian translations for the bfd, gold, ld and opcodes directories

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 17 Feb 2022 00:00:58 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agold: Keep indirect symbol from IR if referenced from shared object
H.J. Lu [Fri, 11 Feb 2022 23:13:19 +0000 (15:13 -0800)] 
ld: Keep indirect symbol from IR if referenced from shared object

Don't change indirect symbol defined in IR to undefined if it is
referenced from shared object.

bfd/

PR ld/28879
* elflink.c (_bfd_elf_merge_symbol): Don't change indirect
symbol defined in IR to undefined if it is referenced from
shared object.

ld/

PR ld/28879
* testsuite/ld-plugin/lto.exp: Run PR ld/28879 tests.
* testsuite/ld-plugin/pr28879a.cc: New file.
* testsuite/ld-plugin/pr28879b.cc: Likewise.

(cherry picked from commit 20ea3acc727f3be6322dfbd881e506873535231d)

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 16 Feb 2022 00:01:04 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoi386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTREL
H.J. Lu [Tue, 15 Feb 2022 23:03:02 +0000 (15:03 -0800)] 
i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTREL

Update I386_NEED_DYNAMIC_RELOC_TYPE_P to allow R_386_TLS_IE for relocation
in read-only section.

bfd/

PR ld/28894
* elfxx-x86.h (I386_NEED_DYNAMIC_RELOC_TYPE_P): Allow
R_386_TLS_IE.

ld/
PR ld/28894
* testsuite/ld-i386/i386.exp: Run pr28894.
* testsuite/ld-i386/pr28894.d: New file.
* testsuite/ld-i386/pr28894.s: Likewise.

(cherry picked from commit 3319ba7a8d6a42ba071d691789bc184632399331)

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Feb 2022 00:01:03 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoPR28882, build failure with gcc-4.2 due to use of 0b literals
Alan Modra [Sat, 12 Feb 2022 23:26:51 +0000 (09:56 +1030)] 
PR28882, build failure with gcc-4.2 due to use of 0b literals

PR 28882
* elf/loongarch.h: Replace binary literals with hex.

(cherry picked from commit ccbaaa36174c2c3184344ee0e6db648491149a33)

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 14 Feb 2022 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 13 Feb 2022 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sat, 12 Feb 2022 00:00:55 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agox86: Disallow invalid relocation against protected symbol
H.J. Lu [Wed, 9 Feb 2022 23:51:22 +0000 (15:51 -0800)] 
x86: Disallow invalid relocation against protected symbol

I am checking this into master and will backport it to 2.38 branch.

H.J
----
On x86, GCC 12 supports -mno-direct-extern-access to enable canonical
reference to protected function and disable copy relocation.  With
-mno-direct-extern-access, the canonical protected function symbols must
be accessed via canonical reference and the protected data symbols in
shared libraries are non-copyable. Under glibc 2.35, non-canonical
reference to the canonical protected function will get the run-time error:

./y: internal_f: ./libfoo.so: non-canonical reference to canonical protected function

and copy relocations against the non-copyable protected symbols will get
the run-time error:

./x: internal_i: ./libfoo.so: copy relocation against non-copyable protected symbol

Update x86 linker to disallow non-canonical reference to the canonical
protected function:

ld: plt.o: non-canonical reference to canonical protected function `internal_f' in libfoo.so
ld: failed to set dynamic section sizes: bad value

and copy relocation against the non-copyable protected symbol:

ld: main.o: copy relocation against non-copyable protected symbol `internal_i' in libfoo.so

at link-time.

bfd/

PR ld/28875
* elf-properties.c (_bfd_elf_parse_gnu_properties): Don't skip
shared libraries for GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.
* elf32-i386.c (elf_i386_scan_relocs): Disallow non-canonical
reference to canonical protected function.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
* elfxx-x86.c (elf_x86_allocate_dynrelocs): Don't allow copy
relocation against non-copyable protected symbol.

ld/

PR ld/28875
* testsuite/ld-i386/i386.exp: Check non-canonical reference to
canonical protected function and check copy relocation against
non-copyable protected symbol.
* testsuite/ld-i386/pr21997-1.err: New file.
* testsuite/ld-i386/pr28875.err: Likewise.
* testsuite/ld-i386/pr28875a.c: Likewise.
* testsuite/ld-i386/pr28875b.c: Likewise.
* testsuite/ld-x86-64/pr21997-1a.err: Updated.
* testsuite/ld-x86-64/pr21997-1b.err: Likewise.
* testsuite/ld-x86-64/pr28875-data.err: New file.
* testsuite/ld-x86-64/pr28875-func.err: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Check non-canonical reference
to canonical protected function and check copy relocation against
non-copyable protected symbol.

(cherry picked from commit ebb191adac4ab45498dec0bfaac62f0a33537ba4)

3 years agoAutomatic date update in version.in
GDB Administrator [Fri, 11 Feb 2022 00:01:08 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Thu, 10 Feb 2022 00:00:59 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoRe-enable development on the 2.38 branch
Nick Clifton [Wed, 9 Feb 2022 13:35:22 +0000 (13:35 +0000)] 
Re-enable development on the 2.38 branch

3 years agoThis is the 2.38 GNU Binutils release binutils-2_38
Nick Clifton [Wed, 9 Feb 2022 12:01:02 +0000 (12:01 +0000)] 
This is the 2.38 GNU Binutils release

3 years agoAutomatic date update in version.in
GDB Administrator [Wed, 9 Feb 2022 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoRISC-V: Stop reporting warnings for mismatched extension versions
Palmer Dabbelt [Mon, 7 Feb 2022 20:14:30 +0000 (12:14 -0800)] 
RISC-V: Stop reporting warnings for mismatched extension versions

The extension version checking logic is really just too complicated to
encode into the linker, trying to do so causes more harm than good.
This removes the checks and the associated tests, leaving the logic to
keep the largest version of each extension linked into the target.

bfd/

* elfnn-riscv.c (riscv_version_mismatch): Rename to
riscv_update_subset_version, and stop reporting warnings on
version mismatches.
(riscv_merge_std_ext): Adjust calls to riscv_version_mismatch.
(riscv_merge_multi_letter_ext): Likewise.

ld/
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Remove
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02.d: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02a.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02b.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02c.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-arch-failed-02d.s: Likewise
* testsuite/ld-riscv-elf/attr-merge-user-ext-01.d: New test.
* testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i21_m2p0.s:
Likewise.
* testsuite/ld-riscv-elf/attr-merge-user-ext-rv32i21_m2p1.s:
Likewise.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Remove obselete
attr-merge-arch-failed-{01,02}, replace with
attr-merge-user-ext-01.

Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
3 years agoi386: Allow GOT32 relocations against ABS symbols
H.J. Lu [Mon, 7 Feb 2022 23:22:19 +0000 (15:22 -0800)] 
i386: Allow GOT32 relocations against ABS symbols

GOT32 relocations are allowed since absolute value + addend is stored in
the GOT slot.

Tested on glibc 2.35 build with GCC 11.2 and -Os.

bfd/

PR ld/28870
* elfxx-x86.c (_bfd_elf_x86_valid_reloc_p): Also allow GOT32
relocations.

ld/

PR ld/28870
* testsuite/ld-i386/i386.exp: Run pr28870.
* testsuite/ld-i386/pr28870.d: New file.
* testsuite/ld-i386/pr28870.s: Likewise.

(cherry picked from commit 30a954525f4e53a9cd50a1a8a6f201c7cf6595c7)

3 years agoAutomatic date update in version.in
GDB Administrator [Tue, 8 Feb 2022 00:01:04 +0000 (00:01 +0000)] 
Automatic date update in version.in

3 years agoRevert "elf: Remove the 1-page gap before the RELRO segment"
Alan Modra [Sun, 6 Feb 2022 23:12:03 +0000 (09:42 +1030)] 
Revert "elf: Remove the 1-page gap before the RELRO segment"

This reverts commit 2f83249c13d86065b4c7cdb198ea871017b4bba1.

PR ld/28743
* ldlang.c (lang_size_relro_segment_1): Revert 2022-01-10 changes.
* testsuite/ld-i386/pr20830.d: Likewise.
* testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
* testsuite/ld-x86-64/pr14207.d: Likewise.
* testsuite/ld-x86-64/pr18176.d: Likewise.
* testsuite/ld-x86-64/pr20830a-now.d: Likewise.
* testsuite/ld-x86-64/pr20830a.d: Likewise.
* testsuite/ld-x86-64/pr20830b-now.d: Likewise.
* testsuite/ld-x86-64/pr20830b.d: Likewise.
* testsuite/ld-x86-64/pr21038a-now.d: Likewise.
* testsuite/ld-x86-64/pr21038a.d: Likewise.
* testsuite/ld-x86-64/pr21038b-now.d: Likewise.
* testsuite/ld-x86-64/pr21038c-now.d: Likewise.
* testsuite/ld-x86-64/pr21038c.d: Likewise.

3 years agoRevert "ld: Rewrite lang_size_relro_segment_1"
Alan Modra [Sun, 6 Feb 2022 23:07:51 +0000 (09:37 +1030)] 
Revert "ld: Rewrite lang_size_relro_segment_1"

This reverts commit 8b7c6a1fbab5b0efc6abb50cdb24aef3954ac018.

PR ld/28743
PR ld/28819
* ldlang.c (lang_size_relro_segment_1): Revert 2022-01-14 change.
testsuite/ld-x86-64/pr28743-1.d: Likewise.
testsuite/ld-x86-64/pr28743-1.s: Likewise.
testsuite/ld-x86-64/x86-64.exp: Likewise.

3 years agoAutomatic date update in version.in
GDB Administrator [Mon, 7 Feb 2022 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agoAutomatic date update in version.in
GDB Administrator [Sun, 6 Feb 2022 00:00:55 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 years agox86: Skip undefined symbol when finishing DT_RELR
H.J. Lu [Sat, 5 Feb 2022 15:26:31 +0000 (07:26 -0800)] 
x86: Skip undefined symbol when finishing DT_RELR

Don't abort for undefined symbol when finishing DT_RELR.  Instead, skip
undefined symbol.  Undefined symbol will be reported by relocate_section.

* elfxx-x86.c (elf_x86_size_or_finish_relative_reloc): Skip
undefined symbol in finishing phase.

(cherry picked from commit a9e61227c09c03d5cb54f9c88520baffc1d86c86)

3 years agoPR28827 testcase
Alan Modra [Sat, 5 Feb 2022 05:06:58 +0000 (15:36 +1030)] 
PR28827 testcase

This testcase triggers a stub sizing error with the patches applied
for PR28743 (commit 2f83249c13d8 and c804c6f98d34).

PR 28827
* testsuite/ld-powerpc/pr28827-1.s,
* testsuite/ld-powerpc/pr28827-1.d: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.

(cherry picked from commit 9810db10f726f47c8e878ca4b0b4b4f5e9c16a5d)
(cherry picked from commit 0acf434a23768449cbb4b3732355f3f2febecaee)

3 years agoEnable "size" as a dumpprog in ld
Alan Modra [Sat, 5 Feb 2022 07:05:09 +0000 (17:35 +1030)] 
Enable "size" as a dumpprog in ld

binutils/
* testsuite/lib/binutils-common.exp (run_dump_test): Reference
global SIZE and SIZEFLAGS.
ld/
* testsuite/config/default.exp: Define SIZE and SIZEFLAGS.

(cherry picked from commit cd8adbf3017272877c7e196e2e326f888f207bd9)

3 years agoDetect .eh_frame_hdr earlier for SIZEOF_HEADERS
Alan Modra [Fri, 4 Feb 2022 09:00:47 +0000 (19:30 +1030)] 
Detect .eh_frame_hdr earlier for SIZEOF_HEADERS

Current code detects the need for PT_GNU_EH_FRAME using a field set by
_bfd_elf_discard_section_eh_frame_hdr, which is called fairly late in
the linking process.  Use the elf hash table eh_info instead, which is
set up earlier by size_dynamic_sections.

* elf-bfd.h (struct output_elf_obj_tdata): Delete eh_frame_hdr.
(elf_eh_frame_hdr): Don't define.
(_bfd_elf_discard_section_eh_frame_hdr): Update prototype.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Delete
abfd parameter.  Don't set elf_eh_frame_hdr.
* elf.c (elf_eh_frame_hdr): New function.
(get_program_header_size): Adjust elf_eh_frame_hdr call.
(_bfd_elf_map_sections_to_segments): Likewise.

(cherry picked from commit 8df52eeeb06efcccd6b840689ad8e11ebb264e7f)

3 years agoPowerPC64 treatment of absolute symbols
Alan Modra [Wed, 26 Jan 2022 00:01:36 +0000 (10:31 +1030)] 
PowerPC64 treatment of absolute symbols

Supporting -static-pie on PowerPC64 requires the linker to properly
treat SHN_ABS symbols for cases like glibc's _nl_current_LC_CTYPE_used
absolute symbol.  I've been slow to fix the linker on powerpc because
there is some chance that this will break some shared libraries or
PIEs.

bfd/
* elf64-ppc.c (ppc64_elf_check_relocs): Consolidate local sym
handling code.  Don't count dyn relocs against non-dynamic
absolute symbols.
(dec_dynrel_count): Adjust to suit.
(ppc64_elf_edit_toc): Don't remove entries for absolute symbols
when pic.
(allocate_got): Don't allocate space for got relocs against
non-dynamic absolute syms.
(ppc64_elf_layout_multitoc): Likewise.
(got_and_plt_relr): Likewise.
(ppc64_elf_size_dynamic_sections): Likewise for local got.
(got_and_plt_relr_for_local_syms): Likewise.
(ppc64_elf_size_stubs): Don't allocate space for relr either.
(ppc64_elf_relocate_section): Don't write relocs against non-dynamic
absolute symbols.  Don't optimise got and toc code sequences
loading absolute symbol entries.
ld/
* testsuite/ld-powerpc/abs-reloc.s,
* testsuite/ld-powerpc/abs-static.d,
* testsuite/ld-powerpc/abs-static.r,
* testsuite/ld-powerpc/abs-pie.d,
* testsuite/ld-powerpc/abs-pie.r,
* testsuite/ld-powerpc/abs-shared.d,
* testsuite/ld-powerpc/abs-shared.r,
* testsuite/ld-powerpc/abs-pie-relr.d,
* testsuite/ld-powerpc/abs-pie-relr.r,
* testsuite/ld-powerpc/abs-shared-relr.d,
* testsuite/ld-powerpc/abs-shared-relr.r: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.

(cherry picked from commit 3a3a4c1fe4ccb1914d29fbf8f5930d55aacec78f)

3 years agoPR28827, assertion building LLVM 9 on powerpc64le-linux-gnu
Alan Modra [Thu, 27 Jan 2022 23:16:13 +0000 (09:46 +1030)] 
PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu

The assertion is this one in ppc_build_one_stub
  BFD_ASSERT (stub_entry->stub_offset >= stub_entry->group->stub_sec->size);
It is checking that a stub doesn't overwrite the tail of a previous
stub, so not something trivial.

Normally, stub sizing iterates until no stubs are added, detected by
no change in stub section size.  Iteration also continues if no stubs
are added but one or more stubs increases in size, which also can be
detected by a change in stub section size.  But there is a
pathological case where stub section sizing decreases one iteration
then increases the next.  To handle that situation, stub sizing also
stops at more than STUB_SHRINK_ITER (20) iterations when calculated
stub section size is smaller.  The previous larger size is kept for
the actual layout (so that building the stubs, which behaves like
another iteration of stub sizing, will see the stub section sizes
shrink).  The problem with that stopping condition is that it assumes
that stub sizing is only affected by addresses external to the stub
sections, which isn't always true.

This patch fixes that by also keeping larger individual stub_offset
addresses past STUB_SHRINK_ITER.  It also catches a further
pathological case where one stub shrinks and another expands in such a
way that no stub section size change is seen.

PR 28827
* elf64-ppc.c (struct ppc_link_hash_table): Add stub_changed.
(STUB_SHRINK_ITER): Move earlier in file.
(ppc_size_one_stub): Detect any change in stub_offset.  Keep
larger one if past STUB_SHRINK_ITER.
(ppc64_elf_size_stubs): Iterate on stub_changed too.

(cherry picked from commit 0441f94fba61998b4bd18487aacf70a672df099c)

Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu

The previous patch wasn't quite correct.  The size and padding depends
on offset used in the current iteration, and if we're fudging the
offset past STUB_SHRINK_ITER then we'd better use that offset.  We
can't have plt_stub_pad using stub_sec->size as the offset.

PR 28827
* elf64-ppc.c (plt_stub_pad): Add stub_off param.
(ppc_size_one_stub): Set up stub_offset to value used in this
iteration before sizing the stub.  Adjust plt_stub_pad calls.

(cherry picked from commit 2405fc4016feadea33cb747d5654514f62b74ff4)

Re: PR28827, assertion building LLVM 9 on powerpc64le-linux-gnu

In trying to find a testcase for PR28827, I managed to hit a linker
error in bfd_set_section_contents with a .branch_lt input section
being too large for the output .branch_lt.

bfd/
PR 28827
* elf64-ppc.c (ppc64_elf_size_stubs): Set section size to
maxsize past STUB_SHRINK_ITER before laying out.  Remove now
unnecessary conditional setting of maxsize at start of loop.
ld/
* testsuite/ld-powerpc/pr28827-2.d,
* testsuite/ld-powerpc/pr28827-2.lnk,
* testsuite/ld-powerpc/pr28827-2.s: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.

(cherry picked from commit 9ff8aa7d418bc508dbd429576b93e30ed9dc5891)

3 years agoUpdate PowerPC64 symtocbase test
Alan Modra [Wed, 19 Jan 2022 13:17:41 +0000 (23:47 +1030)] 
Update PowerPC64 symtocbase test

Using a symbol other than .TOC. with @tocbase is an extension to the
ABI.  It is never valid to use a symbol without a definition in the
binary, and symbols on these expressions cannot be overridden.  Make
this explicit by using ".hidden" in the testcase.

* testsuite/ld-powerpc/symtocbase-1.s: Align data.  Make function
entry symbol hidden.
* testsuite/ld-powerpc/symtocbase-2.s: Likewise.
* testsuite/ld-powerpc/symtocbase.d: Adjust expected output.

(cherry picked from commit ef5684c2bdf4d4f9975650e3b7b8f9b0ff98abee)