]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
4 years agopowerpc64-ld infinite loop binutils-2_31-branch
Alan Modra [Wed, 11 Mar 2020 04:13:16 +0000 (14:43 +1030)] 
powerpc64-ld infinite loop

If this code dealing with possible conversion of inline plt sequences
is ever executed, ld will hang.  A binary with such sequences and of
code size larger than approximately 90% the reach of an unconditional
branch is the trigger.  Oops.

* elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.

(cherry picked from commit 435edf0bf231240ccecb474b74ebb49dc8db2633)

4 years agoFix PR ld/24574
Eric Botcazou [Thu, 5 Sep 2019 16:23:37 +0000 (18:23 +0200)] 
Fix PR ld/24574

This restores a line that has been dropped when the auto-import feature
of the PE-COFF linker was overhauled about one year.  It is necessary
for GDB to properly resolve extern symbol in DLLs.

ld/ChangeLog
* pe-dll.c (pe_find_data_imports): Replace again the original name
of the undefined symbol with the __imp_ prefixed one after it is
resolved.

4 years agoPR24567, assertion failure in ldlang.c:6868 when compiling with -flto
Alan Modra [Fri, 17 May 2019 09:39:42 +0000 (19:09 +0930)] 
PR24567, assertion failure in ldlang.c:6868 when compiling with -flto

As the existing comment said: "a common ought to be overridden by a
def in a -flto object".  This patch makes the code actually do that,
rather than allowing a normal object file common to override a -flto
defined symbol.

PR 24567
* plugin.c (plugin_notice): Do not let a common symbol override
a non-common definition in IR.

(cherry picked from commit af4fa23fba220c1b26bb3c8a7996b406dcc181cc)

4 years agox86: Also check x86 linker_def for non-shared definition
H.J. Lu [Wed, 17 Apr 2019 16:08:46 +0000 (09:08 -0700)] 
x86: Also check x86 linker_def for non-shared definition

Since elf_x86_linker_defined sets linker_def in elf_x86_link_hash_entry
for linker defined symbols, SYMBOL_DEFINED_NON_SHARED_P should also check
linker_def in elf_x86_link_hash_entry.

bfd/

PR ld/24458
* elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): Also check x86
linker_def.

ld/

PR ld/24458
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/24458 tests.
* testsuite/ld-x86-64/pr24458.s: New file.
* testsuite/ld-x86-64/pr24458a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458a.d: Likewise.
* testsuite/ld-x86-64/pr24458b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458b.d: Likewise.
* testsuite/ld-x86-64/pr24458c-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458c.d: Likewise.

(cherry picked from commit 4e84a8f8bbeab52fa7048873655e582ceb92534d)

5 years agoPR24355, segmentation fault in function called from ppc_finish_symbols
Alan Modra [Mon, 18 Mar 2019 11:08:36 +0000 (21:38 +1030)] 
PR24355, segmentation fault in function called from ppc_finish_symbols

This one looks to be a bug going back to 2009, git commit e054468f6c
"STT_GNU_IFUNC support for PowerPC".  That bug was carried over with
git commit 49c09209d0 "Rearrange PLT reloc output on powerpc".

If the refcount for an ifunc local sym plt entry was zero,
ppc_elf_size_dynamic_sections would correctly set plt.offset to -1 but
leave glink_offset uninitialized.  That leads to occasional segfaults
(which can be made solid with MALLOC_PERTURB_=1 when using glibc).
So, guard the write_glink_stub call with plt.offset != -1.  Also,
remove the totally ineffective attempt at writing multiple-use glink
stubs only once.

PR 24355
* elf32-ppc.c (ppc_finish_symbols): Don't call write_glink_stub
for local iplt syms with ent->plt.offset == -1.  Remove ineffective
attempt at writing glink stubs only once.

(cherry picked from commit 8cd1fe1bf525b59f4d07e5790d11d49eee7e8494)

5 years agoImport patch to fix PR23919 from the mainline.
Nick Clifton [Mon, 18 Feb 2019 15:08:57 +0000 (15:08 +0000)] 
Import patch to fix PR23919 from the mainline.

PR binutils/23919
bfd * bfd.c (bfd_update_compression_header): Explicitly set alignment.
(bfd_check_compression_header): Add uncompressed_alignment_power
argument. Check ch_addralign is a power of 2.
* bfd-in2.h: Regenerated.
* compress.c (bfd_compress_section_contents): Get and set
orig_uncompressed_alignment_pow if section is decompressed.
(bfd_is_section_compressed_with_header): Add and get
uncompressed_align_pow_p argument.
(bfd_is_section_compressed): Add uncompressed_align_power argument
to bfd_is_section_compressed_with_header call.
(bfd_init_section_decompress_status): Get and set
uncompressed_alignment_power.
* elf.c (_bfd_elf_make_section_from_shdr): Add
uncompressed_align_power argument to
bfd_is_section_compressed_with_header call.

* compress.c (bfd_is_section_compressed_with_header): Initialize
* uncompressed_align_pow_p to 0.

binutils* readelf.c (dump_sections_as_strings): Remove bogus addralign check.
(dump_sections_as_bytes): Likewise.
(load_specific_debug_sections): Likewise.
* testsuite/binutils-all/dw2-3.rS: Adjust alignment.
* testsuite/binutils-all/dw2-3.rt: Likewise.

gold * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
Get addralign from decompressed_section_contents.
* object.cc (build_compressed_section_map): Set info.addralign.
(Object::decompressed_section_contents): Add a palign
argument and store p->second.addralign in *palign if it isn't
NULL.
* object.h (Compressed_section_info): Add addralign.
(section_is_compressed): Add a palign argument, default it
to NULL, store p->second.addralign in *palign if it isn't NULL.
(Object::decompressed_section_contents): Likewise.
* output.cc (Output_section::add_input_section): Get addralign
from section_is_compressed.

5 years agogas: Pass max_bytes to TC_FRAG_INIT
H.J. Lu [Sun, 10 Feb 2019 12:34:10 +0000 (04:34 -0800)] 
gas: Pass max_bytes to TC_FRAG_INIT

ommit 3ae729d5a4f63740ed9a778960b17c2912b0bbdd
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Mar 7 04:18:45 2018 -0800

    x86: Rewrite NOP generation for fill and alignment

increased MAX_MEM_FOR_RS_ALIGN_CODE to 4095 which resulted in increase
of assembler time and memory usage by 5 times for inputs with many
.p2align directives, which is typical for LTO output.  This patch passes
max_bytes to TC_FRAG_INIT so that MAX_MEM_FOR_RS_ALIGN_CODE can be set
as needed and tracked by backend it so that HANDLE_ALIGN can check the
maximum alignment for each rs_align_code frag.  Wall time to assemble
the same cc1plus.s:

before:

423.78user 0.89system 7:05.71elapsed 99%CPU

after:

102.35user 0.27system 1:42.89elapsed 99%CPU

PR gas/24165
* config/tc-i386.h (MAX_MEM_FOR_RS_ALIGN_CODE): Set to
(alignment ? ((1 << alignment) - 1) : 1)
(i386_tc_frag_data): Add max_bytes.
(TC_FRAG_INIT): Track max_chars in max_bytes.
(HANDLE_ALIGN): Replace MAX_MEM_FOR_RS_ALIGN_CODE with
fragP->tc_frag_data.max_bytes.

(cherry picked from commit db22231044df03bbcb987496f3f29f0462b2e9ee)

5 years agox86-64: Restore PIC check for PCREL reloc against protected symbol
H.J. Lu [Wed, 6 Feb 2019 02:45:23 +0000 (18:45 -0800)] 
x86-64: Restore PIC check for PCREL reloc against protected symbol

commit bd7ab16b4537788ad53521c45469a1bdae84ad4a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Feb 13 07:34:22 2018 -0800

    x86-64: Generate branch with PLT32 relocation

removed check R_X86_64_PC32 relocation against protected symbols in
shared objects.  Since elf_x86_64_check_relocs is called after we
have seen all input files, we can check for PC-relative relocations in
elf_x86_64_check_relocs.  We should not allow PC-relative relocations
against protected symbols since address of protected function and
location of protected data may not be in the shared object.

bfd/

PR ld/24151
* elf64-x86-64.c (elf_x86_64_need_pic): Check
SYMBOL_DEFINED_NON_SHARED_P instead of def_regular.
(elf_x86_64_relocate_section): Move PIC check for PC-relative
relocations to ...
(elf_x86_64_check_relocs): Here.
(elf_x86_64_finish_dynamic_symbol): Use SYMBOL_DEFINED_NON_SHARED_P
to check if a symbol is defined in a non-shared object.
* elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): New.

ld/

PR ld/24151
* testsuite/ld-x86-64/pr24151a-x32.d: New file.
* testsuite/ld-x86-64/pr24151a.d: Likewise.
* testsuite/ld-x86-64/pr24151a.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr24151a and pr24151a-x32.

(cherry picked from commit 83924b3846361f2f76f9a6e7b5afa01c0eebbd4f)

5 years agoSPARC: fix PR ld/18841
Eric Botcazou [Thu, 7 Feb 2019 16:04:31 +0000 (17:04 +0100)] 
SPARC: fix PR ld/18841

This fixes the last ld failures on SPARC64/Linux:

FAIL: Run pr18841 with libpr18841b.so
FAIL: Run pr18841 with libpr18841c.so
FAIL: Run pr18841 with libpr18841bn.so (-z now)
FAIL: Run pr18841 with libpr18841cn.so (-z now)

by mimicing what has been done on x86-64 and Aarch64 to fix the PR.

bfd/
PR ld/18841
        * elf32-sparc.c (elf32_sparc_reloc_type_class): Return
        reloc_class_ifunc for ifunc symbols.
        * elf64-sparc.c (elf64_sparc_reloc_type_class): Likewise.

5 years agoVisium: fix bogus overflow check on 32-bit hosts
Eric Botcazou [Thu, 7 Feb 2019 16:02:24 +0000 (17:02 +0100)] 
Visium: fix bogus overflow check on 32-bit hosts

bfd/
* elf32-visium.c (visium_elf_howto_parity_reloc): Minor tweak.
<R_VISIUM_PC16>: Use explicit range test to detect an overflow.

5 years agoVisium: align branch absolute instruction for the GR6
Eric Botcazou [Thu, 7 Feb 2019 15:58:47 +0000 (16:58 +0100)] 
Visium: align branch absolute instruction for the GR6

This is done in order to avoid a pipeline hazard on the GR6.

gas/
* config/tc-visium.c (md_assemble) <mode_cad>: Align instruction
on 64-bit boundaries for the GR6.
* testsuite/gas/visium/allinsn_gr6.s: Tweak.
* testsuite/gas/visium/allinsn_gr6.d: Likewise.
* testsuite/gas/visium/bra-1.d: New test.
* testsuite/gas/visium/bra-1.s: Likewise.
* testsuite/gas/visium/visium.exp: Run bra-1 test.

5 years agoSkip ld/pr23169 on SPARC.
Eric Botcazou [Tue, 29 Jan 2019 09:11:01 +0000 (10:11 +0100)] 
Skip ld/pr23169 on SPARC.

The test is already skipped on PowerPC and Aarch64 because it's invalid.

* testsuite/ld-ifunc/ifunc.exp: Skip pr23169 on SPARC.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 22 Jan 2019 00:01:52 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Jan 2019 00:02:03 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Jan 2019 00:02:38 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Jan 2019 00:02:01 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Jan 2019 00:02:13 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 17 Jan 2019 00:02:12 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 16 Jan 2019 00:01:53 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Jan 2019 00:01:16 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 14 Jan 2019 00:01:13 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 13 Jan 2019 00:03:07 +0000 (00:03 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 12 Jan 2019 00:01:21 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 11 Jan 2019 00:01:07 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 10 Jan 2019 00:02:06 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 9 Jan 2019 00:01:55 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 8 Jan 2019 00:02:11 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 7 Jan 2019 00:02:14 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 6 Jan 2019 00:02:32 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 5 Jan 2019 00:01:41 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 4 Jan 2019 00:01:48 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 3 Jan 2019 00:02:06 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 2 Jan 2019 00:01:10 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 1 Jan 2019 00:01:43 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 31 Dec 2018 00:01:12 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 30 Dec 2018 00:01:56 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 29 Dec 2018 00:02:08 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 28 Dec 2018 00:01:20 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 27 Dec 2018 00:01:57 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 26 Dec 2018 00:02:02 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 25 Dec 2018 00:02:13 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 24 Dec 2018 00:01:19 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 23 Dec 2018 00:02:45 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 22 Dec 2018 00:01:48 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 21 Dec 2018 00:01:55 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 20 Dec 2018 00:01:57 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 19 Dec 2018 00:02:16 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 18 Dec 2018 00:02:16 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 17 Dec 2018 00:02:22 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 16 Dec 2018 00:02:31 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 15 Dec 2018 00:01:54 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 14 Dec 2018 00:02:18 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 13 Dec 2018 00:02:09 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoPR23788, objcopy: failed to find link section
Alan Modra [Fri, 19 Oct 2018 13:32:17 +0000 (00:02 +1030)] 
PR23788, objcopy: failed to find link section

Symbol tables can change when a number of objcopy options are used.
I figure string tables are similarly changeable.

PR 23788
* elf.c (section_match): Don't require a size match for SHT_SYMTAB
or SHT_STRTAB.

(cherry picked from commit ac85e67c053f1555def2c111962f4e68740794f9)

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 12 Dec 2018 00:01:59 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 11 Dec 2018 00:01:51 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoCorrect gas/ChangeLog entry for PR gas/23968
H.J. Lu [Mon, 10 Dec 2018 12:08:52 +0000 (04:08 -0800)] 
Correct gas/ChangeLog entry for PR gas/23968

(cherry picked from commit e771f7a770b07c676958247464962614266da755)

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 10 Dec 2018 00:02:05 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agox86: Put back BFD_RELOC_X86_64_GOTPCREL
H.J. Lu [Sun, 9 Dec 2018 15:22:14 +0000 (07:22 -0800)] 
x86: Put back BFD_RELOC_X86_64_GOTPCREL

Put back BFD_RELOC_X86_64_GOTPCREL in TC_FORCE_RELOCATION_LOCAL, which
was removed by

commit 56ceb5b5405af23eddd12e12d8ba849010120324
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Oct 22 04:49:20 2015 -0700

    Add R_X86_64_[REX_]GOTPCRELX support to gas and ld

by accident.

(cherry picked from commit 9f52eab6a7a69870c7b5907a20b0305f30dbf2ae)

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 9 Dec 2018 00:02:56 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 8 Dec 2018 00:02:05 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 7 Dec 2018 00:02:16 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 6 Dec 2018 00:02:03 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 5 Dec 2018 00:02:08 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 4 Dec 2018 00:01:46 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 3 Dec 2018 00:02:08 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Dec 2018 00:02:59 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoelf: Don't merge .note.gnu.property section in IR
H.J. Lu [Thu, 29 Nov 2018 12:44:20 +0000 (04:44 -0800)] 
elf: Don't merge .note.gnu.property section in IR

.note.gnu.property section in IR inputs should be ignored.  Don't
merge them.

PR ld/23929
* elf-properties.c (_bfd_elf_link_setup_gnu_properties): Don't
merge .note.gnu.property section in IR inputs.

(cherry picked from commit ffd9e4d0225d45d1603d09e06151c388589e063f)

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Dec 2018 00:02:28 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoPR23937, powerpc64le local ifunc IRELATIVE relocs are wrong
Alan Modra [Fri, 30 Nov 2018 05:04:11 +0000 (15:34 +1030)] 
PR23937, powerpc64le local ifunc IRELATIVE relocs are wrong

IFUNC resolvers must always be called via their global entry point.
They will be called from ld.so rather than from the local executable.

PR 23937
bfd/
* elf64-ppc.c (write_plt_relocs_for_local_syms): Don't add local
entry offset for ifuncs.
ld/
* testsuite/ld-powerpc/pr23937.d,
* testsuite/ld-powerpc/pr23937.s: New test.
* testsuite/ld-powerpc/powerpc.exp: Run it.

(cherry picked from commit ba85c15dabe144e4bcee5a1b388b32bee10729e1)

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 30 Nov 2018 00:02:27 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 29 Nov 2018 00:02:12 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Nov 2018 00:02:10 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAArch64: Fix regression in Cortex A53 erratum when PIE. (PR ld/23904)
Tamar Christina [Tue, 27 Nov 2018 12:33:21 +0000 (12:33 +0000)] 
AArch64: Fix regression in Cortex A53 erratum when PIE. (PR ld/23904)

The fix for PR ld/22263 causes TLS relocations using ADRP to be relaxed
into MOVZ, however this causes issues for the erratum code.

The erratum code scans the input sections looking for ADRP instructions
and notes their location in the stream.

It then later tries to find them again in order to generate the linker
stubs.  Due to the relaxation it instead finds a MOVZ and hard aborts.

Since this relaxation is a valid one, and in which case the erratum no
longer applies, it shouldn't abort but instead just continue.

This changes the TLS relaxation code such that when it finds an ADRP and
it relaxes it, it removes the erratum entry from the work list by changing
the stub type into none so the stub is ignored.

The entry is not actually removed as removal is a more expensive operation
and we have already allocated the memory anyway.

The clearing is done for IE->LE and GD->LE relaxations, and a testcase is
added for the IE case. The GD case I believe to be impossible to get together
with the erratum sequence due to the required BL which would break the sequence.
However to cover all basis I have added the guard there as well.

build on native hardware and regtested on
  aarch64-none-elf, aarch64-none-elf (32 bit host),
  aarch64-none-linux-gnu, aarch64-none-linux-gnu (32 bit host)

Cross-compiled and regtested on
  aarch64-none-linux-gnu, aarch64_be-none-linux-gnu

Testcase in PR23940 tested and works as expected now and benchmarks ran on A53
showing no regressions and no issues.

bfd/ChangeLog:

PR ld/23904
* elfnn-aarch64.c (_bfd_aarch64_adrp_p): Use existing constants.
(_bfd_aarch64_erratum_843419_branch_to_stub): Use _bfd_aarch64_adrp_p.
(struct erratum_835769_branch_to_stub_clear_data): New.
(_bfd_aarch64_erratum_843419_clear_stub): New.
(clear_erratum_843419_entry): New.
(elfNN_aarch64_tls_relax): Use it.
(elfNN_aarch64_relocate_section): Pass input_section.
(aarch64_map_one_stub): Handle branch type none as valid.

ld/ChangeLog:

PR ld/23904
* testsuite/ld-aarch64/aarch64-elf.exp: Add erratum843419_tls_ie.
* testsuite/ld-aarch64/erratum843419_tls_ie.d: New test.
* testsuite/ld-aarch64/erratum843419_tls_ie.s: New test.

(cherry picked from commit 9fca35fc3486283562a7fcd9eb0ff845b0152d98)

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 27 Nov 2018 00:01:55 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 26 Nov 2018 00:02:06 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 25 Nov 2018 00:02:47 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 24 Nov 2018 00:01:43 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 23 Nov 2018 00:02:15 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 22 Nov 2018 00:02:23 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 21 Nov 2018 00:02:24 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 20 Nov 2018 00:02:17 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 19 Nov 2018 00:02:01 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 18 Nov 2018 00:02:54 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 17 Nov 2018 00:02:27 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 16 Nov 2018 00:02:18 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years ago[ARC] More fixes for TLS.
Cupertino Miranda [Thu, 4 Oct 2018 09:17:03 +0000 (10:17 +0100)] 
[ARC] More fixes for TLS.

Added warning for static TLS reloc.

Fixed issue related to TLS and partial static linking of libraries:
  This issue was detected when throwing exceptions in C++ while linking with
  -static-libstdc++.
  TLS relocation from the libstdc++ wasn't being patched as local now that it was
  static linked with the executable.

Fix for TLS with static and pie. Problem introduced by earlier patch:
  Fixes the following glibc tests:
   - elf/tst-tls1-static

bfd/
    xxxx-xx-xx  Cupertino Miranda  <cmiranda@synopsys.com>

    * arc-got.h (arc_got_entry_type_for_reloc): Changed to
      correct static TLS relocs.
            * elf32-arc.c (elf_arc_check_relocs): Introduced warning to
      TLS relocs which require -fPIC.
      (arc_create_forced_local_got_entries_for_tls): Created.
      Traverses list of GOT entries to be resolved statically
      when needed.
      (elf_arc_finish_dynamic_sections): Changed. Calls
      arc_create_forced_local_got_entries_for_tls for each known
      possibly GOT symbol.

5 years ago[ARC] Fix local got entry list.
Claudiu Zissulescu [Fri, 9 Nov 2018 11:14:00 +0000 (13:14 +0200)] 
[ARC] Fix local got entry list.

Fix a memory leak appearing when the local got entry list was constructed.

bfd/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-got.h (arc_get_local_got_ents): Revamp it; use
elf_local_got_ents to store the local got list.
(get_got_entry_list_for_symbo): Restructure it.
* elf32-arc.c (elf_arc_relocate_section): Correct the call to
get_got_entry_list_for_symbol.

5 years ago[ARC] Fixed issue with DTSOFF relocs.
Cupertino Miranda [Wed, 5 Sep 2018 23:50:35 +0000 (00:50 +0100)] 
[ARC] Fixed issue with DTSOFF relocs.

Inserted offset in final section in the GOT entry of type DTSOFF soon to be
relocated by the dynamic loader.

bfd/
2018-09-06  Cupertino Miranda <cmiranda@synopsys.com>

* arc-got.h (relocate_fix_got_relocs_for_got_info): Changed. Take TLS
    section alignment in consideration for this relocation.
* elf32-arc.c (FINAL_SECTSTART): Added this formula macro.
  (ARC_TLS_DTPOFF) Updated reloc to use new created macro instead.

5 years ago[ARC] Fixes TLS failures related to tls-align.
Cupertino Miranda [Wed, 1 Aug 2018 16:22:07 +0000 (17:22 +0100)] 
[ARC] Fixes TLS failures related to tls-align.

This patch fixes glibc testcase in nptl/tls-align.

bfd/
2018-08-01  Cupertino Miranda <cmiranda@synopsys.com>

* arc-got.h (relocate_fix_got_relocs_for_got_info): Changed, fixed
    TCB_SIZE offsize to include section alignment.
* elf32-arc.c (arc_special_overflow_checks): Likewise.

include/
2018-08-01  Cupertino Miranda <cmiranda@synopsys.com>

* arc-reloc.def (ARC_TLS_LE_32): Updated reloc formula.

5 years ago[ARC] PLT information was still being generated when symbol was forced_local.
Cupertino Miranda [Fri, 2 Mar 2018 16:44:29 +0000 (17:44 +0100)] 
[ARC] PLT information was still being generated when symbol was forced_local.

A change upstream reveiled this issue, triggering an assert when linking glibc.

bfd/
2018-03-01  Cupertino Miranda <cmiranda@synopsys.com>

* elf32-arc.c (elf_arc_check_relocs): Changed.

5 years ago[ARC] Make sure global symbol is not an indirect or warning.
Cupertino Miranda [Fri, 2 Mar 2018 16:38:14 +0000 (17:38 +0100)] 
[ARC] Make sure global symbol is not an indirect or warning.

Problem identified in the context of glibc with latest upstream binutils.
Dynamic symbol space was being reserved but, no actual information for the
symbol was being set. Data for the symbol was kept initialized with -1.
No easy test case was possible to be created.

bfd/
2018-03-01  Cupertino Miranda <cmiranda@synopsys.com>

* elf32-arc.c (elf_arc_check_relocs): Changed.

5 years ago[ARC] Improved robustness. Return FALSE in case of NULL pointer.
Cupertino Miranda [Fri, 2 Mar 2018 16:33:48 +0000 (17:33 +0100)] 
[ARC] Improved robustness. Return FALSE in case of NULL pointer.

bfd/
2018-03-01  Cupertino Miranda <cmiranda@synopsys.com>

* elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case
arc_htab is NULL.

5 years ago[ARC] Refactored location where GOT information is collected.
Cupertino Miranda [Fri, 2 Mar 2018 16:16:21 +0000 (17:16 +0100)] 
[ARC] Refactored location where GOT information is collected.

Change location where GOT information is collected for ARC target, avoiding
posible use conflicts of the previous .got field in the symbols hash_entry.

bfd/
2018-03-01  Cupertino Miranda  <cmiranda@synopsys.com>

* arc-got.h (get_got_entry_list_for_symbol): Changed.
* ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed.
(elf_arc_link_hash_newfunc): Changed.
(arc_elf_link_hash_table_create): Removed old initializations.
(elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 15 Nov 2018 00:02:02 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 14 Nov 2018 00:02:29 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 13 Nov 2018 00:02:10 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 12 Nov 2018 00:01:56 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 11 Nov 2018 00:02:45 +0000 (00:02 +0000)] 
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 10 Nov 2018 00:02:25 +0000 (00:02 +0000)] 
Automatic date update in version.in