[cross-binutils] Sync with binutils and upstream 2.4 branch to pick up some fixes
David Howells
dhowells at fedoraproject.org
Wed Nov 12 13:04:34 UTC 2014
commit 111d83067cbb00dc1175aa46ec417c21ed303eba
Author: David Howells <dhowells at redhat.com>
Date: Wed Nov 12 13:02:44 2014 +0000
Sync with binutils and upstream 2.4 branch to pick up some fixes
...tils-2.24-aarch64-fix-final_link_relocate.patch | 54 +
...tils-2.24-aarch64-fix-gotplt-offset-ifunc.patch | 103 ++
binutils-2.24-aarch64-fix-ie-relax.patch | 40 +
binutils-2.24-aarch64-fix-static-ifunc.patch | 118 ++
...tils-2.24-aarch64-ld-shared-non-PIC-xfail.patch | 55 +
binutils-2.24-arm-static-tls.patch | 42 +
...-cde98f8566e14f52b896abc92c357cdd14717505.patch | 1828 +++++++++++++++++++-
binutils-2.24-corrupt-binaries.patch | 1041 +++++++++++
binutils-2.24-elfnn-aarch64.patch | 84 +-
binutils-2.24-fat-lto-objects.patch | 57 +
binutils-2.24-indirect-chain.patch | 28 +
binutils-2.24-strings-default-all.patch | 310 ++++
binutils-2.24-symbol-warning.patch | 114 ++
binutils-2.24-weak-sym-merge.patch | 22 +
binutils-HEAD-change-ld-notice-interface.patch | 398 +++++
cross-binutils.spec | 34 +-
16 files changed, 4216 insertions(+), 112 deletions(-)
---
diff --git a/binutils-2.24-aarch64-fix-final_link_relocate.patch b/binutils-2.24-aarch64-fix-final_link_relocate.patch
new file mode 100644
index 0000000..8c2d37b
--- /dev/null
+++ b/binutils-2.24-aarch64-fix-final_link_relocate.patch
@@ -0,0 +1,54 @@
+commit f44a1f8e513b37bcc52ba9ea0c172c3e94852756
+Author: Christophe Lyon <christophe.lyon at st.com>
+Date: Tue Jan 14 15:53:50 2014 +0100
+
+ 2014-01-14 Michael Hudson-Doyle <michael.hudson at linaro.org>
+ Kugan Vivekanandarajah <kugan.vivekanandarajah at linaro.org>
+
+ bfd/
+ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use correct
+ offset while calculating relocation address.
+ (elfNN_aarch64_create_small_pltn_entry): Likewise.
+ (elfNN_aarch64_init_small_plt0_entry): Likewise.
+
+--- a/bfd/elfnn-aarch64.c
++++ b/bfd/elfnn-aarch64.c
+@@ -3844,7 +3844,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
+
+ value = (symbol_got_offset (input_bfd, h, r_symndx)
+ + globals->root.sgot->output_section->vma
+- + globals->root.sgot->output_section->output_offset);
++ + globals->root.sgot->output_offset);
+
+ value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,
+ 0, weak_undef_p);
+@@ -3873,10 +3873,9 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
+ case BFD_RELOC_AARCH64_TLSDESC_LDR:
+ if (globals->root.sgot == NULL)
+ return bfd_reloc_notsupported;
+-
+ value = (symbol_tlsdesc_got_offset (input_bfd, h, r_symndx)
+ + globals->root.sgotplt->output_section->vma
+- + globals->root.sgotplt->output_section->output_offset
++ + globals->root.sgotplt->output_offset
+ + globals->sgotplt_jump_table_size);
+
+ value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,
+@@ -6627,7 +6626,7 @@ elfNN_aarch64_create_small_pltn_entry (struct elf_link_hash_entry *h,
+
+ plt_entry = plt->contents + h->plt.offset;
+ plt_entry_address = plt->output_section->vma
+- + plt->output_section->output_offset + h->plt.offset;
++ + plt->output_offset + h->plt.offset;
+ gotplt_entry_address = gotplt->output_section->vma +
+ gotplt->output_offset + got_offset;
+
+@@ -6934,7 +6933,7 @@ elfNN_aarch64_init_small_plt0_entry (bfd *output_bfd ATTRIBUTE_UNUSED,
+ + GOT_ENTRY_SIZE * 2);
+
+ plt_base = htab->root.splt->output_section->vma +
+- htab->root.splt->output_section->output_offset;
++ htab->root.splt->output_offset;
+
+ /* Fill in the top 21 bits for this: ADRP x16, PLT_GOT + n * 8.
+ ADRP: ((PG(S+A)-PG(P)) >> 12) & 0x1fffff */
diff --git a/binutils-2.24-aarch64-fix-gotplt-offset-ifunc.patch b/binutils-2.24-aarch64-fix-gotplt-offset-ifunc.patch
new file mode 100644
index 0000000..64a1d9c
--- /dev/null
+++ b/binutils-2.24-aarch64-fix-gotplt-offset-ifunc.patch
@@ -0,0 +1,103 @@
+commit 67428c4aa56d4183d0f531e0d752040745a94423
+Author: Will Newton <will.newton at linaro.org>
+Date: Mon Nov 25 11:07:07 2013 +0000
+
+ bfd/elfnn-aarch64.c: Fix miscalculation of GOTPLT offset for ifunc syms.
+
+ The .got.plt header size was not being correctly taken into account
+ when calculating the offset for relocations against ifunc symbols.
+
+ bfd/ChangeLog:
+
+ 2013-11-26 Will Newton <will.newton at linaro.org>
+
+ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Ensure
+ PLT_INDEX is calculated using correct header size.
+
+ ld/testsuite/ChangeLog:
+
+ 2013-11-26 Will Newton <will.newton at linaro.org>
+
+ * ld-aarch64/aarch64-elf.exp: Add ifunc-21 test.
+ * ld-aarch64/ifunc-21.d: New file.
+ * ld-aarch64/ifunc-21.s: Likewise.
+
+diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
+index 6bc414e..3cd3a18 100644
+--- a/bfd/elfnn-aarch64.c
++++ b/bfd/elfnn-aarch64.c
+@@ -3589,7 +3589,8 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
+
+ if (globals->root.splt != NULL)
+ {
+- plt_index = h->plt.offset / globals->plt_entry_size - 1;
++ plt_index = ((h->plt.offset - globals->plt_header_size) /
++ globals->plt_entry_size);
+ off = (plt_index + 3) * GOT_ENTRY_SIZE;
+ base_got = globals->root.sgotplt;
+ }
+diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
+index 5c150dd..a6b3ea2 100644
+--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
++++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
+@@ -155,3 +155,4 @@ run_dump_test "ifunc-18b"
+ run_dump_test "ifunc-19a"
+ run_dump_test "ifunc-19b"
+ run_dump_test "ifunc-20"
++run_dump_test "ifunc-21"
+diff --git a/ld/testsuite/ld-aarch64/ifunc-21.d b/ld/testsuite/ld-aarch64/ifunc-21.d
+new file mode 100644
+index 0000000..fa139b2
+--- /dev/null
++++ b/ld/testsuite/ld-aarch64/ifunc-21.d
+@@ -0,0 +1,31 @@
++#source: ifunc-21.s
++#ld: -shared -z nocombreloc
++#objdump: -d -s -j .got.plt -j .text
++#target: aarch64*-*-*
++
++# Ensure the .got.plt slot used is correct
++
++.*: file format elf64-(little|big)aarch64
++
++Contents of section .text:
++ 02a0 .*
++Contents of section .got.plt:
++ 103a8 0+ 0+ 0+ 0+ .*
++ 103b8 0+ 0+ [0-9a-f]+ 0+ .*
++
++Disassembly of section .text:
++
++0+2a0 <ifunc>:
++ 2a0: d65f03c0 ret
++
++0+2a4 <bar>:
++ 2a4: 90000080 adrp x0, 10000 <.*>
++ 2a8: f941e000 ldr x0, \[x0,#960\]
++ 2ac: d65f03c0 ret
++
++Disassembly of section .got.plt:
++
++.*:
++.*
++.*
++.*
+diff --git a/ld/testsuite/ld-aarch64/ifunc-21.s b/ld/testsuite/ld-aarch64/ifunc-21.s
+new file mode 100644
+index 0000000..a1563dc
+--- /dev/null
++++ b/ld/testsuite/ld-aarch64/ifunc-21.s
+@@ -0,0 +1,13 @@
++ .text
++ .type ifunc, @gnu_indirect_function
++ .hidden ifunc
++ifunc:
++ ret
++ .size ifunc, .-ifunc
++ .type bar, @function
++ .globl bar
++bar:
++ adrp x0, :got:ifunc
++ ldr x0, [x0, #:got_lo12:ifunc]
++ ret
++ .size bar, .-bar
diff --git a/binutils-2.24-aarch64-fix-ie-relax.patch b/binutils-2.24-aarch64-fix-ie-relax.patch
new file mode 100644
index 0000000..d9157ea
--- /dev/null
+++ b/binutils-2.24-aarch64-fix-ie-relax.patch
@@ -0,0 +1,40 @@
+commit 44f814ce5066f10a3bed29c45d10e0d38f4fa433
+Author: Marcus Shawcroft <marcus.shawcroft at arm.com>
+Date: Tue Apr 15 17:46:07 2014 +0100
+
+ [AArch64] Fix off by one error in instruction relaxation mask.
+
+ The AArch64 TLSDESC to IE relaxation code uses a bit mask intended to
+ ensure that destination register in a relaxed ldr instruction is
+ always X0. The mask has an off by one error resulting in the most
+ significant bit of the destination register being retained in the
+ relaxed instruction. The issue generally appears when the compiler
+ emits TLS accesses code under high register pressure resulting in a
+ broken code sequence.
+
+diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
+index 42c83fb..8503419 100644
+--- a/bfd/elfnn-aarch64.c
++++ b/bfd/elfnn-aarch64.c
+@@ -3957,7 +3957,7 @@ elfNN_aarch64_tls_relax (struct elf_aarch64_link_hash_table *globals,
+ ldr xd, [x0, #:tlsdesc_lo12:var] => ldr x0, [x0, #:gottprel_lo12:var]
+ */
+ insn = bfd_getl32 (contents + rel->r_offset);
+- insn &= 0xfffffff0;
++ insn &= 0xffffffe0;
+ bfd_putl32 (insn, contents + rel->r_offset);
+ return bfd_reloc_continue;
+ }
+diff --git a/ld/testsuite/ld-aarch64/tls-relax-gdesc-ie.s b/ld/testsuite/ld-aarch64/tls-relax-gdesc-ie.s
+index c20690c..38b3721 100644
+--- a/ld/testsuite/ld-aarch64/tls-relax-gdesc-ie.s
++++ b/ld/testsuite/ld-aarch64/tls-relax-gdesc-ie.s
+@@ -4,7 +4,7 @@ var:
+ .word 2
+ .text
+ adrp x0, :tlsdesc:var
+- ldr x1, [x0, #:tlsdesc_lo12:var]
++ ldr x17, [x0, #:tlsdesc_lo12:var]
+ add x0, x0, :tlsdesc_lo12:var
+ .tlsdesccall var
+ blr x1
diff --git a/binutils-2.24-aarch64-fix-static-ifunc.patch b/binutils-2.24-aarch64-fix-static-ifunc.patch
new file mode 100644
index 0000000..296f162
--- /dev/null
+++ b/binutils-2.24-aarch64-fix-static-ifunc.patch
@@ -0,0 +1,118 @@
+commit 14d96265dd8fd934d868c0b8e1991e2fefbe9fc8
+Author: Will Newton <will.newton at linaro.org>
+Date: Mon Nov 25 14:44:59 2013 +0000
+
+ bfd/elfnn-aarch64.c: Handle static links with ifunc correctly.
+
+ The code for handling GOT references to ifunc symbols in static links
+ was missing.
+
+ bfd/ChangeLog:
+
+ 2013-11-26 Will Newton <will.newton at linaro.org>
+
+ * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol):
+ Handle STT_GNU_IFUNC symbols correctly in static links.
+
+ ld/testsuite/ChangeLog:
+
+ 2013-11-26 Will Newton <will.newton at linaro.org>
+
+ * ld-aarch64/aarch64-elf.exp: Add ifunc-22.
+ * ld-aarch64/ifunc-22.d: New file.
+ * ld-aarch64/ifunc-22.s: Likewise.
+
+diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
+index 3cd3a18..9053635 100644
+--- a/bfd/elfnn-aarch64.c
++++ b/bfd/elfnn-aarch64.c
+@@ -6824,7 +6824,34 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
+ + htab->root.sgot->output_offset
+ + (h->got.offset & ~(bfd_vma) 1));
+
+- if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
++ if (h->def_regular
++ && h->type == STT_GNU_IFUNC)
++ {
++ if (info->shared)
++ {
++ /* Generate R_AARCH64_GLOB_DAT. */
++ goto do_glob_dat;
++ }
++ else
++ {
++ asection *plt;
++
++ if (!h->pointer_equality_needed)
++ abort ();
++
++ /* For non-shared object, we can't use .got.plt, which
++ contains the real function address if we need pointer
++ equality. We load the GOT entry with the PLT entry. */
++ plt = htab->root.splt ? htab->root.splt : htab->root.iplt;
++ bfd_put_NN (output_bfd, (plt->output_section->vma
++ + plt->output_offset
++ + h->plt.offset),
++ htab->root.sgot->contents
++ + (h->got.offset & ~(bfd_vma) 1));
++ return TRUE;
++ }
++ }
++ else if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
+ {
+ if (!h->def_regular)
+ return FALSE;
+@@ -6837,6 +6864,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
+ }
+ else
+ {
++do_glob_dat:
+ BFD_ASSERT ((h->got.offset & 1) == 0);
+ bfd_put_NN (output_bfd, (bfd_vma) 0,
+ htab->root.sgot->contents + h->got.offset);
+diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
+index a6b3ea2..692bf34 100644
+--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
++++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
+@@ -156,3 +156,4 @@ run_dump_test "ifunc-19a"
+ run_dump_test "ifunc-19b"
+ run_dump_test "ifunc-20"
+ run_dump_test "ifunc-21"
++run_dump_test "ifunc-22"
+diff --git a/ld/testsuite/ld-aarch64/ifunc-22.d b/ld/testsuite/ld-aarch64/ifunc-22.d
+new file mode 100644
+index 0000000..f28b039
+--- /dev/null
++++ b/ld/testsuite/ld-aarch64/ifunc-22.d
+@@ -0,0 +1,11 @@
++#source: ifunc-22.s
++#objdump: -s -j .got
++#ld: -static
++#target: aarch64*-*-*
++
++# Ensure GOT is populated correctly in static link
++
++.*: file format elf64-(little|big)aarch64
++
++Contents of section \.got:
++ 4100f0 00000000 00000000 d0004000 00000000 .......... at .....
+diff --git a/ld/testsuite/ld-aarch64/ifunc-22.s b/ld/testsuite/ld-aarch64/ifunc-22.s
+new file mode 100644
+index 0000000..69a87bb
+--- /dev/null
++++ b/ld/testsuite/ld-aarch64/ifunc-22.s
+@@ -0,0 +1,14 @@
++ .text
++ .type ifunc, @gnu_indirect_function
++ .global ifunc
++ifunc:
++ ret
++ .size ifunc, .-ifunc
++ .type _start, @function
++ .globl _start
++_start:
++ adrp x0, :got:ifunc
++ ldr x0, [x0, #:got_lo12:ifunc]
++ .size _start, .-_start
++ .data
++ .xword ifunc
diff --git a/binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch b/binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch
new file mode 100644
index 0000000..8525596
--- /dev/null
+++ b/binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch
@@ -0,0 +1,55 @@
+commit 273dc279306c2b69fbc1407cc695397e4b015152
+Author: Will Newton <will.newton at linaro.org>
+Date: Fri May 16 15:22:58 2014 +0100
+
+ ld/aarch64: xfail non-PIC shared object tests on aarch64
+
+ aarch64 does not support building non-PIC shared objects, so mark
+ tests for these as xfail.
+
+ ld/testsuite/ChangeLog:
+
+ 2014-05-20 Will Newton <will.newton at linaro.org>
+
+ * ld-shared/shared.exp: Mark non-PIC shared object tests
+ as xfail on aarch64.
+
+#-- a/ld/testsuite/ChangeLog
+#++ b/ld/testsuite/ChangeLog
+#@ -1,3 +1,8 @@
++2014-05-20 Will Newton <will.newton at linaro.org>
++
++ * ld-shared/shared.exp: Mark non-PIC shared object tests
++ as xfail on aarch64.
++
+ 2014-05-19 Andreas Tobler <andreast at fgznet.ch>
+
+ * ld-elf/shared.exp: Introduce the extralibs variable to control
+diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
+index 9996ece..c723ef7 100644
+--- a/ld/testsuite/ld-shared/shared.exp
++++ b/ld/testsuite/ld-shared/shared.exp
+@@ -244,6 +244,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
+ if [ string match $shared_needs_pic "yes" ] {
+ setup_xfail "arm*-*-linux*"
+ }
++ setup_xfail "aarch64*-*-linux*"
+ shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared
+
+ # Test ELF shared library relocations with a non-zero load
+@@ -270,6 +271,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
+ if [ string match $shared_needs_pic "yes" ] {
+ setup_xfail "arm*-*-linux*"
+ }
++ setup_xfail "aarch64*-*-linux*"
+ shared_test shnp "shared (non PIC, load offset)" \
+ mainnp.o sh1np.o sh2np.o shared \
+ "-T $srcdir/$subdir/elf-offset.ld"
+@@ -326,6 +328,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m
+ if [ string match $shared_needs_pic "yes" ] {
+ setup_xfail "arm*-*-linux*"
+ }
++ setup_xfail "aarch64*-*-linux*"
+ shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared
+ }
+ } else {
diff --git a/binutils-2.24-arm-static-tls.patch b/binutils-2.24-arm-static-tls.patch
new file mode 100644
index 0000000..2b580f1
--- /dev/null
+++ b/binutils-2.24-arm-static-tls.patch
@@ -0,0 +1,42 @@
+commit eea6dad2b3ae91189caa91145dd133bae0398d21
+Author: Kyle McMartin <kyle at redhat.com>
+Date: Fri Jun 20 11:14:09 2014 +0100
+
+ Similarly to the AArch64 patch, set DF_STATIC_TLS for consistency with
+ other architectures when we emit IE relocs in a shared library.
+
+ * elf32-arm.c (elf32_arm_check_relocs): Set DF_STATIC_TLS when
+ emitting initial-exec relocs when not linking an executable.
+
+--- a/bfd/elf32-arm.c
++++ b/bfd/elf32-arm.c
+@@ -12711,6 +12711,9 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
+ default: tls_type = GOT_NORMAL; break;
+ }
+
++ if (!info->executable && (tls_type & GOT_TLS_IE))
++ info->flags |= DF_STATIC_TLS;
++
+ if (h != NULL)
+ {
+ h->got.refcount++;
+--- a/ld/testsuite/ld-arm/tls-gdierelax2.d
++++ b/ld/testsuite/ld-arm/tls-gdierelax2.d
+@@ -11,13 +11,13 @@ Disassembly of section .text:
+ [0-9a-f]+: e59f0004 ldr r0, \[pc, #4\] ; .*
+ [0-9a-f]+: e79f0000 ldr r0, \[pc, r0\]
+ [0-9a-f]+: e1a00000 nop ; .*
+- [0-9a-f]+: 00008098 .word 0x00008098
+- [0-9a-f]+: 0000809c .word 0x0000809c
++ [0-9a-f]+: 000080a0 .word 0x000080a0
++ [0-9a-f]+: 000080a4 .word 0x000080a4
+
+ [0-9a-f]+ <bar>:
+ [0-9a-f]+: 4801 ldr r0, \[pc, #4\] ; .*
+ [0-9a-f]+: 4478 add r0, pc
+ [0-9a-f]+: 6800 ldr r0, \[r0, #0\]
+ [0-9a-f]+: 46c0 nop ; .*
+- [0-9a-f]+: 0000808a .word 0x0000808a
+- [0-9a-f]+: 0000808c .word 0x0000808c
++ [0-9a-f]+: 00008092 .word 0x00008092
++ [0-9a-f]+: 00008094 .word 0x00008094
diff --git a/binutils-2.24-cab6c3ee9785f072a373afe31253df0451db93cf.patch b/binutils-2.24-cde98f8566e14f52b896abc92c357cdd14717505.patch
similarity index 97%
rename from binutils-2.24-cab6c3ee9785f072a373afe31253df0451db93cf.patch
rename to binutils-2.24-cde98f8566e14f52b896abc92c357cdd14717505.patch
index 9058423..6ce6d8f 100644
--- a/binutils-2.24-cab6c3ee9785f072a373afe31253df0451db93cf.patch
+++ b/binutils-2.24-cde98f8566e14f52b896abc92c357cdd14717505.patch
@@ -1,8 +1,49 @@
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
-index 2c4719c..10702f2 100644
+index 2c4719c..fa58423 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
-@@ -1,3 +1,220 @@
+@@ -1,3 +1,261 @@
++2014-10-24 Tejas Belagod <tejas.belagod at arm.com>
++
++ * bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter.
++ * bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise.
++ * elfnn-aarch64.c (aarch64_erratum_835769_stub): New.
++ (elf_aarch64_stub_type): Add new type
++ aarch64_stub_erratum_835769_veneer.
++ (elf_aarch64_stub_hash_entry): New fields for erratum 835769.
++ (aarch64_erratum_835769_fix): New data struct to record erratum
++ 835769.
++ (elf_aarch64_link_hash_table: Global flags for 835769.
++ (aarch64_build_one_stub): Add case for 835769.
++ (aarch64_size_one_stub): Likewise.
++ (aarch64_mem_op_p, aarch64_mlxl_p,
++ aarch64_erratum_sequence,erratum_835769_scan):
++ New. Decode and scan functions for erratum 835769.
++ (elf_aarch64_create_or_find_stub_sec): New.
++ (elfNN_aarch64_size_stubs): Look for erratum 835769 and record
++ them.
++ (bfd_elfNN_aarch64_set_options: Set global flag for 835769.
++ (erratum_835769_branch_to_stub_data,
++ make_branch_to_erratum_835769_stub):New. Connect up all the
++ erratum stubs to occurances by branches.
++ (elfNN_aarch64_write_section): New hook.
++ (aarch64_map_one_stub): Output erratum stub symbol.
++ (elfNN_aarch64_size_dynamic_sections): Init mapping symbol
++ information for erratum 835769.
++ (elf_backend_write_section): Define.
++
++2014-08-20 Roland McGrath <mcgrathr at google.com>
++
++ PR ld/17277
++ * elf32-arm.c (elf32_arm_check_relocs): Increment P->pc_count for
++ all reloc types with pc_relative set in the howto, not just for
++ R_ARM_REL32 and R_ARM_REL32_NOI.
++ (allocate_dynrelocs_for_symbol): Update comment.
++ (elf32_arm_gc_sweep_hook): For all reloc types with pc_relative
++ set in the howto, set call_reloc_p and may_need_local_target_p but
++ not may_become_dynamic_p; not only for R_ARM_REL32 and R_ARM_REL32_NOI.
++ (elf32_arm_check_relocs): Likewise.
++
+2014-06-12 Alan Modra <amodra at gmail.com>
+
+ Backport mainline patches
@@ -249,10 +290,40 @@ index 78d2d2c..8a38a765 100644
INCDIR = $(srcdir)/../include
CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
SUBDIRS = doc po
+diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
+index 3afd71b..6a5c01c 100644
+--- a/bfd/bfd-in.h
++++ b/bfd/bfd-in.h
+@@ -936,10 +936,10 @@ extern void bfd_elf32_aarch64_init_maps
+ (bfd *);
+
+ extern void bfd_elf64_aarch64_set_options
+- (bfd *, struct bfd_link_info *, int, int, int);
++ (bfd *, struct bfd_link_info *, int, int, int, int);
+
+ extern void bfd_elf32_aarch64_set_options
+- (bfd *, struct bfd_link_info *, int, int, int);
++ (bfd *, struct bfd_link_info *, int, int, int, int);
+
+ /* ELF AArch64 mapping symbol support. */
+ #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0)
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
-index 756af87..b65e644 100644
+index 756af87..f83f6fd 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
+@@ -943,10 +943,10 @@ extern void bfd_elf32_aarch64_init_maps
+ (bfd *);
+
+ extern void bfd_elf64_aarch64_set_options
+- (bfd *, struct bfd_link_info *, int, int, int);
++ (bfd *, struct bfd_link_info *, int, int, int, int);
+
+ extern void bfd_elf32_aarch64_set_options
+- (bfd *, struct bfd_link_info *, int, int, int);
++ (bfd *, struct bfd_link_info *, int, int, int, int);
+
+ /* ELF AArch64 mapping symbol support. */
+ #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0)
@@ -1440,6 +1440,7 @@ typedef struct bfd_section
#define SEC_INFO_TYPE_MERGE 2
#define SEC_INFO_TYPE_EH_FRAME 3
@@ -373,6 +444,56 @@ index 0e88d78..24ca63a 100644
AC_CONFIG_SRCDIR([libbfd.c])
AC_CANONICAL_TARGET
+diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
+index 5af1643..d406681 100644
+--- a/bfd/elf32-arm.c
++++ b/bfd/elf32-arm.c
+@@ -12360,7 +12360,7 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
+ && (sec->flags & SEC_ALLOC) != 0)
+ {
+ if (h == NULL
+- && (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI))
++ && elf32_arm_howto_from_type (r_type)->pc_relative)
+ {
+ call_reloc_p = TRUE;
+ may_need_local_target_p = TRUE;
+@@ -12678,7 +12678,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
+ && (sec->flags & SEC_ALLOC) != 0)
+ {
+ if (h == NULL
+- && (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI))
++ && elf32_arm_howto_from_type (r_type)->pc_relative)
+ {
+ /* In shared libraries and relocatable executables,
+ we treat local relative references as calls;
+@@ -12824,7 +12824,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
+ p->pc_count = 0;
+ }
+
+- if (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI)
++ if (elf32_arm_howto_from_type (r_type)->pc_relative)
+ p->pc_count += 1;
+ p->count += 1;
+ }
+@@ -13405,12 +13405,12 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
+
+ if (info->shared || htab->root.is_relocatable_executable)
+ {
+- /* The only relocs that use pc_count are R_ARM_REL32 and
+- R_ARM_REL32_NOI, which will appear on something like
+- ".long foo - .". We want calls to protected symbols to resolve
+- directly to the function rather than going via the plt. If people
+- want function pointer comparisons to work as expected then they
+- should avoid writing assembly like ".long foo - .". */
++ /* Relocs that use pc_count are PC-relative forms, which will appear
++ on something like ".long foo - ." or "movw REG, foo - .". We want
++ calls to protected symbols to resolve directly to the function
++ rather than going via the plt. If people want function pointer
++ comparisons to work as expected then they should avoid writing
++ assembly like ".long foo - .". */
+ if (SYMBOL_CALLS_LOCAL (info, h))
+ {
+ struct elf_dyn_relocs **pp;
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 63928dc..75fcf6e 100644
--- a/bfd/elf32-ppc.c
@@ -3840,10 +3961,766 @@ index 99b7ca1..923f853 100644
|| !bfd_hide_sym_by_version (info->version_info,
h->root.root.string)))))
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
-index 6bc414e..8503419 100644
+index 6bc414e..9fc734f 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
-@@ -3589,7 +3589,8 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
+@@ -1611,6 +1611,12 @@ static const uint32_t aarch64_long_branch_stub[] =
+ 0x00000000,
+ };
+
++static const uint32_t aarch64_erratum_835769_stub[] =
++{
++ 0x00000000, /* Placeholder for multiply accumulate. */
++ 0x14000000, /* b <label> */
++};
++
+ /* Section name for stubs is the associated section name plus this
+ string. */
+ #define STUB_SUFFIX ".stub"
+@@ -1620,6 +1626,7 @@ enum elf_aarch64_stub_type
+ aarch64_stub_none,
+ aarch64_stub_adrp_branch,
+ aarch64_stub_long_branch,
++ aarch64_stub_erratum_835769_veneer,
+ };
+
+ struct elf_aarch64_stub_hash_entry
+@@ -1654,6 +1661,10 @@ struct elf_aarch64_stub_hash_entry
+ stub name in the hash table has to be unique; this does not, so
+ it can be friendlier. */
+ char *output_name;
++
++ /* The instruction which caused this stub to be generated (only valid for
++ erratum 835769 workaround stubs at present). */
++ uint32_t veneered_insn;
+ };
+
+ /* Used to build a map of a section. This is required for mixed-endian
+@@ -1679,6 +1690,17 @@ _aarch64_elf_section_data;
+ #define elf_aarch64_section_data(sec) \
+ ((_aarch64_elf_section_data *) elf_section_data (sec))
+
++/* A fix-descriptor for erratum 835769. */
++struct aarch64_erratum_835769_fix
++{
++ bfd *input_bfd;
++ asection *section;
++ bfd_vma offset;
++ uint32_t veneered_insn;
++ char *stub_name;
++ enum elf_aarch64_stub_type stub_type;
++};
++
+ /* The size of the thread control block. */
+ #define TCB_SIZE 16
+
+@@ -1799,6 +1821,15 @@ struct elf_aarch64_link_hash_table
+ /* Nonzero to force PIC branch veneers. */
+ int pic_veneer;
+
++ /* Fix erratum 835769. */
++ int fix_erratum_835769;
++
++ /* A table of fix locations for erratum 835769. This holds erratum
++ fix locations between elfNN_aarch64_size_stubs() and
++ elfNN_aarch64_write_section(). */
++ struct aarch64_erratum_835769_fix *aarch64_erratum_835769_fixes;
++ unsigned int num_aarch64_erratum_835769_fixes;
++
+ /* The number of bytes in the initial entry in the PLT. */
+ bfd_size_type plt_header_size;
+
+@@ -2342,6 +2373,9 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
+ bfd *stub_bfd;
+ bfd_byte *loc;
+ bfd_vma sym_value;
++ bfd_vma veneered_insn_loc;
++ bfd_vma veneer_entry_loc;
++ bfd_signed_vma branch_offset = 0;
+ unsigned int template_size;
+ const uint32_t *template;
+ unsigned int i;
+@@ -2382,6 +2416,10 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
+ template = aarch64_long_branch_stub;
+ template_size = sizeof (aarch64_long_branch_stub);
+ break;
++ case aarch64_stub_erratum_835769_veneer:
++ template = aarch64_erratum_835769_stub;
++ template_size = sizeof (aarch64_erratum_835769_stub);
++ break;
+ default:
+ BFD_FAIL ();
+ return FALSE;
+@@ -2424,6 +2462,23 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
+ stub_entry->stub_offset + 16,
+ sym_value + 12, 0);
+ break;
++
++ case aarch64_stub_erratum_835769_veneer:
++ veneered_insn_loc = stub_entry->target_section->output_section->vma
++ + stub_entry->target_section->output_offset
++ + stub_entry->target_value;
++ veneer_entry_loc = stub_entry->stub_sec->output_section->vma
++ + stub_entry->stub_sec->output_offset
++ + stub_entry->stub_offset;
++ branch_offset = veneered_insn_loc - veneer_entry_loc;
++ branch_offset >>= 2;
++ branch_offset &= 0x3ffffff;
++ bfd_putl32 (stub_entry->veneered_insn,
++ stub_sec->contents + stub_entry->stub_offset);
++ bfd_putl32 (template[1] | branch_offset,
++ stub_sec->contents + stub_entry->stub_offset + 4);
++ break;
++
+ default:
+ break;
+ }
+@@ -2452,6 +2507,9 @@ aarch64_size_one_stub (struct bfd_hash_entry *gen_entry,
+ case aarch64_stub_long_branch:
+ size = sizeof (aarch64_long_branch_stub);
+ break;
++ case aarch64_stub_erratum_835769_veneer:
++ size = sizeof (aarch64_erratum_835769_stub);
++ break;
+ default:
+ BFD_FAIL ();
+ return FALSE;
+@@ -2640,6 +2698,388 @@ group_sections (struct elf_aarch64_link_hash_table *htab,
+
+ #undef PREV_SEC
+
++#define AARCH64_BITS(x, pos, n) (((x) >> (pos)) & ((1 << (n)) - 1))
++
++#define AARCH64_RT(insn) AARCH64_BITS (insn, 0, 5)
++#define AARCH64_RT2(insn) AARCH64_BITS (insn, 10, 5)
++#define AARCH64_RA(insn) AARCH64_BITS (insn, 10, 5)
++#define AARCH64_RD(insn) AARCH64_BITS (insn, 0, 5)
++#define AARCH64_RN(insn) AARCH64_BITS (insn, 5, 5)
++#define AARCH64_RM(insn) AARCH64_BITS (insn, 16, 5)
++
++#define AARCH64_MAC(insn) (((insn) & 0xff000000) == 0x9b000000)
++#define AARCH64_BIT(insn, n) AARCH64_BITS (insn, n, 1)
++#define AARCH64_OP31(insn) AARCH64_BITS (insn, 21, 3)
++#define AARCH64_ZR 0x1f
++
++/* All ld/st ops. See C4-182 of the ARM ARM. The encoding space for
++ LD_PCREL, LDST_RO, LDST_UI and LDST_UIMM cover prefetch ops. */
++
++#define AARCH64_LD(insn) (AARCH64_BIT (insn, 22) == 1)
++#define AARCH64_LDST(insn) (((insn) & 0x0a000000) == 0x08000000)
++#define AARCH64_LDST_EX(insn) (((insn) & 0x3f000000) == 0x08000000)
++#define AARCH64_LDST_PCREL(insn) (((insn) & 0x3b000000) == 0x18000000)
++#define AARCH64_LDST_NAP(insn) (((insn) & 0x3b800000) == 0x28000000)
++#define AARCH64_LDSTP_PI(insn) (((insn) & 0x3b800000) == 0x28800000)
++#define AARCH64_LDSTP_O(insn) (((insn) & 0x3b800000) == 0x29000000)
++#define AARCH64_LDSTP_PRE(insn) (((insn) & 0x3b800000) == 0x29800000)
++#define AARCH64_LDST_UI(insn) (((insn) & 0x3b200c00) == 0x38000000)
++#define AARCH64_LDST_PIIMM(insn) (((insn) & 0x3b200c00) == 0x38000400)
++#define AARCH64_LDST_U(insn) (((insn) & 0x3b200c00) == 0x38000800)
++#define AARCH64_LDST_PREIMM(insn) (((insn) & 0x3b200c00) == 0x38000c00)
++#define AARCH64_LDST_RO(insn) (((insn) & 0x3b200c00) == 0x38200800)
++#define AARCH64_LDST_UIMM(insn) (((insn) & 0x3b000000) == 0x39000000)
++#define AARCH64_LDST_SIMD_M(insn) (((insn) & 0xbfbf0000) == 0x0c000000)
++#define AARCH64_LDST_SIMD_M_PI(insn) (((insn) & 0xbfa00000) == 0x0c800000)
++#define AARCH64_LDST_SIMD_S(insn) (((insn) & 0xbf9f0000) == 0x0d000000)
++#define AARCH64_LDST_SIMD_S_PI(insn) (((insn) & 0xbf800000) == 0x0d800000)
++
++/* Classify an INSN if it is indeed a load/store. Return TRUE if INSN
++ is a load/store along with the Rt and Rtn. Return FALSE if not a
++ load/store. */
++
++static bfd_boolean
++aarch64_mem_op_p (uint32_t insn, unsigned int *rt, unsigned int *rtn,
++ bfd_boolean *pair, bfd_boolean *load)
++{
++ uint32_t opcode;
++ unsigned int r;
++ uint32_t opc = 0;
++ uint32_t v = 0;
++ uint32_t opc_v = 0;
++
++ /* Bail out quickly if INSN doesn't fall into the the load-store
++ encoding space. */
++ if (!AARCH64_LDST (insn))
++ return FALSE;
++
++ *pair = FALSE;
++ *load = FALSE;
++ if (AARCH64_LDST_EX (insn))
++ {
++ *rt = AARCH64_RT (insn);
++ *rtn = *rt;
++ if (AARCH64_BIT (insn, 21) == 1)
++ {
++ *pair = TRUE;
++ *rtn = AARCH64_RT2 (insn);
++ }
++ *load = AARCH64_LD (insn);
++ return TRUE;
++ }
++ else if (AARCH64_LDST_NAP (insn)
++ || AARCH64_LDSTP_PI (insn)
++ || AARCH64_LDSTP_O (insn)
++ || AARCH64_LDSTP_PRE (insn))
++ {
++ *pair = TRUE;
++ *rt = AARCH64_RT (insn);
++ *rtn = AARCH64_RT2 (insn);
++ *load = AARCH64_LD (insn);
++ return TRUE;
++ }
++ else if (AARCH64_LDST_PCREL (insn)
++ || AARCH64_LDST_UI (insn)
++ || AARCH64_LDST_PIIMM (insn)
++ || AARCH64_LDST_U (insn)
++ || AARCH64_LDST_PREIMM (insn)
++ || AARCH64_LDST_RO (insn)
++ || AARCH64_LDST_UIMM (insn))
++ {
++ *rt = AARCH64_RT (insn);
++ *rtn = *rt;
++ if (AARCH64_LDST_PCREL (insn))
++ *load = TRUE;
++ opc = AARCH64_BITS (insn, 22, 2);
++ v = AARCH64_BIT (insn, 26);
++ opc_v = opc | (v << 2);
++ *load = (opc_v == 1 || opc_v == 2 || opc_v == 3
++ || opc_v == 5 || opc_v == 7);
++ return TRUE;
++ }
++ else if (AARCH64_LDST_SIMD_M (insn)
++ || AARCH64_LDST_SIMD_M_PI (insn))
++ {
++ *rt = AARCH64_RT (insn);
++ *load = AARCH64_BIT (insn, 22);
++ opcode = (insn >> 12) & 0xf;
++ switch (opcode)
++ {
++ case 0:
++ case 2:
++ *rtn = *rt + 3;
++ break;
++
++ case 4:
++ case 6:
++ *rtn = *rt + 2;
++ break;
++
++ case 7:
++ *rtn = *rt;
++ break;
++
++ case 8:
++ case 10:
++ *rtn = *rt + 1;
++ break;
++
++ default:
++ return FALSE;
++ }
++ return TRUE;
++ }
++ else if (AARCH64_LDST_SIMD_S (insn)
++ || AARCH64_LDST_SIMD_S_PI (insn))
++ {
++ *rt = AARCH64_RT (insn);
++ r = (insn >> 21) & 1;
++ *load = AARCH64_BIT (insn, 22);
++ opcode = (insn >> 13) & 0x7;
++ switch (opcode)
++ {
++ case 0:
++ case 2:
++ case 4:
++ *rtn = *rt + r;
++ break;
++
++ case 1:
++ case 3:
++ case 5:
++ *rtn = *rt + (r == 0 ? 2 : 3);
++ break;
++
++ case 6:
++ *rtn = *rt + r;
++ break;
++
++ case 7:
++ *rtn = *rt + (r == 0 ? 2 : 3);
++ break;
++
++ default:
++ return FALSE;
++ }
++ return TRUE;
++ }
++
++ return FALSE;
++}
++
++/* Return TRUE if INSN is multiply-accumulate. */
++
++static bfd_boolean
++aarch64_mlxl_p (uint32_t insn)
++{
++ uint32_t op31 = AARCH64_OP31 (insn);
++
++ if (AARCH64_MAC (insn)
++ && (op31 == 0 || op31 == 1 || op31 == 5)
++ /* Exclude MUL instructions which are encoded as a multiple accumulate
++ with RA = XZR. */
++ && AARCH64_RA (insn) != AARCH64_ZR)
++ return TRUE;
++
++ return FALSE;
++}
++
++/* Some early revisions of the Cortex-A53 have an erratum (835769) whereby
++ it is possible for a 64-bit multiply-accumulate instruction to generate an
++ incorrect result. The details are quite complex and hard to
++ determine statically, since branches in the code may exist in some
++ circumstances, but all cases end with a memory (load, store, or
++ prefetch) instruction followed immediately by the multiply-accumulate
++ operation. We employ a linker patching technique, by moving the potentially
++ affected multiply-accumulate instruction into a patch region and replacing
++ the original instruction with a branch to the patch. This function checks
++ if INSN_1 is the memory operation followed by a multiply-accumulate
++ operation (INSN_2). Return TRUE if an erratum sequence is found, FALSE
++ if INSN_1 and INSN_2 are safe. */
++
++static bfd_boolean
++aarch64_erratum_sequence (uint32_t insn_1, uint32_t insn_2)
++{
++ uint32_t rt;
++ uint32_t rtn;
++ uint32_t rn;
++ uint32_t rm;
++ uint32_t ra;
++ bfd_boolean pair;
++ bfd_boolean load;
++
++ if (aarch64_mlxl_p (insn_2)
++ && aarch64_mem_op_p (insn_1, &rt, &rtn, &pair, &load))
++ {
++ /* Any SIMD memory op is independent of the subsequent MLA
++ by definition of the erratum. */
++ if (AARCH64_BIT (insn_1, 26))
++ return TRUE;
++
++ /* If not SIMD, check for integer memory ops and MLA relationship. */
++ rn = AARCH64_RN (insn_2);
++ ra = AARCH64_RA (insn_2);
++ rm = AARCH64_RM (insn_2);
++
++ /* If this is a load and there's a true(RAW) dependency, we are safe
++ and this is not an erratum sequence. */
++ if (load &&
++ (rt == rn || rt == rm || rt == ra
++ || (pair && (rtn == rn || rtn == rm || rtn == ra))))
++ return FALSE;
++
++ /* We conservatively put out stubs for all other cases (including
++ writebacks). */
++ return TRUE;
++ }
++
++ return FALSE;
++}
++
++static bfd_boolean
++erratum_835769_scan (bfd *input_bfd,
++ struct bfd_link_info *info,
++ struct aarch64_erratum_835769_fix **fixes_p,
++ unsigned int *num_fixes_p,
++ unsigned int *fix_table_size_p)
++{
++ asection *section;
++ struct elf_aarch64_link_hash_table *htab = elf_aarch64_hash_table (info);
++ struct aarch64_erratum_835769_fix *fixes = *fixes_p;
++ unsigned int num_fixes = *num_fixes_p;
++ unsigned int fix_table_size = *fix_table_size_p;
++
++ if (htab == NULL)
++ return FALSE;
++
++ for (section = input_bfd->sections;
++ section != NULL;
++ section = section->next)
++ {
++ bfd_byte *contents = NULL;
++ struct _aarch64_elf_section_data *sec_data;
++ unsigned int span;
++
++ if (elf_section_type (section) != SHT_PROGBITS
++ || (elf_section_flags (section) & SHF_EXECINSTR) == 0
++ || (section->flags & SEC_EXCLUDE) != 0
++ || (section->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
++ || (section->output_section == bfd_abs_section_ptr))
++ continue;
++
++ if (elf_section_data (section)->this_hdr.contents != NULL)
++ contents = elf_section_data (section)->this_hdr.contents;
++ else if (! bfd_malloc_and_get_section (input_bfd, section, &contents))
++ return TRUE;
++
++ sec_data = elf_aarch64_section_data (section);
++ for (span = 0; span < sec_data->mapcount; span++)
++ {
++ unsigned int span_start = sec_data->map[span].vma;
++ unsigned int span_end = ((span == sec_data->mapcount - 1)
++ ? sec_data->map[0].vma + section->size
++ : sec_data->map[span + 1].vma);
++ unsigned int i;
++ char span_type = sec_data->map[span].type;
++
++ if (span_type == 'd')
++ continue;
++
++ for (i = span_start; i + 4 < span_end; i += 4)
++ {
++ uint32_t insn_1 = bfd_getl32 (contents + i);
++ uint32_t insn_2 = bfd_getl32 (contents + i + 4);
++
++ if (aarch64_erratum_sequence (insn_1, insn_2))
++ {
++ char *stub_name = NULL;
++ stub_name = (char *) bfd_malloc
++ (strlen ("__erratum_835769_veneer_") + 16);
++ if (stub_name != NULL)
++ sprintf
++ (stub_name,"__erratum_835769_veneer_%d", num_fixes);
++ else
++ return TRUE;
++
++ if (num_fixes == fix_table_size)
++ {
++ fix_table_size *= 2;
++ fixes =
++ (struct aarch64_erratum_835769_fix *)
++ bfd_realloc (fixes,
++ sizeof (struct aarch64_erratum_835769_fix)
++ * fix_table_size);
++ if (fixes == NULL)
++ return TRUE;
++ }
++
++ fixes[num_fixes].input_bfd = input_bfd;
++ fixes[num_fixes].section = section;
++ fixes[num_fixes].offset = i + 4;
++ fixes[num_fixes].veneered_insn = insn_2;
++ fixes[num_fixes].stub_name = stub_name;
++ fixes[num_fixes].stub_type = aarch64_stub_erratum_835769_veneer;
++ num_fixes++;
++ }
++ }
++ }
++ if (elf_section_data (section)->this_hdr.contents == NULL)
++ free (contents);
++ }
++
++ *fixes_p = fixes;
++ *num_fixes_p = num_fixes;
++ *fix_table_size_p = fix_table_size;
++ return FALSE;
++}
++
++/* Find or create a stub section. Returns a pointer to the stub section, and
++ the section to which the stub section will be attached (in *LINK_SEC_P).
++ LINK_SEC_P may be NULL. */
++
++static asection *
++elf_aarch64_create_or_find_stub_sec (asection **link_sec_p, asection *section,
++ struct elf_aarch64_link_hash_table *htab)
++{
++ asection *link_sec;
++ asection *stub_sec;
++
++ link_sec = htab->stub_group[section->id].link_sec;
++ BFD_ASSERT (link_sec != NULL);
++ stub_sec = htab->stub_group[section->id].stub_sec;
++
++ if (stub_sec == NULL)
++ {
++ stub_sec = htab->stub_group[link_sec->id].stub_sec;
++ if (stub_sec == NULL)
++ {
++ size_t namelen;
++ bfd_size_type len;
++ char *s_name;
++
++ namelen = strlen (link_sec->name);
++ len = namelen + sizeof (STUB_SUFFIX);
++ s_name = (char *) bfd_alloc (htab->stub_bfd, len);
++ if (s_name == NULL)
++ return NULL;
++
++ memcpy (s_name, link_sec->name, namelen);
++ memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
++ stub_sec = (*htab->add_stub_section) (s_name, link_sec);
++
++ if (stub_sec == NULL)
++ return NULL;
++ htab->stub_group[link_sec->id].stub_sec = stub_sec;
++ }
++ htab->stub_group[section->id].stub_sec = stub_sec;
++ }
++
++ if (link_sec_p)
++ *link_sec_p = link_sec;
++
++ return stub_sec;
++}
++
+ /* Determine and set the size of the stub section for a final link.
+
+ The basic idea here is to examine all the relocations looking for
+@@ -2659,6 +3099,21 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
+ bfd_boolean stubs_always_before_branch;
+ bfd_boolean stub_changed = 0;
+ struct elf_aarch64_link_hash_table *htab = elf_aarch64_hash_table (info);
++ struct aarch64_erratum_835769_fix *erratum_835769_fixes = NULL;
++ unsigned int num_erratum_835769_fixes = 0;
++ unsigned int erratum_835769_fix_table_size = 10;
++ unsigned int i;
++
++ if (htab->fix_erratum_835769)
++ {
++ erratum_835769_fixes
++ = (struct aarch64_erratum_835769_fix *)
++ bfd_zmalloc
++ (sizeof (struct aarch64_erratum_835769_fix) *
++ erratum_835769_fix_table_size);
++ if (erratum_835769_fixes == NULL)
++ goto error_ret_free_local;
++ }
+
+ /* Propagate mach to stub bfd, because it may not have been
+ finalized when we created stub_bfd. */
+@@ -2689,7 +3144,9 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
+ bfd *input_bfd;
+ unsigned int bfd_indx;
+ asection *stub_sec;
++ unsigned prev_num_erratum_835769_fixes = num_erratum_835769_fixes;
+
++ num_erratum_835769_fixes = 0;
+ for (input_bfd = info->input_bfds, bfd_indx = 0;
+ input_bfd != NULL; input_bfd = input_bfd->link_next, bfd_indx++)
+ {
+@@ -2942,8 +3399,20 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
+ if (elf_section_data (section)->relocs == NULL)
+ free (internal_relocs);
+ }
++
++ if (htab->fix_erratum_835769)
++ {
++ /* Scan for sequences which might trigger erratum 835769. */
++ if (erratum_835769_scan (input_bfd, info, &erratum_835769_fixes,
++ &num_erratum_835769_fixes,
++ &erratum_835769_fix_table_size) != 0)
++ goto error_ret_free_local;
++ }
+ }
+
++ if (prev_num_erratum_835769_fixes != num_erratum_835769_fixes)
++ stub_changed = TRUE;
++
+ if (!stub_changed)
+ break;
+
+@@ -2951,15 +3420,76 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
+ stub sections. */
+ for (stub_sec = htab->stub_bfd->sections;
+ stub_sec != NULL; stub_sec = stub_sec->next)
+- stub_sec->size = 0;
++ {
++ /* Ignore non-stub sections. */
++ if (!strstr (stub_sec->name, STUB_SUFFIX))
++ continue;
++ stub_sec->size = 0;
++ }
+
+ bfd_hash_traverse (&htab->stub_hash_table, aarch64_size_one_stub, htab);
+
++ /* Add erratum 835769 veneers to stub section sizes too. */
++ if (htab->fix_erratum_835769)
++ for (i = 0; i < num_erratum_835769_fixes; i++)
++ {
++ stub_sec = elf_aarch64_create_or_find_stub_sec (NULL,
++ erratum_835769_fixes[i].section, htab);
++
++ if (stub_sec == NULL)
++ goto error_ret_free_local;
++
++ stub_sec->size += 8;
++ }
++
+ /* Ask the linker to do its stuff. */
+ (*htab->layout_sections_again) ();
+ stub_changed = FALSE;
+ }
+
++ /* Add stubs for erratum 835769 fixes now. */
++ if (htab->fix_erratum_835769)
++ {
++ for (i = 0; i < num_erratum_835769_fixes; i++)
++ {
++ struct elf_aarch64_stub_hash_entry *stub_entry;
++ char *stub_name = erratum_835769_fixes[i].stub_name;
++ asection *section = erratum_835769_fixes[i].section;
++ unsigned int section_id = erratum_835769_fixes[i].section->id;
++ asection *link_sec = htab->stub_group[section_id].link_sec;
++ asection *stub_sec = htab->stub_group[section_id].stub_sec;
++
++ stub_entry = aarch64_stub_hash_lookup (&htab->stub_hash_table,
++ stub_name, TRUE, FALSE);
++ if (stub_entry == NULL)
++ {
++ (*_bfd_error_handler) (_("%s: cannot create stub entry %s"),
++ section->owner,
++ stub_name);
++ return FALSE;
++ }
++
++ stub_entry->stub_sec = stub_sec;
++ stub_entry->stub_offset = 0;
++ stub_entry->id_sec = link_sec;
++ stub_entry->stub_type = erratum_835769_fixes[i].stub_type;
++ stub_entry->target_section = section;
++ stub_entry->target_value = erratum_835769_fixes[i].offset;
++ stub_entry->veneered_insn = erratum_835769_fixes[i].veneered_insn;
++ stub_entry->output_name = erratum_835769_fixes[i].stub_name;
++ }
++
++ /* Stash the erratum 835769 fix array for use later in
++ elfNN_aarch64_write_section(). */
++ htab->aarch64_erratum_835769_fixes = erratum_835769_fixes;
++ htab->num_aarch64_erratum_835769_fixes = num_erratum_835769_fixes;
++ }
++ else
++ {
++ htab->aarch64_erratum_835769_fixes = NULL;
++ htab->num_aarch64_erratum_835769_fixes = 0;
++ }
++
+ return TRUE;
+
+ error_ret_free_local:
+@@ -3052,7 +3582,7 @@ bfd_elfNN_aarch64_init_maps (bfd *abfd)
+ return;
+
+ if ((abfd->flags & DYNAMIC) != 0)
+- return;
++ return;
+
+ hdr = &elf_symtab_hdr (abfd);
+ localsyms = hdr->sh_info;
+@@ -3090,12 +3620,14 @@ void
+ bfd_elfNN_aarch64_set_options (struct bfd *output_bfd,
+ struct bfd_link_info *link_info,
+ int no_enum_warn,
+- int no_wchar_warn, int pic_veneer)
++ int no_wchar_warn, int pic_veneer,
++ int fix_erratum_835769)
+ {
+ struct elf_aarch64_link_hash_table *globals;
+
+ globals = elf_aarch64_hash_table (link_info);
+ globals->pic_veneer = pic_veneer;
++ globals->fix_erratum_835769 = fix_erratum_835769;
+
+ BFD_ASSERT (is_aarch64_elf (output_bfd));
+ elf_aarch64_tdata (output_bfd)->no_enum_size_warning = no_enum_warn;
+@@ -3406,6 +3938,89 @@ symbol_tlsdesc_got_offset (bfd *input_bfd, struct elf_link_hash_entry *h,
+ return value;
+ }
+
++/* Data for make_branch_to_erratum_835769_stub(). */
++
++struct erratum_835769_branch_to_stub_data
++{
++ asection *output_section;
++ bfd_byte *contents;
++};
++
++/* Helper to insert branches to erratum 835769 stubs in the right
++ places for a particular section. */
++
++static bfd_boolean
++make_branch_to_erratum_835769_stub (struct bfd_hash_entry *gen_entry,
++ void *in_arg)
++{
++ struct elf_aarch64_stub_hash_entry *stub_entry;
++ struct erratum_835769_branch_to_stub_data *data;
++ bfd_byte *contents;
++ unsigned long branch_insn = 0;
++ bfd_vma veneered_insn_loc, veneer_entry_loc;
++ bfd_signed_vma branch_offset;
++ unsigned int target;
++ bfd *abfd;
++
++ stub_entry = (struct elf_aarch64_stub_hash_entry *) gen_entry;
++ data = (struct erratum_835769_branch_to_stub_data *) in_arg;
++
++ if (stub_entry->target_section != data->output_section
++ || stub_entry->stub_type != aarch64_stub_erratum_835769_veneer)
++ return TRUE;
++
++ contents = data->contents;
++ veneered_insn_loc = stub_entry->target_section->output_section->vma
++ + stub_entry->target_section->output_offset
++ + stub_entry->target_value;
++ veneer_entry_loc = stub_entry->stub_sec->output_section->vma
++ + stub_entry->stub_sec->output_offset
++ + stub_entry->stub_offset;
++ branch_offset = veneer_entry_loc - veneered_insn_loc;
++
++ abfd = stub_entry->target_section->owner;
++ if (!aarch64_valid_branch_p (veneer_entry_loc, veneered_insn_loc))
++ (*_bfd_error_handler)
++ (_("%B: error: Erratum 835769 stub out "
++ "of range (input file too large)"), abfd);
++
++ target = stub_entry->target_value;
++ branch_insn = 0x14000000;
++ branch_offset >>= 2;
++ branch_offset &= 0x3ffffff;
++ branch_insn |= branch_offset;
++ bfd_putl32 (branch_insn, &contents[target]);
++
++ return TRUE;
++}
++
++static bfd_boolean
++elfNN_aarch64_write_section (bfd *output_bfd ATTRIBUTE_UNUSED,
++ struct bfd_link_info *link_info,
++ asection *sec,
++ bfd_byte *contents)
++
++{
++ struct elf_aarch64_link_hash_table *globals =
++ elf_aarch64_hash_table (link_info);
++
++ if (globals == NULL)
++ return FALSE;
++
++ /* Fix code to point to erratum 835769 stubs. */
++ if (globals->fix_erratum_835769)
++ {
++ struct erratum_835769_branch_to_stub_data data;
++
++ data.output_section = sec;
++ data.contents = contents;
++ bfd_hash_traverse (&globals->stub_hash_table,
++ make_branch_to_erratum_835769_stub, &data);
++ }
++
++ return FALSE;
++}
++
+ /* Perform a relocation as part of a final link. */
+ static bfd_reloc_status_type
+ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
+@@ -3589,7 +4204,8 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
if (globals->root.splt != NULL)
{
@@ -3853,7 +4730,7 @@ index 6bc414e..8503419 100644
off = (plt_index + 3) * GOT_ENTRY_SIZE;
base_got = globals->root.sgotplt;
}
-@@ -3843,7 +3844,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
+@@ -3843,7 +4459,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
value = (symbol_got_offset (input_bfd, h, r_symndx)
+ globals->root.sgot->output_section->vma
@@ -3862,7 +4739,7 @@ index 6bc414e..8503419 100644
value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,
0, weak_undef_p);
-@@ -3872,10 +3873,9 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
+@@ -3872,10 +4488,9 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
case BFD_RELOC_AARCH64_TLSDESC_LDR:
if (globals->root.sgot == NULL)
return bfd_reloc_notsupported;
@@ -3874,7 +4751,7 @@ index 6bc414e..8503419 100644
+ globals->sgotplt_jump_table_size);
value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,
-@@ -3957,7 +3957,7 @@ elfNN_aarch64_tls_relax (struct elf_aarch64_link_hash_table *globals,
+@@ -3957,7 +4572,7 @@ elfNN_aarch64_tls_relax (struct elf_aarch64_link_hash_table *globals,
ldr xd, [x0, #:tlsdesc_lo12:var] => ldr x0, [x0, #:gottprel_lo12:var]
*/
insn = bfd_getl32 (contents + rel->r_offset);
@@ -3883,7 +4760,38 @@ index 6bc414e..8503419 100644
bfd_putl32 (insn, contents + rel->r_offset);
return bfd_reloc_continue;
}
-@@ -6651,7 +6651,7 @@ elfNN_aarch64_create_small_pltn_entry (struct elf_link_hash_entry *h,
+@@ -5779,6 +6394,13 @@ aarch64_map_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
+ if (!elfNN_aarch64_output_map_sym (osi, AARCH64_MAP_DATA, addr + 16))
+ return FALSE;
+ break;
++ case aarch64_stub_erratum_835769_veneer:
++ if (!elfNN_aarch64_output_stub_sym (osi, stub_name, addr,
++ sizeof (aarch64_erratum_835769_stub)))
++ return FALSE;
++ if (!elfNN_aarch64_output_map_sym (osi, AARCH64_MAP_INSN, addr))
++ return FALSE;
++ break;
+ default:
+ BFD_FAIL ();
+ }
+@@ -6474,6 +7096,16 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ }
+ }
+
++ /* Init mapping symbols information to use later to distingush between
++ code and data while scanning for erratam 835769. */
++ if (htab->fix_erratum_835769)
++ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
++ {
++ if (!is_aarch64_elf (ibfd))
++ continue;
++ bfd_elfNN_aarch64_init_maps (ibfd);
++ }
++
+ /* We now have determined the sizes of the various dynamic sections.
+ Allocate memory for them. */
+ relocs = FALSE;
+@@ -6651,7 +7283,7 @@ elfNN_aarch64_create_small_pltn_entry (struct elf_link_hash_entry *h,
plt_entry = plt->contents + h->plt.offset;
plt_entry_address = plt->output_section->vma
@@ -3892,7 +4800,7 @@ index 6bc414e..8503419 100644
gotplt_entry_address = gotplt->output_section->vma +
gotplt->output_offset + got_offset;
-@@ -6823,7 +6823,34 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
+@@ -6823,7 +7455,34 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
+ htab->root.sgot->output_offset
+ (h->got.offset & ~(bfd_vma) 1));
@@ -3928,7 +4836,7 @@ index 6bc414e..8503419 100644
{
if (!h->def_regular)
return FALSE;
-@@ -6836,6 +6863,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
+@@ -6836,6 +7495,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
}
else
{
@@ -3936,7 +4844,7 @@ index 6bc414e..8503419 100644
BFD_ASSERT ((h->got.offset & 1) == 0);
bfd_put_NN (output_bfd, (bfd_vma) 0,
htab->root.sgot->contents + h->got.offset);
-@@ -6930,7 +6958,7 @@ elfNN_aarch64_init_small_plt0_entry (bfd *output_bfd ATTRIBUTE_UNUSED,
+@@ -6930,7 +7590,7 @@ elfNN_aarch64_init_small_plt0_entry (bfd *output_bfd ATTRIBUTE_UNUSED,
+ GOT_ENTRY_SIZE * 2);
plt_base = htab->root.splt->output_section->vma +
@@ -3945,6 +4853,16 @@ index 6bc414e..8503419 100644
/* Fill in the top 21 bits for this: ADRP x16, PLT_GOT + n * 8.
ADRP: ((PG(S+A)-PG(P)) >> 12) & 0x1fffff */
+@@ -7298,6 +7958,9 @@ const struct elf_size_info elfNN_aarch64_size_info =
+ #define elf_backend_size_info \
+ elfNN_aarch64_size_info
+
++#define elf_backend_write_section \
++ elfNN_aarch64_write_section
++
+ #define elf_backend_can_refcount 1
+ #define elf_backend_can_gc_sections 1
+ #define elf_backend_plt_readonly 1
diff --git a/bfd/section.c b/bfd/section.c
index fb19d8c..83b0dc9 100644
--- a/bfd/section.c
@@ -3958,12 +4876,12 @@ index fb19d8c..83b0dc9 100644
. {* Nonzero if this section uses RELA relocations, rather than REL. *}
. unsigned int use_rela_p:1;
diff --git a/bfd/version.h b/bfd/version.h
-index dec6798..d50c424 100644
+index dec6798..46c8d41 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,4 +1,4 @@
-#define BFD_VERSION_DATE 20131202
-+#define BFD_VERSION_DATE 20140613
++#define BFD_VERSION_DATE 20141017
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
@@ -4215,10 +5133,17 @@ index 0000000..fb96adc
+ #st4 {v27.d, v28.d, v29.d, v30.d}[0], [x30]
+ .inst 0x0d20a7db | (3 << 11)
diff --git a/gas/ChangeLog b/gas/ChangeLog
-index 7fafa26..cbdf74f 100644
+index 7fafa26..fa74e3d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
-@@ -1,3 +1,71 @@
+@@ -1,3 +1,78 @@
++2014-07-17 Ilya Tocar <ilya.tocar at intel.com>
++
++ Backport mainline patches
++ 2014-07-17 Ilya Tocar <ilya.tocar at intel.com>
++
++ * config/tc-i386.c (parse_register): Set need_vrex.
++
+2014-06-12 Alan Modra <amodra at gmail.com>
+
+ Backport mainline patches
@@ -4416,7 +5341,7 @@ index fb0ae33..7a69d00 100644
|| !inst.reloc.need_libopcodes_p)
output_inst (NULL);
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
-index 3c423da..b0a584b 100644
+index 3c423da..4d93906 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1,7 +1,7 @@
@@ -4489,6 +5414,15 @@ index 3c423da..b0a584b 100644
}
/* Check if broadcast is supported by the instruction and is applied
+@@ -9390,6 +9410,8 @@ parse_register (char *reg_string, char **end_op)
+ know (e->X_add_number >= 0
+ && (valueT) e->X_add_number < i386_regtab_size);
+ r = i386_regtab + e->X_add_number;
++ if ((r->reg_flags & RegVRex))
++ i.need_vrex = 1;
+ *end_op = input_line_pointer;
+ }
+ *input_line_pointer = c;
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 7c99e43..6c3c103 100644
--- a/gas/config/tc-ppc.c
@@ -4727,10 +5661,30 @@ index 082670c..61d10fe 100644
}
while (*input_line_pointer++ == ',');
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
-index be67b6e..04b20d4 100644
+index be67b6e..52cb17f 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
-@@ -1,3 +1,142 @@
+@@ -1,3 +1,162 @@
++2014-07-17 Ilya Tocar <ilya.tocar at intel.com>
++
++ Backport mainline patches
++ 2014-07-17 Ilya Tocar <ilya.tocar at intel.com>
++
++ * gas/i386/x86-64-equ.d: New.
++ * gas/i386/x86-64-equ.s: New.
++ * gas/i386/i386.exp: Run x86-64-equ.
++
++2014-07-08 Ilya Tocar <ilya.tocar at intel.com>
++
++ * gas/i386/evex-lig256-intel.d: Updated.
++ * gas/i386/evex-lig256.d: Updated.
++ * gas/i386/evex-lig512-intel.d: Updated.
++ * gas/i386/evex-lig512-intel.d: Updated.
++ * gas/i386/x86-64-evex-lig256-intel.d: Updated.
++ * gas/i386/x86-64-evex-lig256.d: Updated.
++ * gas/i386/x86-64-evex-lig512-intel.d: Updated.
++ * gas/i386/x86-64-evex-lig512-intel.d: Updated.
++
+2014-03-20 Ilya Tocar <ilya.tocar at intel.com>
+
+ * gas/i386/avx512pf-intel.d: Change memory size for vgatherpf0qps,
@@ -6044,8 +6998,200 @@ index 0000000..81b0ef3
+.text
+.byte 0xFF, 0xEF
+.byte 0xFF, 0xD8
+diff --git a/gas/testsuite/gas/i386/evex-lig256-intel.d b/gas/testsuite/gas/i386/evex-lig256-intel.d
+index ac25f70..86fa6c9 100644
+--- a/gas/testsuite/gas/i386/evex-lig256-intel.d
++++ b/gas/testsuite/gas/i386/evex-lig256-intel.d
+@@ -1241,8 +1241,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 b2 00 04 00 00 vmovsd QWORD PTR \[edx\+0x400\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 72 80 vmovsd QWORD PTR \[edx-0x400\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 b2 f8 fb ff ff vmovsd QWORD PTR \[edx-0x408\]\{k7\},xmm6
+-[ ]*[a-f0-9]+: 62 f1 d7 2f 10 f4 vmovsd xmm6\{k7\},xmm5,ymm4
+-[ ]*[a-f0-9]+: 62 f1 d7 af 10 f4 vmovsd xmm6\{k7\}\{z\},xmm5,ymm4
++[ ]*[a-f0-9]+: 62 f1 d7 2f 10 f4 vmovsd xmm6\{k7\},xmm5,xmm4
++[ ]*[a-f0-9]+: 62 f1 d7 af 10 f4 vmovsd xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 10 31 vmovss xmm6\{k7\},DWORD PTR \[ecx\]
+ [ ]*[a-f0-9]+: 62 f1 7e af 10 31 vmovss xmm6\{k7\}\{z\},DWORD PTR \[ecx\]
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 10 b4 f4 c0 1d fe ff vmovss xmm6\{k7\},DWORD PTR \[esp\+esi\*8-0x1e240\]
+@@ -1256,8 +1256,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 b2 00 02 00 00 vmovss DWORD PTR \[edx\+0x200\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 72 80 vmovss DWORD PTR \[edx-0x200\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 b2 fc fd ff ff vmovss DWORD PTR \[edx-0x204\]\{k7\},xmm6
+-[ ]*[a-f0-9]+: 62 f1 56 2f 10 f4 vmovss xmm6\{k7\},xmm5,ymm4
+-[ ]*[a-f0-9]+: 62 f1 56 af 10 f4 vmovss xmm6\{k7\}\{z\},xmm5,ymm4
++[ ]*[a-f0-9]+: 62 f1 56 2f 10 f4 vmovss xmm6\{k7\},xmm5,xmm4
++[ ]*[a-f0-9]+: 62 f1 56 af 10 f4 vmovss xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 2f 59 f4 vmulsd xmm6\{k7\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 af 59 f4 vmulsd xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 1f 59 f4 vmulsd xmm6\{k7\},xmm5,xmm4,\{rn-sae\}
+@@ -2768,8 +2768,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 b2 00 04 00 00 vmovsd QWORD PTR \[edx\+0x400\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 72 80 vmovsd QWORD PTR \[edx-0x400\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 b2 f8 fb ff ff vmovsd QWORD PTR \[edx-0x408\]\{k7\},xmm6
+-[ ]*[a-f0-9]+: 62 f1 d7 2f 10 f4 vmovsd xmm6\{k7\},xmm5,ymm4
+-[ ]*[a-f0-9]+: 62 f1 d7 af 10 f4 vmovsd xmm6\{k7\}\{z\},xmm5,ymm4
++[ ]*[a-f0-9]+: 62 f1 d7 2f 10 f4 vmovsd xmm6\{k7\},xmm5,xmm4
++[ ]*[a-f0-9]+: 62 f1 d7 af 10 f4 vmovsd xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 10 31 vmovss xmm6\{k7\},DWORD PTR \[ecx\]
+ [ ]*[a-f0-9]+: 62 f1 7e af 10 31 vmovss xmm6\{k7\}\{z\},DWORD PTR \[ecx\]
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 10 b4 f4 c0 1d fe ff vmovss xmm6\{k7\},DWORD PTR \[esp\+esi\*8-0x1e240\]
+@@ -2783,8 +2783,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 b2 00 02 00 00 vmovss DWORD PTR \[edx\+0x200\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 72 80 vmovss DWORD PTR \[edx-0x200\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 b2 fc fd ff ff vmovss DWORD PTR \[edx-0x204\]\{k7\},xmm6
+-[ ]*[a-f0-9]+: 62 f1 56 2f 10 f4 vmovss xmm6\{k7\},xmm5,ymm4
+-[ ]*[a-f0-9]+: 62 f1 56 af 10 f4 vmovss xmm6\{k7\}\{z\},xmm5,ymm4
++[ ]*[a-f0-9]+: 62 f1 56 2f 10 f4 vmovss xmm6\{k7\},xmm5,xmm4
++[ ]*[a-f0-9]+: 62 f1 56 af 10 f4 vmovss xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 2f 59 f4 vmulsd xmm6\{k7\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 af 59 f4 vmulsd xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 1f 59 f4 vmulsd xmm6\{k7\},xmm5,xmm4,\{rn-sae\}
+diff --git a/gas/testsuite/gas/i386/evex-lig256.d b/gas/testsuite/gas/i386/evex-lig256.d
+index 2f0de71..7e99258 100644
+--- a/gas/testsuite/gas/i386/evex-lig256.d
++++ b/gas/testsuite/gas/i386/evex-lig256.d
+@@ -1241,8 +1241,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 b2 00 04 00 00 vmovsd %xmm6,0x400\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 72 80 vmovsd %xmm6,-0x400\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 b2 f8 fb ff ff vmovsd %xmm6,-0x408\(%edx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 d7 2f 10 f4 vmovsd %ymm4,%xmm5,%xmm6\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 d7 af 10 f4 vmovsd %ymm4,%xmm5,%xmm6\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 f1 d7 2f 10 f4 vmovsd %xmm4,%xmm5,%xmm6\{%k7\}
++[ ]*[a-f0-9]+: 62 f1 d7 af 10 f4 vmovsd %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 10 31 vmovss \(%ecx\),%xmm6\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e af 10 31 vmovss \(%ecx\),%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 10 b4 f4 c0 1d fe ff vmovss -0x1e240\(%esp,%esi,8\),%xmm6\{%k7\}
+@@ -1256,8 +1256,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 b2 00 02 00 00 vmovss %xmm6,0x200\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 72 80 vmovss %xmm6,-0x200\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 b2 fc fd ff ff vmovss %xmm6,-0x204\(%edx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 56 2f 10 f4 vmovss %ymm4,%xmm5,%xmm6\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 56 af 10 f4 vmovss %ymm4,%xmm5,%xmm6\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 f1 56 2f 10 f4 vmovss %xmm4,%xmm5,%xmm6\{%k7\}
++[ ]*[a-f0-9]+: 62 f1 56 af 10 f4 vmovss %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 d7 2f 59 f4 vmulsd %xmm4,%xmm5,%xmm6\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 d7 af 59 f4 vmulsd %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 d7 1f 59 f4 vmulsd \{rn-sae\},%xmm4,%xmm5,%xmm6\{%k7\}
+@@ -2768,8 +2768,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 b2 00 04 00 00 vmovsd %xmm6,0x400\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 72 80 vmovsd %xmm6,-0x400\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 ff 2f 11 b2 f8 fb ff ff vmovsd %xmm6,-0x408\(%edx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 d7 2f 10 f4 vmovsd %ymm4,%xmm5,%xmm6\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 d7 af 10 f4 vmovsd %ymm4,%xmm5,%xmm6\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 f1 d7 2f 10 f4 vmovsd %xmm4,%xmm5,%xmm6\{%k7\}
++[ ]*[a-f0-9]+: 62 f1 d7 af 10 f4 vmovsd %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 10 31 vmovss \(%ecx\),%xmm6\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e af 10 31 vmovss \(%ecx\),%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 10 b4 f4 c0 1d fe ff vmovss -0x1e240\(%esp,%esi,8\),%xmm6\{%k7\}
+@@ -2783,8 +2783,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 b2 00 02 00 00 vmovss %xmm6,0x200\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 72 80 vmovss %xmm6,-0x200\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e 2f 11 b2 fc fd ff ff vmovss %xmm6,-0x204\(%edx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 56 2f 10 f4 vmovss %ymm4,%xmm5,%xmm6\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 56 af 10 f4 vmovss %ymm4,%xmm5,%xmm6\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 f1 56 2f 10 f4 vmovss %xmm4,%xmm5,%xmm6\{%k7\}
++[ ]*[a-f0-9]+: 62 f1 56 af 10 f4 vmovss %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 d7 2f 59 f4 vmulsd %xmm4,%xmm5,%xmm6\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 d7 af 59 f4 vmulsd %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 d7 1f 59 f4 vmulsd \{rn-sae\},%xmm4,%xmm5,%xmm6\{%k7\}
+diff --git a/gas/testsuite/gas/i386/evex-lig512-intel.d b/gas/testsuite/gas/i386/evex-lig512-intel.d
+index 43e1650..200b1e3 100644
+--- a/gas/testsuite/gas/i386/evex-lig512-intel.d
++++ b/gas/testsuite/gas/i386/evex-lig512-intel.d
+@@ -1241,8 +1241,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 b2 00 04 00 00 vmovsd QWORD PTR \[edx\+0x400\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 72 80 vmovsd QWORD PTR \[edx-0x400\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 b2 f8 fb ff ff vmovsd QWORD PTR \[edx-0x408\]\{k7\},xmm6
+-[ ]*[a-f0-9]+: 62 f1 d7 4f 10 f4 vmovsd xmm6\{k7\},xmm5,zmm4
+-[ ]*[a-f0-9]+: 62 f1 d7 cf 10 f4 vmovsd xmm6\{k7\}\{z\},xmm5,zmm4
++[ ]*[a-f0-9]+: 62 f1 d7 4f 10 f4 vmovsd xmm6\{k7\},xmm5,xmm4
++[ ]*[a-f0-9]+: 62 f1 d7 cf 10 f4 vmovsd xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 10 31 vmovss xmm6\{k7\},DWORD PTR \[ecx\]
+ [ ]*[a-f0-9]+: 62 f1 7e cf 10 31 vmovss xmm6\{k7\}\{z\},DWORD PTR \[ecx\]
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 10 b4 f4 c0 1d fe ff vmovss xmm6\{k7\},DWORD PTR \[esp\+esi\*8-0x1e240\]
+@@ -1256,8 +1256,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 b2 00 02 00 00 vmovss DWORD PTR \[edx\+0x200\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 72 80 vmovss DWORD PTR \[edx-0x200\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 b2 fc fd ff ff vmovss DWORD PTR \[edx-0x204\]\{k7\},xmm6
+-[ ]*[a-f0-9]+: 62 f1 56 4f 10 f4 vmovss xmm6\{k7\},xmm5,zmm4
+-[ ]*[a-f0-9]+: 62 f1 56 cf 10 f4 vmovss xmm6\{k7\}\{z\},xmm5,zmm4
++[ ]*[a-f0-9]+: 62 f1 56 4f 10 f4 vmovss xmm6\{k7\},xmm5,xmm4
++[ ]*[a-f0-9]+: 62 f1 56 cf 10 f4 vmovss xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 4f 59 f4 vmulsd xmm6\{k7\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 cf 59 f4 vmulsd xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 1f 59 f4 vmulsd xmm6\{k7\},xmm5,xmm4,\{rn-sae\}
+@@ -2768,8 +2768,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 b2 00 04 00 00 vmovsd QWORD PTR \[edx\+0x400\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 72 80 vmovsd QWORD PTR \[edx-0x400\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 b2 f8 fb ff ff vmovsd QWORD PTR \[edx-0x408\]\{k7\},xmm6
+-[ ]*[a-f0-9]+: 62 f1 d7 4f 10 f4 vmovsd xmm6\{k7\},xmm5,zmm4
+-[ ]*[a-f0-9]+: 62 f1 d7 cf 10 f4 vmovsd xmm6\{k7\}\{z\},xmm5,zmm4
++[ ]*[a-f0-9]+: 62 f1 d7 4f 10 f4 vmovsd xmm6\{k7\},xmm5,xmm4
++[ ]*[a-f0-9]+: 62 f1 d7 cf 10 f4 vmovsd xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 10 31 vmovss xmm6\{k7\},DWORD PTR \[ecx\]
+ [ ]*[a-f0-9]+: 62 f1 7e cf 10 31 vmovss xmm6\{k7\}\{z\},DWORD PTR \[ecx\]
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 10 b4 f4 c0 1d fe ff vmovss xmm6\{k7\},DWORD PTR \[esp\+esi\*8-0x1e240\]
+@@ -2783,8 +2783,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 b2 00 02 00 00 vmovss DWORD PTR \[edx\+0x200\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 72 80 vmovss DWORD PTR \[edx-0x200\]\{k7\},xmm6
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 b2 fc fd ff ff vmovss DWORD PTR \[edx-0x204\]\{k7\},xmm6
+-[ ]*[a-f0-9]+: 62 f1 56 4f 10 f4 vmovss xmm6\{k7\},xmm5,zmm4
+-[ ]*[a-f0-9]+: 62 f1 56 cf 10 f4 vmovss xmm6\{k7\}\{z\},xmm5,zmm4
++[ ]*[a-f0-9]+: 62 f1 56 4f 10 f4 vmovss xmm6\{k7\},xmm5,xmm4
++[ ]*[a-f0-9]+: 62 f1 56 cf 10 f4 vmovss xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 4f 59 f4 vmulsd xmm6\{k7\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 cf 59 f4 vmulsd xmm6\{k7\}\{z\},xmm5,xmm4
+ [ ]*[a-f0-9]+: 62 f1 d7 1f 59 f4 vmulsd xmm6\{k7\},xmm5,xmm4,\{rn-sae\}
+diff --git a/gas/testsuite/gas/i386/evex-lig512.d b/gas/testsuite/gas/i386/evex-lig512.d
+index 4bdb88c..a3c85b8 100644
+--- a/gas/testsuite/gas/i386/evex-lig512.d
++++ b/gas/testsuite/gas/i386/evex-lig512.d
+@@ -1241,8 +1241,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 b2 00 04 00 00 vmovsd %xmm6,0x400\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 72 80 vmovsd %xmm6,-0x400\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 b2 f8 fb ff ff vmovsd %xmm6,-0x408\(%edx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 d7 4f 10 f4 vmovsd %zmm4,%xmm5,%xmm6\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 d7 cf 10 f4 vmovsd %zmm4,%xmm5,%xmm6\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 f1 d7 4f 10 f4 vmovsd %xmm4,%xmm5,%xmm6\{%k7\}
++[ ]*[a-f0-9]+: 62 f1 d7 cf 10 f4 vmovsd %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 10 31 vmovss \(%ecx\),%xmm6\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e cf 10 31 vmovss \(%ecx\),%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 10 b4 f4 c0 1d fe ff vmovss -0x1e240\(%esp,%esi,8\),%xmm6\{%k7\}
+@@ -1256,8 +1256,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 b2 00 02 00 00 vmovss %xmm6,0x200\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 72 80 vmovss %xmm6,-0x200\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 b2 fc fd ff ff vmovss %xmm6,-0x204\(%edx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 56 4f 10 f4 vmovss %zmm4,%xmm5,%xmm6\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 56 cf 10 f4 vmovss %zmm4,%xmm5,%xmm6\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 f1 56 4f 10 f4 vmovss %xmm4,%xmm5,%xmm6\{%k7\}
++[ ]*[a-f0-9]+: 62 f1 56 cf 10 f4 vmovss %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 d7 4f 59 f4 vmulsd %xmm4,%xmm5,%xmm6\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 d7 cf 59 f4 vmulsd %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 d7 1f 59 f4 vmulsd \{rn-sae\},%xmm4,%xmm5,%xmm6\{%k7\}
+@@ -2768,8 +2768,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 b2 00 04 00 00 vmovsd %xmm6,0x400\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 72 80 vmovsd %xmm6,-0x400\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 ff 4f 11 b2 f8 fb ff ff vmovsd %xmm6,-0x408\(%edx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 d7 4f 10 f4 vmovsd %zmm4,%xmm5,%xmm6\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 d7 cf 10 f4 vmovsd %zmm4,%xmm5,%xmm6\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 f1 d7 4f 10 f4 vmovsd %xmm4,%xmm5,%xmm6\{%k7\}
++[ ]*[a-f0-9]+: 62 f1 d7 cf 10 f4 vmovsd %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 10 31 vmovss \(%ecx\),%xmm6\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e cf 10 31 vmovss \(%ecx\),%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 10 b4 f4 c0 1d fe ff vmovss -0x1e240\(%esp,%esi,8\),%xmm6\{%k7\}
+@@ -2783,8 +2783,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 b2 00 02 00 00 vmovss %xmm6,0x200\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 72 80 vmovss %xmm6,-0x200\(%edx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 7e 4f 11 b2 fc fd ff ff vmovss %xmm6,-0x204\(%edx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 56 4f 10 f4 vmovss %zmm4,%xmm5,%xmm6\{%k7\}
+-[ ]*[a-f0-9]+: 62 f1 56 cf 10 f4 vmovss %zmm4,%xmm5,%xmm6\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 f1 56 4f 10 f4 vmovss %xmm4,%xmm5,%xmm6\{%k7\}
++[ ]*[a-f0-9]+: 62 f1 56 cf 10 f4 vmovss %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 d7 4f 59 f4 vmulsd %xmm4,%xmm5,%xmm6\{%k7\}
+ [ ]*[a-f0-9]+: 62 f1 d7 cf 59 f4 vmulsd %xmm4,%xmm5,%xmm6\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 f1 d7 1f 59 f4 vmulsd \{rn-sae\},%xmm4,%xmm5,%xmm6\{%k7\}
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
-index 55ed9de..19fe0f3 100644
+index 55ed9de..30953f2 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -267,6 +267,15 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
@@ -6072,7 +7218,7 @@ index 55ed9de..19fe0f3 100644
} else {
run_dump_test "x86-64-w64-pcrel"
}
-@@ -552,6 +562,14 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
+@@ -552,6 +562,15 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
run_dump_test "x86-64-mpx-addr32"
run_dump_test "x86-64-mpx-add-bnd-prefix"
run_dump_test "x86-64-sha"
@@ -6084,6 +7230,7 @@ index 55ed9de..19fe0f3 100644
+ run_dump_test "x86-64-xsaves-intel"
+ run_dump_test "x86-64-prefetchwt1"
+ run_dump_test "x86-64-prefetchwt1-intel"
++ run_dump_test "x86-64-equ"
if { ![istarget "*-*-aix*"]
&& ![istarget "*-*-beos*"]
@@ -7453,6 +8600,231 @@ index 0000000..81b0ef3
+.text
+.byte 0xFF, 0xEF
+.byte 0xFF, 0xD8
+diff --git a/gas/testsuite/gas/i386/x86-64-equ.d b/gas/testsuite/gas/i386/x86-64-equ.d
+new file mode 100644
+index 0000000..3ecb0bb
+--- /dev/null
++++ b/gas/testsuite/gas/i386/x86-64-equ.d
+@@ -0,0 +1,11 @@
++#objdump: -drw
++#name: evex equates
++
++.*: +file format .*
++
++Disassembly of section .text:
++
++0+000 <_start>:
++[ ]*[a-f0-9]+: 62 e1 76 08 58 c8 vaddss %xmm0,%xmm1,%xmm17
++[ ]*[a-f0-9]+: 62 b1 76 08 58 c1 vaddss %xmm17,%xmm1,%xmm0
++#pass
+diff --git a/gas/testsuite/gas/i386/x86-64-equ.s b/gas/testsuite/gas/i386/x86-64-equ.s
+new file mode 100644
+index 0000000..26cfd72
+--- /dev/null
++++ b/gas/testsuite/gas/i386/x86-64-equ.s
+@@ -0,0 +1,10 @@
++ .text
++_start:
++
++ .set ACC, %xmm17
++ vaddss %xmm0,%xmm1,ACC
++
++ .intel_syntax noprefix
++
++ .set ACC, xmm17
++ vaddss xmm0,xmm1,ACC
+diff --git a/gas/testsuite/gas/i386/x86-64-evex-lig256-intel.d b/gas/testsuite/gas/i386/x86-64-evex-lig256-intel.d
+index 8e27347..d925b37 100644
+--- a/gas/testsuite/gas/i386/x86-64-evex-lig256-intel.d
++++ b/gas/testsuite/gas/i386/x86-64-evex-lig256-intel.d
+@@ -1339,8 +1339,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 b2 00 04 00 00 vmovsd QWORD PTR \[rdx\+0x400\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 72 80 vmovsd QWORD PTR \[rdx-0x400\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 b2 f8 fb ff ff vmovsd QWORD PTR \[rdx-0x408\]\{k7\},xmm30
+-[ ]*[a-f0-9]+: 62 01 97 27 10 f4 vmovsd xmm30\{k7\},xmm29,ymm28
+-[ ]*[a-f0-9]+: 62 01 97 a7 10 f4 vmovsd xmm30\{k7\}\{z\},xmm29,ymm28
++[ ]*[a-f0-9]+: 62 01 97 27 10 f4 vmovsd xmm30\{k7\},xmm29,xmm28
++[ ]*[a-f0-9]+: 62 01 97 a7 10 f4 vmovsd xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 61 7e 2f 10 31 vmovss xmm30\{k7\},DWORD PTR \[rcx\]
+ [ ]*[a-f0-9]+: 62 61 7e af 10 31 vmovss xmm30\{k7\}\{z\},DWORD PTR \[rcx\]
+ [ ]*[a-f0-9]+: 62 21 7e 2f 10 b4 f0 23 01 00 00 vmovss xmm30\{k7\},DWORD PTR \[rax\+r14\*8\+0x123\]
+@@ -1354,8 +1354,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 b2 00 02 00 00 vmovss DWORD PTR \[rdx\+0x200\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 72 80 vmovss DWORD PTR \[rdx-0x200\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 b2 fc fd ff ff vmovss DWORD PTR \[rdx-0x204\]\{k7\},xmm30
+-[ ]*[a-f0-9]+: 62 01 16 27 10 f4 vmovss xmm30\{k7\},xmm29,ymm28
+-[ ]*[a-f0-9]+: 62 01 16 a7 10 f4 vmovss xmm30\{k7\}\{z\},xmm29,ymm28
++[ ]*[a-f0-9]+: 62 01 16 27 10 f4 vmovss xmm30\{k7\},xmm29,xmm28
++[ ]*[a-f0-9]+: 62 01 16 a7 10 f4 vmovss xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 27 59 f4 vmulsd xmm30\{k7\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 a7 59 f4 vmulsd xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 17 59 f4 vmulsd xmm30\{k7\},xmm29,xmm28,\{rn-sae\}
+@@ -3082,8 +3082,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 b2 00 04 00 00 vmovsd QWORD PTR \[rdx\+0x400\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 72 80 vmovsd QWORD PTR \[rdx-0x400\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 b2 f8 fb ff ff vmovsd QWORD PTR \[rdx-0x408\]\{k7\},xmm30
+-[ ]*[a-f0-9]+: 62 01 97 27 10 f4 vmovsd xmm30\{k7\},xmm29,ymm28
+-[ ]*[a-f0-9]+: 62 01 97 a7 10 f4 vmovsd xmm30\{k7\}\{z\},xmm29,ymm28
++[ ]*[a-f0-9]+: 62 01 97 27 10 f4 vmovsd xmm30\{k7\},xmm29,xmm28
++[ ]*[a-f0-9]+: 62 01 97 a7 10 f4 vmovsd xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 61 7e 2f 10 31 vmovss xmm30\{k7\},DWORD PTR \[rcx\]
+ [ ]*[a-f0-9]+: 62 61 7e af 10 31 vmovss xmm30\{k7\}\{z\},DWORD PTR \[rcx\]
+ [ ]*[a-f0-9]+: 62 21 7e 2f 10 b4 f0 34 12 00 00 vmovss xmm30\{k7\},DWORD PTR \[rax\+r14\*8\+0x1234\]
+@@ -3097,8 +3097,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 b2 00 02 00 00 vmovss DWORD PTR \[rdx\+0x200\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 72 80 vmovss DWORD PTR \[rdx-0x200\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 b2 fc fd ff ff vmovss DWORD PTR \[rdx-0x204\]\{k7\},xmm30
+-[ ]*[a-f0-9]+: 62 01 16 27 10 f4 vmovss xmm30\{k7\},xmm29,ymm28
+-[ ]*[a-f0-9]+: 62 01 16 a7 10 f4 vmovss xmm30\{k7\}\{z\},xmm29,ymm28
++[ ]*[a-f0-9]+: 62 01 16 27 10 f4 vmovss xmm30\{k7\},xmm29,xmm28
++[ ]*[a-f0-9]+: 62 01 16 a7 10 f4 vmovss xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 27 59 f4 vmulsd xmm30\{k7\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 a7 59 f4 vmulsd xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 17 59 f4 vmulsd xmm30\{k7\},xmm29,xmm28,\{rn-sae\}
+diff --git a/gas/testsuite/gas/i386/x86-64-evex-lig256.d b/gas/testsuite/gas/i386/x86-64-evex-lig256.d
+index 27a4f4c..7f76350 100644
+--- a/gas/testsuite/gas/i386/x86-64-evex-lig256.d
++++ b/gas/testsuite/gas/i386/x86-64-evex-lig256.d
+@@ -1339,8 +1339,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 b2 00 04 00 00 vmovsd %xmm30,0x400\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 72 80 vmovsd %xmm30,-0x400\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 b2 f8 fb ff ff vmovsd %xmm30,-0x408\(%rdx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 97 27 10 f4 vmovsd %ymm28,%xmm29,%xmm30\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 97 a7 10 f4 vmovsd %ymm28,%xmm29,%xmm30\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 01 97 27 10 f4 vmovsd %xmm28,%xmm29,%xmm30\{%k7\}
++[ ]*[a-f0-9]+: 62 01 97 a7 10 f4 vmovsd %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 61 7e 2f 10 31 vmovss \(%rcx\),%xmm30\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e af 10 31 vmovss \(%rcx\),%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 21 7e 2f 10 b4 f0 23 01 00 00 vmovss 0x123\(%rax,%r14,8\),%xmm30\{%k7\}
+@@ -1354,8 +1354,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 b2 00 02 00 00 vmovss %xmm30,0x200\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 72 80 vmovss %xmm30,-0x200\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 b2 fc fd ff ff vmovss %xmm30,-0x204\(%rdx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 16 27 10 f4 vmovss %ymm28,%xmm29,%xmm30\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 16 a7 10 f4 vmovss %ymm28,%xmm29,%xmm30\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 01 16 27 10 f4 vmovss %xmm28,%xmm29,%xmm30\{%k7\}
++[ ]*[a-f0-9]+: 62 01 16 a7 10 f4 vmovss %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 01 97 27 59 f4 vmulsd %xmm28,%xmm29,%xmm30\{%k7\}
+ [ ]*[a-f0-9]+: 62 01 97 a7 59 f4 vmulsd %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 01 97 17 59 f4 vmulsd \{rn-sae\},%xmm28,%xmm29,%xmm30\{%k7\}
+@@ -3082,8 +3082,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 b2 00 04 00 00 vmovsd %xmm30,0x400\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 72 80 vmovsd %xmm30,-0x400\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 ff 2f 11 b2 f8 fb ff ff vmovsd %xmm30,-0x408\(%rdx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 97 27 10 f4 vmovsd %ymm28,%xmm29,%xmm30\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 97 a7 10 f4 vmovsd %ymm28,%xmm29,%xmm30\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 01 97 27 10 f4 vmovsd %xmm28,%xmm29,%xmm30\{%k7\}
++[ ]*[a-f0-9]+: 62 01 97 a7 10 f4 vmovsd %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 61 7e 2f 10 31 vmovss \(%rcx\),%xmm30\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e af 10 31 vmovss \(%rcx\),%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 21 7e 2f 10 b4 f0 34 12 00 00 vmovss 0x1234\(%rax,%r14,8\),%xmm30\{%k7\}
+@@ -3097,8 +3097,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 b2 00 02 00 00 vmovss %xmm30,0x200\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 72 80 vmovss %xmm30,-0x200\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e 2f 11 b2 fc fd ff ff vmovss %xmm30,-0x204\(%rdx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 16 27 10 f4 vmovss %ymm28,%xmm29,%xmm30\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 16 a7 10 f4 vmovss %ymm28,%xmm29,%xmm30\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 01 16 27 10 f4 vmovss %xmm28,%xmm29,%xmm30\{%k7\}
++[ ]*[a-f0-9]+: 62 01 16 a7 10 f4 vmovss %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 01 97 27 59 f4 vmulsd %xmm28,%xmm29,%xmm30\{%k7\}
+ [ ]*[a-f0-9]+: 62 01 97 a7 59 f4 vmulsd %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 01 97 17 59 f4 vmulsd \{rn-sae\},%xmm28,%xmm29,%xmm30\{%k7\}
+diff --git a/gas/testsuite/gas/i386/x86-64-evex-lig512-intel.d b/gas/testsuite/gas/i386/x86-64-evex-lig512-intel.d
+index 0b25f56..ea3e380 100644
+--- a/gas/testsuite/gas/i386/x86-64-evex-lig512-intel.d
++++ b/gas/testsuite/gas/i386/x86-64-evex-lig512-intel.d
+@@ -1339,8 +1339,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 b2 00 04 00 00 vmovsd QWORD PTR \[rdx\+0x400\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 72 80 vmovsd QWORD PTR \[rdx-0x400\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 b2 f8 fb ff ff vmovsd QWORD PTR \[rdx-0x408\]\{k7\},xmm30
+-[ ]*[a-f0-9]+: 62 01 97 47 10 f4 vmovsd xmm30\{k7\},xmm29,zmm28
+-[ ]*[a-f0-9]+: 62 01 97 c7 10 f4 vmovsd xmm30\{k7\}\{z\},xmm29,zmm28
++[ ]*[a-f0-9]+: 62 01 97 47 10 f4 vmovsd xmm30\{k7\},xmm29,xmm28
++[ ]*[a-f0-9]+: 62 01 97 c7 10 f4 vmovsd xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 61 7e 4f 10 31 vmovss xmm30\{k7\},DWORD PTR \[rcx\]
+ [ ]*[a-f0-9]+: 62 61 7e cf 10 31 vmovss xmm30\{k7\}\{z\},DWORD PTR \[rcx\]
+ [ ]*[a-f0-9]+: 62 21 7e 4f 10 b4 f0 23 01 00 00 vmovss xmm30\{k7\},DWORD PTR \[rax\+r14\*8\+0x123\]
+@@ -1354,8 +1354,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 b2 00 02 00 00 vmovss DWORD PTR \[rdx\+0x200\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 72 80 vmovss DWORD PTR \[rdx-0x200\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 b2 fc fd ff ff vmovss DWORD PTR \[rdx-0x204\]\{k7\},xmm30
+-[ ]*[a-f0-9]+: 62 01 16 47 10 f4 vmovss xmm30\{k7\},xmm29,zmm28
+-[ ]*[a-f0-9]+: 62 01 16 c7 10 f4 vmovss xmm30\{k7\}\{z\},xmm29,zmm28
++[ ]*[a-f0-9]+: 62 01 16 47 10 f4 vmovss xmm30\{k7\},xmm29,xmm28
++[ ]*[a-f0-9]+: 62 01 16 c7 10 f4 vmovss xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 47 59 f4 vmulsd xmm30\{k7\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 c7 59 f4 vmulsd xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 17 59 f4 vmulsd xmm30\{k7\},xmm29,xmm28,\{rn-sae\}
+@@ -3082,8 +3082,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 b2 00 04 00 00 vmovsd QWORD PTR \[rdx\+0x400\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 72 80 vmovsd QWORD PTR \[rdx-0x400\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 b2 f8 fb ff ff vmovsd QWORD PTR \[rdx-0x408\]\{k7\},xmm30
+-[ ]*[a-f0-9]+: 62 01 97 47 10 f4 vmovsd xmm30\{k7\},xmm29,zmm28
+-[ ]*[a-f0-9]+: 62 01 97 c7 10 f4 vmovsd xmm30\{k7\}\{z\},xmm29,zmm28
++[ ]*[a-f0-9]+: 62 01 97 47 10 f4 vmovsd xmm30\{k7\},xmm29,xmm28
++[ ]*[a-f0-9]+: 62 01 97 c7 10 f4 vmovsd xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 61 7e 4f 10 31 vmovss xmm30\{k7\},DWORD PTR \[rcx\]
+ [ ]*[a-f0-9]+: 62 61 7e cf 10 31 vmovss xmm30\{k7\}\{z\},DWORD PTR \[rcx\]
+ [ ]*[a-f0-9]+: 62 21 7e 4f 10 b4 f0 34 12 00 00 vmovss xmm30\{k7\},DWORD PTR \[rax\+r14\*8\+0x1234\]
+@@ -3097,8 +3097,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 b2 00 02 00 00 vmovss DWORD PTR \[rdx\+0x200\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 72 80 vmovss DWORD PTR \[rdx-0x200\]\{k7\},xmm30
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 b2 fc fd ff ff vmovss DWORD PTR \[rdx-0x204\]\{k7\},xmm30
+-[ ]*[a-f0-9]+: 62 01 16 47 10 f4 vmovss xmm30\{k7\},xmm29,zmm28
+-[ ]*[a-f0-9]+: 62 01 16 c7 10 f4 vmovss xmm30\{k7\}\{z\},xmm29,zmm28
++[ ]*[a-f0-9]+: 62 01 16 47 10 f4 vmovss xmm30\{k7\},xmm29,xmm28
++[ ]*[a-f0-9]+: 62 01 16 c7 10 f4 vmovss xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 47 59 f4 vmulsd xmm30\{k7\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 c7 59 f4 vmulsd xmm30\{k7\}\{z\},xmm29,xmm28
+ [ ]*[a-f0-9]+: 62 01 97 17 59 f4 vmulsd xmm30\{k7\},xmm29,xmm28,\{rn-sae\}
+diff --git a/gas/testsuite/gas/i386/x86-64-evex-lig512.d b/gas/testsuite/gas/i386/x86-64-evex-lig512.d
+index f51b1d7..22de4cb 100644
+--- a/gas/testsuite/gas/i386/x86-64-evex-lig512.d
++++ b/gas/testsuite/gas/i386/x86-64-evex-lig512.d
+@@ -1339,8 +1339,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 b2 00 04 00 00 vmovsd %xmm30,0x400\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 72 80 vmovsd %xmm30,-0x400\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 b2 f8 fb ff ff vmovsd %xmm30,-0x408\(%rdx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 97 47 10 f4 vmovsd %zmm28,%xmm29,%xmm30\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 97 c7 10 f4 vmovsd %zmm28,%xmm29,%xmm30\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 01 97 47 10 f4 vmovsd %xmm28,%xmm29,%xmm30\{%k7\}
++[ ]*[a-f0-9]+: 62 01 97 c7 10 f4 vmovsd %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 61 7e 4f 10 31 vmovss \(%rcx\),%xmm30\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e cf 10 31 vmovss \(%rcx\),%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 21 7e 4f 10 b4 f0 23 01 00 00 vmovss 0x123\(%rax,%r14,8\),%xmm30\{%k7\}
+@@ -1354,8 +1354,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 b2 00 02 00 00 vmovss %xmm30,0x200\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 72 80 vmovss %xmm30,-0x200\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 b2 fc fd ff ff vmovss %xmm30,-0x204\(%rdx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 16 47 10 f4 vmovss %zmm28,%xmm29,%xmm30\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 16 c7 10 f4 vmovss %zmm28,%xmm29,%xmm30\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 01 16 47 10 f4 vmovss %xmm28,%xmm29,%xmm30\{%k7\}
++[ ]*[a-f0-9]+: 62 01 16 c7 10 f4 vmovss %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 01 97 47 59 f4 vmulsd %xmm28,%xmm29,%xmm30\{%k7\}
+ [ ]*[a-f0-9]+: 62 01 97 c7 59 f4 vmulsd %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 01 97 17 59 f4 vmulsd \{rn-sae\},%xmm28,%xmm29,%xmm30\{%k7\}
+@@ -3082,8 +3082,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 b2 00 04 00 00 vmovsd %xmm30,0x400\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 72 80 vmovsd %xmm30,-0x400\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 ff 4f 11 b2 f8 fb ff ff vmovsd %xmm30,-0x408\(%rdx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 97 47 10 f4 vmovsd %zmm28,%xmm29,%xmm30\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 97 c7 10 f4 vmovsd %zmm28,%xmm29,%xmm30\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 01 97 47 10 f4 vmovsd %xmm28,%xmm29,%xmm30\{%k7\}
++[ ]*[a-f0-9]+: 62 01 97 c7 10 f4 vmovsd %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 61 7e 4f 10 31 vmovss \(%rcx\),%xmm30\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e cf 10 31 vmovss \(%rcx\),%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 21 7e 4f 10 b4 f0 34 12 00 00 vmovss 0x1234\(%rax,%r14,8\),%xmm30\{%k7\}
+@@ -3097,8 +3097,8 @@ Disassembly of section .text:
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 b2 00 02 00 00 vmovss %xmm30,0x200\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 72 80 vmovss %xmm30,-0x200\(%rdx\)\{%k7\}
+ [ ]*[a-f0-9]+: 62 61 7e 4f 11 b2 fc fd ff ff vmovss %xmm30,-0x204\(%rdx\)\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 16 47 10 f4 vmovss %zmm28,%xmm29,%xmm30\{%k7\}
+-[ ]*[a-f0-9]+: 62 01 16 c7 10 f4 vmovss %zmm28,%xmm29,%xmm30\{%k7\}\{z\}
++[ ]*[a-f0-9]+: 62 01 16 47 10 f4 vmovss %xmm28,%xmm29,%xmm30\{%k7\}
++[ ]*[a-f0-9]+: 62 01 16 c7 10 f4 vmovss %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 01 97 47 59 f4 vmulsd %xmm28,%xmm29,%xmm30\{%k7\}
+ [ ]*[a-f0-9]+: 62 01 97 c7 59 f4 vmulsd %xmm28,%xmm29,%xmm30\{%k7\}\{z\}
+ [ ]*[a-f0-9]+: 62 01 97 17 59 f4 vmulsd \{rn-sae\},%xmm28,%xmm29,%xmm30\{%k7\}
diff --git a/gas/testsuite/gas/i386/x86-64-inval-avx512f.l b/gas/testsuite/gas/i386/x86-64-inval-avx512f.l
index 436acb0..21c4906 100644
--- a/gas/testsuite/gas/i386/x86-64-inval-avx512f.l
@@ -9994,10 +11366,25 @@ index a0c4fce..355285b 100644
unsigned int plt_count)
{
diff --git a/ld/ChangeLog b/ld/ChangeLog
-index 1687785..0a8eb72 100644
+index 1687785..56c0be1 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
-@@ -1,3 +1,72 @@
+@@ -1,3 +1,87 @@
++2014-10-24 Tejas Belagod <tejas.belagod at arm.com>
++
++ * emultempl/aarch64elf.em: Add command-line option for erratum
++ 835769.
++
++2014-06-18 Alan Modra <amodra at gmail.com>
++
++ PR 17047
++ * ldlang.c (lang_finish): Don't free linker hash table.
++
++2014-06-17 Alan Modra <amodra at gmail.com>
++
++ * scripttempl/elf.sc: Edit out __rela_iplt symbol assignments from
++ .rel sections, and __rel_iplt from .rela sections.
++
+2014-06-12 Alan Modra <amodra at gmail.com>
+
+ Backport mainline patches
@@ -10188,6 +11575,62 @@ index aa409a9..edb6ec6 100644
'
ARCH=nios2
MACHINE=
+diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
+index b3279bf..87aba34 100644
+--- a/ld/emultempl/aarch64elf.em
++++ b/ld/emultempl/aarch64elf.em
+@@ -30,6 +30,7 @@ fragment <<EOF
+ static int no_enum_size_warning = 0;
+ static int no_wchar_size_warning = 0;
+ static int pic_veneer = 0;
++static int fix_erratum_835769 = 0;
+
+ static void
+ gld${EMULATION_NAME}_before_parse (void)
+@@ -297,7 +298,7 @@ aarch64_elf_create_output_section_statements (void)
+ bfd_elf${ELFSIZE}_aarch64_set_options (link_info.output_bfd, &link_info,
+ no_enum_size_warning,
+ no_wchar_size_warning,
+- pic_veneer);
++ pic_veneer, fix_erratum_835769);
+
+ stub_file = lang_add_input_file ("linker stubs",
+ lang_input_file_is_fake_enum,
+@@ -346,6 +347,7 @@ PARSE_AND_LIST_PROLOGUE='
+ #define OPTION_PIC_VENEER 310
+ #define OPTION_STUBGROUP_SIZE 311
+ #define OPTION_NO_WCHAR_SIZE_WARNING 312
++#define OPTION_FIX_ERRATUM_835769 313
+ '
+
+ PARSE_AND_LIST_SHORTOPTS=p
+@@ -356,6 +358,7 @@ PARSE_AND_LIST_LONGOPTS='
+ { "pic-veneer", no_argument, NULL, OPTION_PIC_VENEER},
+ { "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
+ { "no-wchar-size-warning", no_argument, NULL, OPTION_NO_WCHAR_SIZE_WARNING},
++ { "fix-cortex-a53-835769", no_argument, NULL, OPTION_FIX_ERRATUM_835769},
+ '
+
+ PARSE_AND_LIST_OPTIONS='
+@@ -373,6 +376,7 @@ PARSE_AND_LIST_OPTIONS='
+ after each stub section. Values of +/-1 indicate\n\
+ the linker should choose suitable defaults.\n"
+ ));
++ fprintf (file, _(" --fix-cortex-a53-835769 Fix erratum 835769\n"));
+ '
+
+ PARSE_AND_LIST_ARGS_CASES='
+@@ -392,6 +396,10 @@ PARSE_AND_LIST_ARGS_CASES='
+ pic_veneer = 1;
+ break;
+
++ case OPTION_FIX_ERRATUM_835769:
++ fix_erratum_835769 = 1;
++ break;
++
+ case OPTION_STUBGROUP_SIZE:
+ {
+ const char *end;
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index 6843770..67a37e6 100644
--- a/ld/emultempl/ppc32elf.em
@@ -10730,6 +12173,24 @@ index f2085d7..12bfe41 100644
return FALSE;
'
+diff --git a/ld/ld.texinfo b/ld/ld.texinfo
+index c925ecb..988e2d7 100644
+--- a/ld/ld.texinfo
++++ b/ld/ld.texinfo
+@@ -6248,6 +6248,13 @@ The @samp{--fix-cortex-a8} switch enables a link-time workaround for an erratum
+
+ The erratum only affects Thumb-2 code. Please contact ARM for further details.
+
++ at cindex Cortex-A53 erratum 835769 workaround
++ at kindex --fix-cortex-a53-835769
++ at kindex --no-fix-cortex-a53-835769
++The @samp{--fix-cortex-a53-835769} switch enables a link-time workaround for erratum 835769 present on certain early revisions of Cortex-A53 processors. The workaround is disabled by default. It can be enabled by specifying @samp{--fix-cortex-a53-835769}, or disabled unconditionally by specifying @samp{--no-fix-cortex-a53-835769}.
++
++Please contact ARM for further details.
++
+ @kindex --merge-exidx-entries
+ @kindex --no-merge-exidx-entries
+ The @samp{--no-merge-exidx-entries} switch disables the merging of adjacent exidx entries in debuginfo.
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 49e7c65..6556b08 100644
--- a/ld/ldexp.c
@@ -10746,11 +12207,77 @@ index 49e7c65..6556b08 100644
{
/* Do nothing. The symbol was never referenced, or was
defined by some object. */
+diff --git a/ld/ldlang.c b/ld/ldlang.c
+index ba7f493..9121aa2 100644
+--- a/ld/ldlang.c
++++ b/ld/ldlang.c
+@@ -1238,7 +1238,14 @@ lang_init (void)
+ void
+ lang_finish (void)
+ {
++ /* Some targets require access to the linker hash table during the
++ _bfd_write_contents call in bfd_close, so it can't be freed
++ before bfd_close. It can't be freed after bfd_close either,
++ since bfd_alloc memory holding side data structures disappears
++ (PR17047). So don't free it.
++
+ bfd_link_hash_table_free (link_info.output_bfd, link_info.hash);
++ */
+ bfd_hash_table_free (&lang_definedness_table);
+ output_section_statement_table_free ();
+ }
+diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
+index e8126cb..6d0d13d 100644
+--- a/ld/scripttempl/elf.sc
++++ b/ld/scripttempl/elf.sc
+@@ -410,13 +410,13 @@ cat >> ldscripts/dyntmp.$$ <<EOF
+ .rel.dyn ${RELOCATING-0} :
+ {
+ EOF
+-sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
++sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;/__rela_iplt_/d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
+ cat >> ldscripts/dyntmp.$$ <<EOF
+ }
+ .rela.dyn ${RELOCATING-0} :
+ {
+ EOF
+-sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
++sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;/__rel_iplt_/d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
+ cat >> ldscripts/dyntmp.$$ <<EOF
+ }
+ EOF
+@@ -446,10 +446,10 @@ emit_dyn()
+ cat ldscripts/dyntmp.$$
+ else
+ if test -z "${NO_REL_RELOCS}"; then
+- sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$
++ sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d;/^[ ]*\.rela\./d;/__rela_iplt_/d' ldscripts/dyntmp.$$
+ fi
+ if test -z "${NO_RELA_RELOCS}"; then
+- sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$
++ sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d;/^[ ]*\.rel\./d;/__rel_iplt_/d' ldscripts/dyntmp.$$
+ fi
+ fi
+ rm -f ldscripts/dyntmp.$$
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
-index 342d5b2..b1cebe4 100644
+index 342d5b2..8ec7d5b 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
-@@ -1,3 +1,60 @@
+@@ -1,3 +1,74 @@
++2014-10-24 Tejas Belagod <tejas.belagod at arm.com>
++
++ * ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum
++ 835769 tests.
++ * ld-aarch64/erratum835769.d: New.
++ * ld-aarch64/erratum835769.s: New.
++
++2014-08-20 Roland McGrath <mcgrathr at google.com>
++
++ PR ld/17277
++ * ld-arm/pcrel-shared.s: New file.
++ * ld-arm/pcrel-shared.rd: New file.
++ * ld-arm/arm-elf.exp (armelftests_common): Add it.
++
+2014-06-12 Alan Modra <amodra at gmail.com>
+
+ Apply mainline patches
@@ -10812,15 +12339,165 @@ index 342d5b2..b1cebe4 100644
* ld-elf/ehdr_start-userdef.t: New file.
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
-index 5c150dd..692bf34 100644
+index 5c150dd..fcc9af4 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
-@@ -155,3 +155,5 @@ run_dump_test "ifunc-18b"
+@@ -35,6 +35,14 @@ if { ![is_elf_format] || ![istarget "aarch64*-*-*"] } {
+ set aarch64elftests {
+ {"EH Frame merge" "-Ttext 0x8000" "" "" {eh-frame-bar.s eh-frame-foo.s}
+ {{objdump --dwarf=frames eh-frame.d}} "eh-frame"}
++ {"Erratum 835769 dump test"
++ "--fix-cortex-a53-835769" "" "" {erratum835769.s}
++ {{objdump -dr erratum835769.d}}
++ "erratum835769"}
++ {"Erratum 835769 dump test -shared"
++ "--fix-cortex-a53-835769 -shared" "" "" {erratum835769.s}
++ {{objdump -dr erratum835769.d}}
++ "erratum835769"}
+ }
+
+ run_ld_link_tests $aarch64elftests
+@@ -155,3 +163,5 @@ run_dump_test "ifunc-18b"
run_dump_test "ifunc-19a"
run_dump_test "ifunc-19b"
run_dump_test "ifunc-20"
+run_dump_test "ifunc-21"
+run_dump_test "ifunc-22"
+diff --git a/ld/testsuite/ld-aarch64/erratum835769.d b/ld/testsuite/ld-aarch64/erratum835769.d
+new file mode 100644
+index 0000000..a040236
+--- /dev/null
++++ b/ld/testsuite/ld-aarch64/erratum835769.d
+@@ -0,0 +1,48 @@
++#...
++Disassembly of section .text:
++#...
++[0-9a-f]+ <a1ldr>:
++[ \t0-9a-f]+:[ \t]+b8408c87[ \t]+ldr[ \t]+w7, \[x4,#8\]\!
++[ \t0-9a-f]+:[ \t]+1b017c06[ \t]+mul[ \t]+w6, w0, w1
++[ \t0-9a-f]+:[ \t]+f9400084[ \t]+ldr[ \t]+x4, \[x4\]
++[ \t0-9a-f]+:[ \t0-9a-z]+[ \t]+b[ \t]+[0-9a-f]+ <__erratum_835769_veneer_0>
++[ \t0-9a-f]+:[ \t]+aa0503e0[ \t]+mov[ \t]+x0, x5
++[ \t0-9a-f]+:[ \t]+d65f03c0[ \t]+ret
++
++[0-9a-f]+ <a5ldr>:
++[ \t0-9a-f]+:[ \t]+b8408c87[ \t]+ldr[ \t]+w7, \[x4,#8\]!
++[ \t0-9a-f]+:[ \t]+1b017c06[ \t]+mul[ \t]+w6, w0, w1
++[ \t0-9a-f]+:[ \t]+f9400084[ \t]+ldr[ \t]+x4, \[x4\]
++[ \t0-9a-f]+:[ \t0-9a-z]+[ \t]+b[ \t]+[0-9a-f]+ <__erratum_835769_veneer_1>
++[ \t0-9a-f]+:[ \t]+aa0503e0[ \t]+mov[ \t]+x0, x5
++[ \t0-9a-f]+:[ \t]+d65f03c0[ \t]+ret
++
++[0-9a-f]+ <a6ldr>:
++[ \t0-9a-f]+:[ \t]+b8408c87[ \t]+ldr[ \t]+w7, \[x4,#8\]!
++[ \t0-9a-f]+:[ \t]+1b017c06[ \t]+mul[ \t]+w6, w0, w1
++[ \t0-9a-f]+:[ \t]+f9400084[ \t]+ldr[ \t]+x4, \[x4\]
++[ \t0-9a-f]+:[ \t]+9b031885[ \t]+madd[ \t]+x5, x4, x3, x6
++[ \t0-9a-f]+:[ \t]+aa0503e0[ \t]+mov[ \t]+x0, x5
++[ \t0-9a-f]+:[ \t]+d65f03c0[ \t]+ret
++
++[0-9a-f]+ <a7str>:
++[ \t0-9a-f]+:[ \t]+b8408c87[ \t]+ldr[ \t]+w7, \[x4,#8\]!
++[ \t0-9a-f]+:[ \t]+1b017c06[ \t]+mul[ \t]+w6, w0, w1
++[ \t0-9a-f]+:[ \t]+f9000084[ \t]+str[ \t]+x4, \[x4\]
++[ \t0-9a-f]+:[ \t0-9a-z]+[ \t]+b[ \t]+[0-9a-f]+ <__erratum_835769_veneer_2>
++[ \t0-9a-f]+:[ \t]+aa0503e0[ \t]+mov[ \t]+x0, x5
++[ \t0-9a-f]+:[ \t]+d65f03c0[ \t]+ret
++[ \t0-9a-f]+:[ \t]+00000000[ \t]+.inst[ \t]+0x00000000 ; undefined
++
++[0-9a-f]+ <__erratum_835769_veneer_2>:
++[ \t0-9a-f]+:[ \t]+9b031885[ \t]+madd[ \t]+x5, x4, x3, x6
++[ \t0-9a-f]+:[ \t0-9a-z]+[ \t]+b[ \t]+[0-9a-f]+ <a7str\+0x[0-9a-f]+>
++
++[0-9a-f]+ <__erratum_835769_veneer_1>:
++[ \t0-9a-f]+:[ \t]+9ba31845[ \t]+umaddl[ \t]+x5, w2, w3, x6
++[ \t0-9a-f]+:[ \t0-9a-z]+[ \t]+b[ \t]+[0-9a-f]+ <a5ldr\+0x[0-9a-f]+>
++
++[0-9a-f]+ <__erratum_835769_veneer_0>:
++[ \t0-9a-f]+:[ \t]+9b031845[ \t]+madd[ \t]+x5, x2, x3, x6
++[ \t0-9a-f]+:[ \t0-9a-z]+[ \t]+b[ \t]+[0-9a-f]+ <a1ldr\+0x[0-9a-f]+>
++#pass
+diff --git a/ld/testsuite/ld-aarch64/erratum835769.s b/ld/testsuite/ld-aarch64/erratum835769.s
+new file mode 100644
+index 0000000..d57b5ab
+--- /dev/null
++++ b/ld/testsuite/ld-aarch64/erratum835769.s
+@@ -0,0 +1,75 @@
++ .text
++ .align 2
++ .global main
++ .type main, %function
++main:
++ stp x29, x30, [sp, -32]!
++ add x29, sp, 0
++ mov x0, -26
++ str x0, [x29,16]
++ mov x0, 26
++ str x0, [x29,24]
++ add x4, x29, 16
++ mov x0, -1
++ mov x1, 2
++ mov x2, -3
++ mov x3, 4
++ bl a1ldr
++ add x4, x29, 16
++ mov x0, -1
++ mov x1, 2
++ mov x2, -3
++ mov x3, 4
++ bl a5ldr
++ mov w0, 0
++ ldp x29, x30, [sp], 32
++ ret
++ .size main, .-main
++
++ .align 2
++ .global a1ldr
++ .type a1ldr, %function
++a1ldr:
++ ldr w7, [x4,8]!
++ mul w6, w0, w1
++ ldr x4, [x4]
++ madd x5, x2, x3, x6
++ mov x0, x5
++ ret
++ .size a1ldr, .-a1ldr
++
++ .align 2
++ .global a5ldr
++ .type a5ldr, %function
++a5ldr:
++ ldr w7, [x4,8]!
++ mul w6, w0, w1
++ ldr x4, [x4]
++ umaddl x5, w2, w3, x6
++ mov x0, x5
++ ret
++ .size a5ldr, .-a5ldr
++
++ .align 2
++ .global a6ldr
++ .type a6ldr, %function
++a6ldr:
++ ldr w7, [x4,8]!
++ mul w6, w0, w1
++ ldr x4, [x4]
++ madd x5, x4, x3, x6
++ mov x0, x5
++ ret
++ .size a6ldr, .-a6ldr
++
++ .align 2
++ .global a6ldr
++ .type a6ldr, %function
++a7str:
++ ldr w7, [x4,8]!
++ mul w6, w0, w1
++ str x4, [x4]
++ madd x5, x4, x3, x6
++ mov x0, x5
++ ret
++ .size a7str, .-a7str
diff --git a/ld/testsuite/ld-aarch64/ifunc-21.d b/ld/testsuite/ld-aarch64/ifunc-21.d
new file mode 100644
index 0000000..9ea01e6
@@ -10923,6 +12600,21 @@ index c20690c..38b3721 100644
add x0, x0, :tlsdesc_lo12:var
.tlsdesccall var
blr x1
+diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
+index 4c0f802..28cbc22 100644
+--- a/ld/testsuite/ld-arm/arm-elf.exp
++++ b/ld/testsuite/ld-arm/arm-elf.exp
+@@ -209,6 +209,10 @@ set armelftests_common {
+ {"EABI ABI flags ld -r" "-r" "" "-mfloat-abi=soft -meabi=5" {eabi-soft-float.s}
+ {{readelf -h eabi-soft-float-r.d}}
+ "eabi-soft-float-r.o"}
++ {"PC-relative in -shared" "-shared" ""
++ "" {pcrel-shared.s}
++ {{readelf -dr pcrel-shared.rd}}
++ "pcrel-shared.so"}
+ }
+
+ set armelftests_nonacl {
diff --git a/ld/testsuite/ld-arm/gc-hidden-1.d b/ld/testsuite/ld-arm/gc-hidden-1.d
index fe77abc..f0f1fd4 100644
--- a/ld/testsuite/ld-arm/gc-hidden-1.d
@@ -10962,6 +12654,59 @@ index fe77abc..f0f1fd4 100644
- 130: e8bd8000 ldmfd sp!, {pc}
+0+[0-9a-f]+ <hidfn>:
+\s*[0-9a-f]+:\s+e8bd8000\s+ldmfd sp!, {pc}
+diff --git a/ld/testsuite/ld-arm/pcrel-shared.rd b/ld/testsuite/ld-arm/pcrel-shared.rd
+new file mode 100644
+index 0000000..f371664
+--- /dev/null
++++ b/ld/testsuite/ld-arm/pcrel-shared.rd
+@@ -0,0 +1,16 @@
++Dynamic section at offset 0x[0-9a-f]+ contains \d+ entries:
++\s+Tag\s+Type\s+Name/Value
++\s*0x[0-9a-f]+ \(HASH\).*
++\s*0x[0-9a-f]+ \(STRTAB\).*
++\s*0x[0-9a-f]+ \(SYMTAB\).*
++\s*0x[0-9a-f]+ \(STRSZ\).*
++\s*0x[0-9a-f]+ \(SYMENT\).*
++# Specifically want *not* to see here:
++# (REL)
++# (RELSZ)
++# (RELENT)
++# (TEXTREL)
++#...
++\s*0x[0-9a-f]+ \(NULL\).*
++
++There are no relocations in this file\.
+diff --git a/ld/testsuite/ld-arm/pcrel-shared.s b/ld/testsuite/ld-arm/pcrel-shared.s
+new file mode 100644
+index 0000000..a2ad0b2
+--- /dev/null
++++ b/ld/testsuite/ld-arm/pcrel-shared.s
+@@ -0,0 +1,25 @@
++# This tests PR ld/17277, wherein ld -shared for cross-section PC-relative
++# relocs (other than plain R_ARM_REL32, as in data) produce bogus dynamic
++# relocs and TEXTREL markers.
++
++ .syntax unified
++ .arm
++ .arch armv7-a
++
++ .text
++ .globl foo
++ .type foo,%function
++foo: movw r0, #:lower16:symbol - 1f - 8
++ movt r0, #:upper16:symbol - 1f - 8
++1: add r0, pc
++ @ And now a case with a local symbol.
++ movw r0, #:lower16:3f - 2f - 8
++ movt r0, #:upper16:3f - 2f - 8
++2: add r0, pc
++ bx lr
++
++.data
++ .globl symbol
++ .hidden symbol
++symbol: .long 23
++3: .long 17
diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp
index 1893873..bf38000 100644
--- a/ld/testsuite/ld-bootstrap/bootstrap.exp
@@ -11266,10 +13011,15 @@ index fcea46f..f17e6b6 100644
# We are being configured as a target library. AC_REPLACE_FUNCS
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
-index 0b72d5b..e5f06da 100644
+index 0b72d5b..0e229d9 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
-@@ -1,3 +1,118 @@
+@@ -1,3 +1,123 @@
++2014-07-08 Ilya Tocar <ilya.tocar at intel.com>
++
++ * i386-dis-evex.h (EVEX_W_0F10_P_1_M_1): Fix vmovss.
++ (EVEX_W_0F10_P_3_M_1): Fix vmovsd.
++
+2014-06-12 Alan Modra <amodra at gmail.com>
+
+ * msp430-decode.c: Regenerate.
@@ -11498,9 +13248,27 @@ index c53794a..70a1727 100644
{"fcvtzu", 0x7ea1b800, 0xffbffc00, asisdmisc, 0, SIMD, OP2 (Sd, Sn), QL_S_2SAMESD, F_SSIZE},
{"frsqrte", 0x7ea1d800, 0xffbffc00, asisdmisc, 0, SIMD, OP2 (Sd, Sn), QL_S_2SAMESD, F_SSIZE},
diff --git a/opcodes/i386-dis-evex.h b/opcodes/i386-dis-evex.h
-index c42e7cb..0d17846 100644
+index c42e7cb..524e7c5 100644
--- a/opcodes/i386-dis-evex.h
+++ b/opcodes/i386-dis-evex.h
+@@ -2213,7 +2213,7 @@ static const struct dis386 evex_table[][256] = {
+ },
+ /* EVEX_W_0F10_P_1_M_1 */
+ {
+- { "vmovss", { XMScalar, VexScalar, EXx } },
++ { "vmovss", { XMScalar, VexScalar, EXxmm_md } },
+ },
+ /* EVEX_W_0F10_P_2 */
+ {
+@@ -2228,7 +2228,7 @@ static const struct dis386 evex_table[][256] = {
+ /* EVEX_W_0F10_P_3_M_1 */
+ {
+ { Bad_Opcode },
+- { "vmovsd", { XMScalar, VexScalar, EXx } },
++ { "vmovsd", { XMScalar, VexScalar, EXxmm_mq } },
+ },
+ /* EVEX_W_0F11_P_0 */
+ {
@@ -2906,42 +2906,42 @@ static const struct dis386 evex_table[][256] = {
},
/* EVEX_W_0F3891_P_2 */
diff --git a/binutils-2.24-corrupt-binaries.patch b/binutils-2.24-corrupt-binaries.patch
new file mode 100644
index 0000000..b3985a9
--- /dev/null
+++ b/binutils-2.24-corrupt-binaries.patch
@@ -0,0 +1,1041 @@
+diff -cpr ../binutils-2.24.orig/bfd/elf.c bfd/elf.c
+*** ../binutils-2.24.orig/bfd/elf.c 2014-10-31 11:50:20.132220820 +0000
+--- bfd/elf.c 2014-10-31 11:53:23.669281197 +0000
+*************** setup_group (bfd *abfd, Elf_Internal_Shd
+*** 608,616 ****
+ if (shdr->contents == NULL)
+ {
+ _bfd_error_handler
+! (_("%B: Corrupt size field in group section header: 0x%lx"), abfd, shdr->sh_size);
+ bfd_set_error (bfd_error_bad_value);
+! return FALSE;
+ }
+
+ memset (shdr->contents, 0, amt);
+--- 608,617 ----
+ if (shdr->contents == NULL)
+ {
+ _bfd_error_handler
+! (_("%B: corrupt size field in group section header: 0x%lx"), abfd, shdr->sh_size);
+ bfd_set_error (bfd_error_bad_value);
+! -- num_group;
+! continue;
+ }
+
+ memset (shdr->contents, 0, amt);
+*************** setup_group (bfd *abfd, Elf_Internal_Shd
+*** 618,625 ****
+ if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0
+ || (bfd_bread (shdr->contents, shdr->sh_size, abfd)
+ != shdr->sh_size))
+! return FALSE;
+!
+ /* Translate raw contents, a flag word followed by an
+ array of elf section indices all in target byte order,
+ to the flag word followed by an array of elf section
+--- 619,635 ----
+ if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0
+ || (bfd_bread (shdr->contents, shdr->sh_size, abfd)
+ != shdr->sh_size))
+! {
+! _bfd_error_handler
+! (_("%B: invalid size field in group section header: 0x%lx"), abfd, shdr->sh_size);
+! bfd_set_error (bfd_error_bad_value);
+! -- num_group;
+! /* PR 17510: If the group contents are even partially
+! corrupt, do not allow any of the contents to be used. */
+! memset (shdr->contents, 0, amt);
+! continue;
+! }
+!
+ /* Translate raw contents, a flag word followed by an
+ array of elf section indices all in target byte order,
+ to the flag word followed by an array of elf section
+*************** setup_group (bfd *abfd, Elf_Internal_Shd
+*** 651,656 ****
+--- 661,681 ----
+ }
+ }
+ }
++
++ /* PR 17510: Corrupt binaries might contain invalid groups. */
++ if (num_group != (unsigned) elf_tdata (abfd)->num_group)
++ {
++ elf_tdata (abfd)->num_group = num_group;
++
++ /* If all groups are invalid then fail. */
++ if (num_group == 0)
++ {
++ elf_tdata (abfd)->group_sect_ptr = NULL;
++ elf_tdata (abfd)->num_group = num_group = -1;
++ (*_bfd_error_handler) (_("%B: no valid group sections found"), abfd);
++ bfd_set_error (bfd_error_bad_value);
++ }
++ }
+ }
+ }
+
+*************** setup_group (bfd *abfd, Elf_Internal_Shd
+*** 716,721 ****
+--- 741,747 ----
+ {
+ (*_bfd_error_handler) (_("%B: no group info for section %A"),
+ abfd, newsect);
++ return FALSE;
+ }
+ return TRUE;
+ }
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1556,1593 ****
+ Elf_Internal_Ehdr *ehdr;
+ const struct elf_backend_data *bed;
+ const char *name;
+
+ if (shindex >= elf_numsections (abfd))
+ return FALSE;
+
+ hdr = elf_elfsections (abfd)[shindex];
+ ehdr = elf_elfheader (abfd);
+ name = bfd_elf_string_from_elf_section (abfd, ehdr->e_shstrndx,
+ hdr->sh_name);
+ if (name == NULL)
+! return FALSE;
+
+ bed = get_elf_backend_data (abfd);
+ switch (hdr->sh_type)
+ {
+ case SHT_NULL:
+ /* Inactive section. Throw it away. */
+! return TRUE;
+
+! case SHT_PROGBITS: /* Normal section with contents. */
+! case SHT_NOBITS: /* .bss section. */
+! case SHT_HASH: /* .hash section. */
+! case SHT_NOTE: /* .note section. */
+ case SHT_INIT_ARRAY: /* .init_array section. */
+ case SHT_FINI_ARRAY: /* .fini_array section. */
+ case SHT_PREINIT_ARRAY: /* .preinit_array section. */
+ case SHT_GNU_LIBLIST: /* .gnu.liblist section. */
+ case SHT_GNU_HASH: /* .gnu.hash section. */
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+
+ case SHT_DYNAMIC: /* Dynamic linking information. */
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+! return FALSE;
+ if (hdr->sh_link > elf_numsections (abfd))
+ {
+ /* PR 10478: Accept Solaris binaries with a sh_link
+--- 1582,1655 ----
+ Elf_Internal_Ehdr *ehdr;
+ const struct elf_backend_data *bed;
+ const char *name;
++ bfd_boolean ret = TRUE;
++ static bfd_boolean * sections_being_created = NULL;
++ static bfd * sections_being_created_abfd = NULL;
++ static unsigned int nesting = 0;
+
+ if (shindex >= elf_numsections (abfd))
+ return FALSE;
+
++ if (++ nesting > 3)
++ {
++ /* PR17512: A corrupt ELF binary might contain a recursive group of
++ sections, each the string indicies pointing to the next in the
++ loop. Detect this here, by refusing to load a section that we are
++ already in the process of loading. We only trigger this test if
++ we have nested at least three sections deep as normal ELF binaries
++ can expect to recurse at least once.
++
++ FIXME: It would be better if this array was attached to the bfd,
++ rather than being held in a static pointer. */
++
++ if (sections_being_created_abfd != abfd)
++ sections_being_created = NULL;
++ if (sections_being_created == NULL)
++ {
++ /* FIXME: It would be more efficient to attach this array to the bfd somehow. */
++ sections_being_created = (bfd_boolean *)
++ bfd_zalloc (abfd, elf_numsections (abfd) * sizeof (bfd_boolean));
++ sections_being_created_abfd = abfd;
++ }
++ if (sections_being_created [shindex])
++ {
++ (*_bfd_error_handler)
++ (_("%B: warning: loop in section dependencies detected"), abfd);
++ return FALSE;
++ }
++ sections_being_created [shindex] = TRUE;
++ }
++
+ hdr = elf_elfsections (abfd)[shindex];
+ ehdr = elf_elfheader (abfd);
+ name = bfd_elf_string_from_elf_section (abfd, ehdr->e_shstrndx,
+ hdr->sh_name);
+ if (name == NULL)
+! goto fail;
+
+ bed = get_elf_backend_data (abfd);
+ switch (hdr->sh_type)
+ {
+ case SHT_NULL:
+ /* Inactive section. Throw it away. */
+! goto success;
+
+! case SHT_PROGBITS: /* Normal section with contents. */
+! case SHT_NOBITS: /* .bss section. */
+! case SHT_HASH: /* .hash section. */
+! case SHT_NOTE: /* .note section. */
+ case SHT_INIT_ARRAY: /* .init_array section. */
+ case SHT_FINI_ARRAY: /* .fini_array section. */
+ case SHT_PREINIT_ARRAY: /* .preinit_array section. */
+ case SHT_GNU_LIBLIST: /* .gnu.liblist section. */
+ case SHT_GNU_HASH: /* .gnu.hash section. */
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+! goto success;
+
+ case SHT_DYNAMIC: /* Dynamic linking information. */
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+! goto fail;
+!
+ if (hdr->sh_link > elf_numsections (abfd))
+ {
+ /* PR 10478: Accept Solaris binaries with a sh_link
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1601,1611 ****
+ break;
+ /* Otherwise fall through. */
+ default:
+! return FALSE;
+ }
+ }
+ else if (elf_elfsections (abfd)[hdr->sh_link] == NULL)
+! return FALSE;
+ else if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB)
+ {
+ Elf_Internal_Shdr *dynsymhdr;
+--- 1663,1673 ----
+ break;
+ /* Otherwise fall through. */
+ default:
+! goto fail;
+ }
+ }
+ else if (elf_elfsections (abfd)[hdr->sh_link] == NULL)
+! goto fail;
+ else if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB)
+ {
+ Elf_Internal_Shdr *dynsymhdr;
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1634,1657 ****
+ }
+ }
+ }
+! break;
+
+! case SHT_SYMTAB: /* A symbol table */
+ if (elf_onesymtab (abfd) == shindex)
+! return TRUE;
+
+ if (hdr->sh_entsize != bed->s->sizeof_sym)
+! return FALSE;
+ if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size)
+ {
+ if (hdr->sh_size != 0)
+! return FALSE;
+ /* Some assemblers erroneously set sh_info to one with a
+ zero sh_size. ld sees this as a global symbol count
+ of (unsigned) -1. Fix it here. */
+ hdr->sh_info = 0;
+! return TRUE;
+ }
+ BFD_ASSERT (elf_onesymtab (abfd) == 0);
+ elf_onesymtab (abfd) = shindex;
+ elf_tdata (abfd)->symtab_hdr = *hdr;
+--- 1696,1721 ----
+ }
+ }
+ }
+! goto success;
+
+! case SHT_SYMTAB: /* A symbol table. */
+ if (elf_onesymtab (abfd) == shindex)
+! goto success;
+
+ if (hdr->sh_entsize != bed->s->sizeof_sym)
+! goto fail;
+!
+ if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size)
+ {
+ if (hdr->sh_size != 0)
+! goto fail;
+ /* Some assemblers erroneously set sh_info to one with a
+ zero sh_size. ld sees this as a global symbol count
+ of (unsigned) -1. Fix it here. */
+ hdr->sh_info = 0;
+! goto success;
+ }
++
+ BFD_ASSERT (elf_onesymtab (abfd) == 0);
+ elf_onesymtab (abfd) = shindex;
+ elf_tdata (abfd)->symtab_hdr = *hdr;
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1668,1674 ****
+ && (abfd->flags & DYNAMIC) != 0
+ && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex))
+! return FALSE;
+
+ /* Go looking for SHT_SYMTAB_SHNDX too, since if there is one we
+ can't read symbols without that section loaded as well. It
+--- 1732,1738 ----
+ && (abfd->flags & DYNAMIC) != 0
+ && ! _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+ shindex))
+! goto fail;
+
+ /* Go looking for SHT_SYMTAB_SHNDX too, since if there is one we
+ can't read symbols without that section loaded as well. It
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1694,1719 ****
+ break;
+ }
+ if (i != shindex)
+! return bfd_section_from_shdr (abfd, i);
+ }
+! return TRUE;
+
+! case SHT_DYNSYM: /* A dynamic symbol table */
+ if (elf_dynsymtab (abfd) == shindex)
+! return TRUE;
+
+ if (hdr->sh_entsize != bed->s->sizeof_sym)
+! return FALSE;
+ if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size)
+ {
+ if (hdr->sh_size != 0)
+! return FALSE;
+ /* Some linkers erroneously set sh_info to one with a
+ zero sh_size. ld sees this as a global symbol count
+ of (unsigned) -1. Fix it here. */
+ hdr->sh_info = 0;
+! return TRUE;
+ }
+ BFD_ASSERT (elf_dynsymtab (abfd) == 0);
+ elf_dynsymtab (abfd) = shindex;
+ elf_tdata (abfd)->dynsymtab_hdr = *hdr;
+--- 1758,1786 ----
+ break;
+ }
+ if (i != shindex)
+! ret = bfd_section_from_shdr (abfd, i);
+ }
+! goto success;
+
+! case SHT_DYNSYM: /* A dynamic symbol table. */
+ if (elf_dynsymtab (abfd) == shindex)
+! goto success;
+
+ if (hdr->sh_entsize != bed->s->sizeof_sym)
+! goto fail;
+!
+ if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size)
+ {
+ if (hdr->sh_size != 0)
+! goto fail;
+!
+ /* Some linkers erroneously set sh_info to one with a
+ zero sh_size. ld sees this as a global symbol count
+ of (unsigned) -1. Fix it here. */
+ hdr->sh_info = 0;
+! goto success;
+ }
++
+ BFD_ASSERT (elf_dynsymtab (abfd) == 0);
+ elf_dynsymtab (abfd) = shindex;
+ elf_tdata (abfd)->dynsymtab_hdr = *hdr;
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1722,1755 ****
+
+ /* Besides being a symbol table, we also treat this as a regular
+ section, so that objcopy can handle it. */
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+
+! case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections */
+ if (elf_symtab_shndx (abfd) == shindex)
+! return TRUE;
+
+ BFD_ASSERT (elf_symtab_shndx (abfd) == 0);
+ elf_symtab_shndx (abfd) = shindex;
+ elf_tdata (abfd)->symtab_shndx_hdr = *hdr;
+ elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr;
+! return TRUE;
+
+! case SHT_STRTAB: /* A string table */
+ if (hdr->bfd_section != NULL)
+! return TRUE;
+ if (ehdr->e_shstrndx == shindex)
+ {
+ elf_tdata (abfd)->shstrtab_hdr = *hdr;
+ elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->shstrtab_hdr;
+! return TRUE;
+ }
+ if (elf_elfsections (abfd)[elf_onesymtab (abfd)]->sh_link == shindex)
+ {
+ symtab_strtab:
+ elf_tdata (abfd)->strtab_hdr = *hdr;
+ elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->strtab_hdr;
+! return TRUE;
+ }
+ if (elf_elfsections (abfd)[elf_dynsymtab (abfd)]->sh_link == shindex)
+ {
+ dynsymtab_strtab:
+--- 1789,1826 ----
+
+ /* Besides being a symbol table, we also treat this as a regular
+ section, so that objcopy can handle it. */
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+! goto success;
+
+! case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections. */
+ if (elf_symtab_shndx (abfd) == shindex)
+! goto success;
+
+ BFD_ASSERT (elf_symtab_shndx (abfd) == 0);
+ elf_symtab_shndx (abfd) = shindex;
+ elf_tdata (abfd)->symtab_shndx_hdr = *hdr;
+ elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr;
+! goto success;
+
+! case SHT_STRTAB: /* A string table. */
+ if (hdr->bfd_section != NULL)
+! goto success;
+!
+ if (ehdr->e_shstrndx == shindex)
+ {
+ elf_tdata (abfd)->shstrtab_hdr = *hdr;
+ elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->shstrtab_hdr;
+! goto success;
+ }
++
+ if (elf_elfsections (abfd)[elf_onesymtab (abfd)]->sh_link == shindex)
+ {
+ symtab_strtab:
+ elf_tdata (abfd)->strtab_hdr = *hdr;
+ elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->strtab_hdr;
+! goto success;
+ }
++
+ if (elf_elfsections (abfd)[elf_dynsymtab (abfd)]->sh_link == shindex)
+ {
+ dynsymtab_strtab:
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1758,1765 ****
+ elf_elfsections (abfd)[shindex] = hdr;
+ /* We also treat this as a regular section, so that objcopy
+ can handle it. */
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+! shindex);
+ }
+
+ /* If the string table isn't one of the above, then treat it as a
+--- 1829,1837 ----
+ elf_elfsections (abfd)[shindex] = hdr;
+ /* We also treat this as a regular section, so that objcopy
+ can handle it. */
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+! shindex);
+! goto success;
+ }
+
+ /* If the string table isn't one of the above, then treat it as a
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1777,1785 ****
+ {
+ /* Prevent endless recursion on broken objects. */
+ if (i == shindex)
+! return FALSE;
+ if (! bfd_section_from_shdr (abfd, i))
+! return FALSE;
+ if (elf_onesymtab (abfd) == i)
+ goto symtab_strtab;
+ if (elf_dynsymtab (abfd) == i)
+--- 1849,1857 ----
+ {
+ /* Prevent endless recursion on broken objects. */
+ if (i == shindex)
+! goto fail;
+ if (! bfd_section_from_shdr (abfd, i))
+! goto fail;
+ if (elf_onesymtab (abfd) == i)
+ goto symtab_strtab;
+ if (elf_dynsymtab (abfd) == i)
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1787,1793 ****
+ }
+ }
+ }
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+
+ case SHT_REL:
+ case SHT_RELA:
+--- 1859,1866 ----
+ }
+ }
+ }
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+! goto success;
+
+ case SHT_REL:
+ case SHT_RELA:
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1802,1808 ****
+ if (hdr->sh_entsize
+ != (bfd_size_type) (hdr->sh_type == SHT_REL
+ ? bed->s->sizeof_rel : bed->s->sizeof_rela))
+! return FALSE;
+
+ /* Check for a bogus link to avoid crashing. */
+ if (hdr->sh_link >= num_sec)
+--- 1875,1881 ----
+ if (hdr->sh_entsize
+ != (bfd_size_type) (hdr->sh_type == SHT_REL
+ ? bed->s->sizeof_rel : bed->s->sizeof_rela))
+! goto fail;
+
+ /* Check for a bogus link to avoid crashing. */
+ if (hdr->sh_link >= num_sec)
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1810,1817 ****
+ ((*_bfd_error_handler)
+ (_("%B: invalid link %lu for reloc section %s (index %u)"),
+ abfd, hdr->sh_link, name, shindex));
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+! shindex);
+ }
+
+ /* For some incomprehensible reason Oracle distributes
+--- 1883,1891 ----
+ ((*_bfd_error_handler)
+ (_("%B: invalid link %lu for reloc section %s (index %u)"),
+ abfd, hdr->sh_link, name, shindex));
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+! shindex);
+! goto success;
+ }
+
+ /* For some incomprehensible reason Oracle distributes
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1852,1858 ****
+ if ((elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB
+ || elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_DYNSYM)
+ && ! bfd_section_from_shdr (abfd, hdr->sh_link))
+! return FALSE;
+
+ /* If this reloc section does not use the main symbol table we
+ don't treat it as a reloc section. BFD can't adequately
+--- 1926,1932 ----
+ if ((elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB
+ || elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_DYNSYM)
+ && ! bfd_section_from_shdr (abfd, hdr->sh_link))
+! goto fail;
+
+ /* If this reloc section does not use the main symbol table we
+ don't treat it as a reloc section. BFD can't adequately
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1867,1880 ****
+ || hdr->sh_info >= num_sec
+ || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL
+ || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA)
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+! shindex);
+
+ if (! bfd_section_from_shdr (abfd, hdr->sh_info))
+! return FALSE;
+ target_sect = bfd_section_from_elf_index (abfd, hdr->sh_info);
+ if (target_sect == NULL)
+! return FALSE;
+
+ esdt = elf_section_data (target_sect);
+ if (hdr->sh_type == SHT_RELA)
+--- 1941,1958 ----
+ || hdr->sh_info >= num_sec
+ || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL
+ || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA)
+! {
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+! shindex);
+! goto success;
+! }
+
+ if (! bfd_section_from_shdr (abfd, hdr->sh_info))
+! goto fail;
+!
+ target_sect = bfd_section_from_elf_index (abfd, hdr->sh_info);
+ if (target_sect == NULL)
+! goto fail;
+
+ esdt = elf_section_data (target_sect);
+ if (hdr->sh_type == SHT_RELA)
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1886,1892 ****
+ amt = sizeof (*hdr2);
+ hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
+ if (hdr2 == NULL)
+! return FALSE;
+ *hdr2 = *hdr;
+ *p_hdr = hdr2;
+ elf_elfsections (abfd)[shindex] = hdr2;
+--- 1964,1970 ----
+ amt = sizeof (*hdr2);
+ hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
+ if (hdr2 == NULL)
+! goto fail;
+ *hdr2 = *hdr;
+ *p_hdr = hdr2;
+ elf_elfsections (abfd)[shindex] = hdr2;
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1902,1935 ****
+ target_sect->use_rela_p = 1;
+ }
+ abfd->flags |= HAS_RELOC;
+! return TRUE;
+ }
+
+ case SHT_GNU_verdef:
+ elf_dynverdef (abfd) = shindex;
+ elf_tdata (abfd)->dynverdef_hdr = *hdr;
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+
+ case SHT_GNU_versym:
+ if (hdr->sh_entsize != sizeof (Elf_External_Versym))
+! return FALSE;
+ elf_dynversym (abfd) = shindex;
+ elf_tdata (abfd)->dynversym_hdr = *hdr;
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+
+ case SHT_GNU_verneed:
+ elf_dynverref (abfd) = shindex;
+ elf_tdata (abfd)->dynverref_hdr = *hdr;
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+
+ case SHT_SHLIB:
+! return TRUE;
+
+ case SHT_GROUP:
+ if (! IS_VALID_GROUP_SECTION_HEADER (hdr, GRP_ENTRY_SIZE))
+! return FALSE;
+ if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+! return FALSE;
+ if (hdr->contents != NULL)
+ {
+ Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents;
+--- 1980,2019 ----
+ target_sect->use_rela_p = 1;
+ }
+ abfd->flags |= HAS_RELOC;
+! goto success;
+ }
+
+ case SHT_GNU_verdef:
+ elf_dynverdef (abfd) = shindex;
+ elf_tdata (abfd)->dynverdef_hdr = *hdr;
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+! goto success;
+
+ case SHT_GNU_versym:
+ if (hdr->sh_entsize != sizeof (Elf_External_Versym))
+! goto fail;
+!
+ elf_dynversym (abfd) = shindex;
+ elf_tdata (abfd)->dynversym_hdr = *hdr;
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+! goto success;
+
+ case SHT_GNU_verneed:
+ elf_dynverref (abfd) = shindex;
+ elf_tdata (abfd)->dynverref_hdr = *hdr;
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+! goto success;
+
+ case SHT_SHLIB:
+! goto success;
+
+ case SHT_GROUP:
+ if (! IS_VALID_GROUP_SECTION_HEADER (hdr, GRP_ENTRY_SIZE))
+! goto fail;
+!
+ if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+! goto fail;
+!
+ if (hdr->contents != NULL)
+ {
+ Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents;
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1955,1961 ****
+ }
+ }
+ }
+! break;
+
+ default:
+ /* Possibly an attributes section. */
+--- 2039,2045 ----
+ }
+ }
+ }
+! goto success;
+
+ default:
+ /* Possibly an attributes section. */
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1963,1976 ****
+ || hdr->sh_type == bed->obj_attrs_section_type)
+ {
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+! return FALSE;
+ _bfd_elf_parse_attributes (abfd, hdr);
+! return TRUE;
+ }
+
+ /* Check for any processor-specific section types. */
+ if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex))
+! return TRUE;
+
+ if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER)
+ {
+--- 2047,2060 ----
+ || hdr->sh_type == bed->obj_attrs_section_type)
+ {
+ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+! goto fail;
+ _bfd_elf_parse_attributes (abfd, hdr);
+! goto success;
+ }
+
+ /* Check for any processor-specific section types. */
+ if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex))
+! goto success;
+
+ if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER)
+ {
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 1982,1990 ****
+ "specific section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+! /* Allow sections reserved for applications. */
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+! shindex);
+ }
+ else if (hdr->sh_type >= SHT_LOPROC
+ && hdr->sh_type <= SHT_HIPROC)
+--- 2066,2077 ----
+ "specific section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+! {
+! /* Allow sections reserved for applications. */
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name,
+! shindex);
+! goto success;
+! }
+ }
+ else if (hdr->sh_type >= SHT_LOPROC
+ && hdr->sh_type <= SHT_HIPROC)
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 2005,2012 ****
+ "`%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+! /* Otherwise it should be processed. */
+! return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+ }
+ else
+ /* FIXME: We should handle this section. */
+--- 2092,2102 ----
+ "`%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+ else
+! {
+! /* Otherwise it should be processed. */
+! ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex);
+! goto success;
+! }
+ }
+ else
+ /* FIXME: We should handle this section. */
+*************** bfd_section_from_shdr (bfd *abfd, unsign
+*** 2014,2023 ****
+ (_("%B: don't know how to handle section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+
+! return FALSE;
+ }
+
+! return TRUE;
+ }
+
+ /* Return the local symbol specified by ABFD, R_SYMNDX. */
+--- 2104,2123 ----
+ (_("%B: don't know how to handle section `%s' [0x%8x]"),
+ abfd, name, hdr->sh_type);
+
+! goto fail;
+ }
+
+! fail:
+! ret = FALSE;
+! success:
+! if (sections_being_created && sections_being_created_abfd == abfd)
+! sections_being_created [shindex] = FALSE;
+! if (-- nesting == 0)
+! {
+! sections_being_created = NULL;
+! sections_being_created_abfd = abfd;
+! }
+! return ret;
+ }
+
+ /* Return the local symbol specified by ABFD, R_SYMNDX. */
+*************** elfcore_write_lwpstatus (bfd *abfd,
+*** 9296,9302 ****
+ lwpstat.pr_lwpid = pid >> 16;
+ lwpstat.pr_cursig = cursig;
+ #if defined (HAVE_LWPSTATUS_T_PR_REG)
+! memcpy (lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg));
+ #elif defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
+ #if !defined(gregs)
+ memcpy (lwpstat.pr_context.uc_mcontext.gregs,
+--- 9396,9402 ----
+ lwpstat.pr_lwpid = pid >> 16;
+ lwpstat.pr_cursig = cursig;
+ #if defined (HAVE_LWPSTATUS_T_PR_REG)
+! memcpy (&lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg));
+ #elif defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
+ #if !defined(gregs)
+ memcpy (lwpstat.pr_context.uc_mcontext.gregs,
+diff -cpr ../binutils-2.24.orig/bfd/ihex.c bfd/ihex.c
+*** ../binutils-2.24.orig/bfd/ihex.c 2014-10-31 11:50:20.143220890 +0000
+--- bfd/ihex.c 2014-10-31 11:51:45.746721162 +0000
+*************** ihex_scan (bfd *abfd)
+*** 322,328 ****
+ {
+ if (! ISHEX (buf[i]))
+ {
+! ihex_bad_byte (abfd, lineno, hdr[i], error);
+ goto error_return;
+ }
+ }
+--- 322,328 ----
+ {
+ if (! ISHEX (buf[i]))
+ {
+! ihex_bad_byte (abfd, lineno, buf[i], error);
+ goto error_return;
+ }
+ }
+diff -cpr ../binutils-2.24.orig/bfd/peXXigen.c bfd/peXXigen.c
+*** ../binutils-2.24.orig/bfd/peXXigen.c 2014-10-31 11:50:20.149220928 +0000
+--- bfd/peXXigen.c 2014-10-31 11:51:00.397462266 +0000
+*************** _bfd_XXi_swap_aouthdr_in (bfd * abfd,
+*** 460,465 ****
+--- 460,476 ----
+ {
+ int idx;
+
++ /* PR 17512: Corrupt PE binaries can cause seg-faults. */
++ if (a->NumberOfRvaAndSizes > 16)
++ {
++ (*_bfd_error_handler)
++ (_("%B: aout header specifies an invalid number of data-directory entries: %d"),
++ abfd, a->NumberOfRvaAndSizes);
++ /* Paranoia: If the number is corrupt, then assume that the
++ actual entries themselves might be corrupt as well. */
++ a->NumberOfRvaAndSizes = 0;
++ }
++
+ for (idx = 0; idx < a->NumberOfRvaAndSizes; idx++)
+ {
+ /* If data directory is empty, rva also should be 0. */
+*************** pe_print_edata (bfd * abfd, void * vfile
+*** 1364,1370 ****
+ bfd_size_type datasize = 0;
+ bfd_size_type dataoff;
+ bfd_size_type i;
+! bfd_signed_vma adj;
+ struct EDT_type
+ {
+ long export_flags; /* Reserved - should be zero. */
+--- 1375,1381 ----
+ bfd_size_type datasize = 0;
+ bfd_size_type dataoff;
+ bfd_size_type i;
+! bfd_vma adj;
+ struct EDT_type
+ {
+ long export_flags; /* Reserved - should be zero. */
+*************** pe_print_edata (bfd * abfd, void * vfile
+*** 1414,1419 ****
+--- 1425,1437 ----
+ _("\nThere is an export table, but the section containing it could not be found\n"));
+ return TRUE;
+ }
++ else if (!(section->flags & SEC_HAS_CONTENTS))
++ {
++ fprintf (file,
++ _("\nThere is an export table in %s, but that section has no contents\n"),
++ section->name);
++ return TRUE;
++ }
+
+ dataoff = addr - section->vma;
+ datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size;
+*************** pe_print_edata (bfd * abfd, void * vfile
+*** 1426,1431 ****
+--- 1444,1458 ----
+ }
+ }
+
++ /* PR 17512: Handle corrupt PE binaries. */
++ if (datasize < 36)
++ {
++ fprintf (file,
++ _("\nThere is an export table in %s, but it is too small (%d)\n"),
++ section->name, (int) datasize);
++ return TRUE;
++ }
++
+ fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"),
+ section->name, (unsigned long) addr);
+
+*************** pe_print_edata (bfd * abfd, void * vfile
+*** 1469,1476 ****
+ fprintf (file,
+ _("Name \t\t\t\t"));
+ bfd_fprintf_vma (abfd, file, edt.name);
+! fprintf (file,
+! " %s\n", data + edt.name - adj);
+
+ fprintf (file,
+ _("Ordinal Base \t\t\t%ld\n"), edt.base);
+--- 1496,1506 ----
+ fprintf (file,
+ _("Name \t\t\t\t"));
+ bfd_fprintf_vma (abfd, file, edt.name);
+!
+! if ((edt.name >= adj) && (edt.name < adj + datasize))
+! fprintf (file, " %s\n", data + edt.name - adj);
+! else
+! fprintf (file, "(outside .edata section)\n");
+
+ fprintf (file,
+ _("Ordinal Base \t\t\t%ld\n"), edt.base);
+*************** pe_print_edata (bfd * abfd, void * vfile
+*** 1516,1522 ****
+ _("\nExport Address Table -- Ordinal Base %ld\n"),
+ edt.base);
+
+! for (i = 0; i < edt.num_functions; ++i)
+ {
+ bfd_vma eat_member = bfd_get_32 (abfd,
+ data + edt.eat_addr + (i * 4) - adj);
+--- 1546,1557 ----
+ _("\nExport Address Table -- Ordinal Base %ld\n"),
+ edt.base);
+
+! /* PR 17512: Handle corrupt PE binaries. */
+! if (edt.eat_addr + (edt.num_functions * 4) - adj >= datasize)
+! fprintf (file, _("\tInvalid Export Address Table rva (0x%lx) or entry count (0x%lx)\n"),
+! (long) edt.eat_addr,
+! (long) edt.num_functions);
+! else for (i = 0; i < edt.num_functions; ++i)
+ {
+ bfd_vma eat_member = bfd_get_32 (abfd,
+ data + edt.eat_addr + (i * 4) - adj);
+*************** pe_print_edata (bfd * abfd, void * vfile
+*** 1552,1558 ****
+ fprintf (file,
+ _("\n[Ordinal/Name Pointer] Table\n"));
+
+! for (i = 0; i < edt.num_names; ++i)
+ {
+ bfd_vma name_ptr = bfd_get_32 (abfd,
+ data +
+--- 1587,1602 ----
+ fprintf (file,
+ _("\n[Ordinal/Name Pointer] Table\n"));
+
+! /* PR 17512: Handle corrupt PE binaries. */
+! if (edt.npt_addr + (edt.num_names * 4) - adj >= datasize)
+! fprintf (file, _("\tInvalid Name Pointer Table rva (0x%lx) or entry count (0x%lx)\n"),
+! (long) edt.npt_addr,
+! (long) edt.num_names);
+! else if (edt.ot_addr + (edt.num_names * 2) - adj >= datasize)
+! fprintf (file, _("\tInvalid Ordinal Table rva (0x%lx) or entry count (0x%lx)\n"),
+! (long) edt.ot_addr,
+! (long) edt.num_names);
+! else for (i = 0; i < edt.num_names; ++i)
+ {
+ bfd_vma name_ptr = bfd_get_32 (abfd,
+ data +
+diff -cpr ../binutils-2.24.orig/bfd/srec.c bfd/srec.c
+*** ../binutils-2.24.orig/bfd/srec.c 2014-10-31 11:50:20.144220896 +0000
+--- bfd/srec.c 2014-10-31 11:50:55.808436025 +0000
+*************** srec_bad_byte (bfd *abfd,
+*** 248,254 ****
+ }
+ else
+ {
+! char buf[10];
+
+ if (! ISPRINT (c))
+ sprintf (buf, "\\%03o", (unsigned int) c);
+--- 248,254 ----
+ }
+ else
+ {
+! char buf[40];
+
+ if (! ISPRINT (c))
+ sprintf (buf, "\\%03o", (unsigned int) c);
+*************** srec_scan (bfd *abfd)
+*** 454,461 ****
+ case 'S':
+ {
+ file_ptr pos;
+! char hdr[3];
+! unsigned int bytes;
+ bfd_vma address;
+ bfd_byte *data;
+ unsigned char check_sum;
+--- 454,461 ----
+ case 'S':
+ {
+ file_ptr pos;
+! unsigned char hdr[3];
+! unsigned int bytes, min_bytes;
+ bfd_vma address;
+ bfd_byte *data;
+ unsigned char check_sum;
+*************** srec_scan (bfd *abfd)
+*** 478,483 ****
+--- 478,496 ----
+ }
+
+ check_sum = bytes = HEX (hdr + 1);
++ min_bytes = 3;
++ if (hdr[0] == '2' || hdr[0] == '8')
++ min_bytes = 4;
++ else if (hdr[0] == '3' || hdr[0] == '7')
++ min_bytes = 5;
++ if (bytes < min_bytes)
++ {
++ (*_bfd_error_handler) (_("%B:%d: byte count %d too small\n"),
++ abfd, lineno, bytes);
++ bfd_set_error (bfd_error_bad_value);
++ goto error_return;
++ }
++
+ if (bytes * 2 > bufsize)
+ {
+ if (buf != NULL)
diff --git a/binutils-2.24-elfnn-aarch64.patch b/binutils-2.24-elfnn-aarch64.patch
index 2491e0f..f708c06 100644
--- a/binutils-2.24-elfnn-aarch64.patch
+++ b/binutils-2.24-elfnn-aarch64.patch
@@ -1,93 +1,21 @@
*** ../binutils-2.24.orig/bfd/elfnn-aarch64.c 2013-12-17 11:16:28.723807381 +0000
--- bfd/elfnn-aarch64.c 2013-12-17 11:18:13.517804067 +0000
*************** _aarch64_elf_section_data;
-*** 1679,1686 ****
- #define elf_aarch64_section_data(sec) \
- ((_aarch64_elf_section_data *) elf_section_data (sec))
+*** 1701,1708 ****
+ enum elf_aarch64_stub_type stub_type;
+ };
! /* The size of the thread control block. */
! #define TCB_SIZE 16
struct elf_aarch64_local_symbol
{
---- 1679,1686 ----
- #define elf_aarch64_section_data(sec) \
- ((_aarch64_elf_section_data *) elf_section_data (sec))
+--- 1701,1708 ----
+ enum elf_aarch64_stub_type stub_type;
+ };
! /* The size of the thread control block which is defined to be two pointers. */
! #define TCB_SIZE (ARCH_SIZE/8)*2
struct elf_aarch64_local_symbol
{
-*************** elfNN_aarch64_final_link_relocate (reloc
-*** 3589,3595 ****
-
- if (globals->root.splt != NULL)
- {
-! plt_index = h->plt.offset / globals->plt_entry_size - 1;
- off = (plt_index + 3) * GOT_ENTRY_SIZE;
- base_got = globals->root.sgotplt;
- }
---- 3589,3596 ----
-
- if (globals->root.splt != NULL)
- {
-! plt_index = ((h->plt.offset - globals->plt_header_size) /
-! globals->plt_entry_size);
- off = (plt_index + 3) * GOT_ENTRY_SIZE;
- base_got = globals->root.sgotplt;
- }
-*************** elfNN_aarch64_finish_dynamic_symbol (bfd
-*** 6823,6829 ****
- + htab->root.sgot->output_offset
- + (h->got.offset & ~(bfd_vma) 1));
-
-! if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
- {
- if (!h->def_regular)
- return FALSE;
---- 6824,6857 ----
- + htab->root.sgot->output_offset
- + (h->got.offset & ~(bfd_vma) 1));
-
-! if (h->def_regular
-! && h->type == STT_GNU_IFUNC)
-! {
-! if (info->shared)
-! {
-! /* Generate R_AARCH64_GLOB_DAT. */
-! goto do_glob_dat;
-! }
-! else
-! {
-! asection *plt;
-!
-! if (!h->pointer_equality_needed)
-! abort ();
-!
-! /* For non-shared object, we can't use .got.plt, which
-! contains the real function address if we need pointer
-! equality. We load the GOT entry with the PLT entry. */
-! plt = htab->root.splt ? htab->root.splt : htab->root.iplt;
-! bfd_put_NN (output_bfd, (plt->output_section->vma
-! + plt->output_offset
-! + h->plt.offset),
-! htab->root.sgot->contents
-! + (h->got.offset & ~(bfd_vma) 1));
-! return TRUE;
-! }
-! }
-! else if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
- {
- if (!h->def_regular)
- return FALSE;
-*************** elfNN_aarch64_finish_dynamic_symbol (bfd
-*** 6836,6841 ****
---- 6864,6870 ----
- }
- else
- {
-+ do_glob_dat:
- BFD_ASSERT ((h->got.offset & 1) == 0);
- bfd_put_NN (output_bfd, (bfd_vma) 0,
- htab->root.sgot->contents + h->got.offset);
diff --git a/binutils-2.24-fat-lto-objects.patch b/binutils-2.24-fat-lto-objects.patch
new file mode 100644
index 0000000..fe9c334
--- /dev/null
+++ b/binutils-2.24-fat-lto-objects.patch
@@ -0,0 +1,57 @@
+commit b35d44f1af711925bfa4344ef00470fee67122f1
+Author: Kyrylo Tkachov <kyrylo.tkachov at arm.com>
+Date: Wed Nov 27 13:43:39 2013 +0000
+
+ [ld/testsuite/]
+ 2013-11-27 Kyrylo Tkachov <kyrylo.tkachov at arm.com>
+
+ * ld-plugin/lto.exp: Add -ffat-lto-objects.
+ * lib/ld-lib.exp (check_lto_available): Likewise.
+
+--- a/ld/testsuite/ld-plugin/lto.exp
++++ b/ld/testsuite/ld-plugin/lto.exp
+@@ -57,7 +57,7 @@ set lto_link_tests {
+ "" "-O2"
+ {lto-3c.c} {} "libdummy.a"}
+ {"Build liblto-3.a"
+- "" "-flto"
++ "" "-flto -ffat-lto-objects"
+ {lto-3b.c} {} "liblto-3.a"}
+ {"Build libdummy.a 5a"
+ "" "-flto"
+@@ -111,7 +111,7 @@ set lto_link_tests {
+ "" ""
+ {pr12758a.s} {} "libdummy.a"}
+ {"Build libpr12758.a"
+- "" "-flto -O2"
++ "" "-flto -O2 -ffat-lto-objects"
+ {pr12758b.c} {} "libpr12758.a"}
+ {"PR ld/12758"
+ "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" ""
+@@ -120,13 +120,13 @@ set lto_link_tests {
+ "" ""
+ {pr12760a.c} {} "libdummy.a"}
+ {"Build libpr12760.a"
+- "" "-flto -O2"
++ "" "-flto -O2 -ffat-lto-objects"
+ {pr12760b.c} {} "libpr12760.a"}
+ {"PR ld/12760"
+ "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" ""
+ {dummy.c} {} "pr12760.exe" "c" "warning: Bad bar"}
+ {"Build libpr13183.a"
+- "-T" "-flto -O2"
++ "-T" "-flto -O2 -ffat-lto-objects"
+ {pr13183a.c} {} "libpr13183.a"}
+ {"Build libdummy.a PR ld/13183"
+ "" "-flto -O2"
+--- a/ld/testsuite/lib/ld-lib.exp
++++ b/ld/testsuite/lib/ld-lib.exp
+@@ -1643,7 +1643,7 @@ proc check_lto_available { } {
+ set f [open $src "w"]
+ puts $f ""
+ close $f
+- set status [remote_exec host $CC "-shared -B[pwd]/tmpdir/ld/ -flto -fuse-linker-plugin $src -o $output"]
++ set status [remote_exec host $CC "-shared -B[pwd]/tmpdir/ld/ -flto -ffat-lto-objects -fuse-linker-plugin $src -o $output"]
+ if { [lindex $status 0] == 0 } {
+ set lto_available_saved 1
+ } else {
diff --git a/binutils-2.24-indirect-chain.patch b/binutils-2.24-indirect-chain.patch
new file mode 100644
index 0000000..b255424
--- /dev/null
+++ b/binutils-2.24-indirect-chain.patch
@@ -0,0 +1,28 @@
+*** ../binutils-2.24.orig/bfd/elflink.c 2014-08-21 09:17:27.753408085 +0100
+--- bfd/elflink.c 2014-08-21 10:04:52.174935912 +0100
+*************** _bfd_elf_add_default_symbol (bfd *abfd,
+*** 1705,1710 ****
+--- 1705,1716 ----
+ ht = (struct elf_link_hash_entry *) hi->root.u.i.link;
+ (*bed->elf_backend_copy_indirect_symbol) (info, ht, hi);
+
++ /* A reference to the SHORTNAME symbol from a dynamic library
++ will be satisfied by the versioned symbol at runtime. In
++ effect, we have a reference to the versioned symbol. */
++ ht->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak;
++ hi->dynamic_def |= ht->dynamic_def;
++
+ /* See if the new flags lead us to realize that the symbol must
+ be dynamic. */
+ if (! *dynsym)
+*************** nondefault:
+*** 1774,1779 ****
+--- 1780,1787 ----
+ if (hi->root.type == bfd_link_hash_indirect)
+ {
+ (*bed->elf_backend_copy_indirect_symbol) (info, h, hi);
++ h->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak;
++ hi->dynamic_def |= h->dynamic_def;
+
+ /* See if the new flags lead us to realize that the symbol
+ must be dynamic. */
diff --git a/binutils-2.24-strings-default-all.patch b/binutils-2.24-strings-default-all.patch
new file mode 100644
index 0000000..97b9f8e
--- /dev/null
+++ b/binutils-2.24-strings-default-all.patch
@@ -0,0 +1,310 @@
+diff -cpr ../binutils-2.24.orig/binutils/config.in binutils/config.in
+*** ../binutils-2.24.orig/binutils/config.in 2014-10-31 11:50:20.455222877 +0000
+--- binutils/config.in 2014-10-31 11:59:05.021241036 +0000
+***************
+*** 18,23 ****
+--- 18,26 ----
+ /* Should ar and ranlib use -D behavior by default? */
+ #undef DEFAULT_AR_DETERMINISTIC
+
++ /* Should strings use -a behavior by default? */
++ #undef DEFAULT_STRINGS_ALL
++
+ /* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+ #undef ENABLE_NLS
+diff -cpr ../binutils-2.24.orig/binutils/configure binutils/configure
+*** ../binutils-2.24.orig/binutils/configure 2014-10-31 11:50:20.590223736 +0000
+--- binutils/configure 2014-10-31 12:01:46.570102643 +0000
+*************** with_gnu_ld
+*** 772,777 ****
+--- 772,778 ----
+ enable_libtool_lock
+ enable_targets
+ enable_deterministic_archives
++ enable_default_strings_all
+ enable_werror
+ enable_build_warnings
+ enable_nls
+*************** Optional Features:
+*** 1421,1426 ****
+--- 1422,1429 ----
+ --enable-targets alternative target configurations
+ --enable-deterministic-archives
+ ar and ranlib default to -D behavior
++ --disable-default-strings-all
++ strings defaults to --data behavior
+ --enable-werror treat compile warnings as errors
+ --enable-build-warnings enable build-time compiler warnings
+ --disable-nls do not use Native Language Support
+*************** cat >>confdefs.h <<_ACEOF
+*** 11615,11620 ****
+--- 11594,11618 ----
+ _ACEOF
+
+
++ # Check whether --enable-default-strings-all was given.
++ if test "${enable_default_strings_all+set}" = set; then :
++ enableval=$enable_default_strings_all;
++ if test "${enableval}" = no; then
++ default_strings_all=0
++ else
++ default_strings_all=1
++ fi
++ else
++ default_strings_all=1
++ fi
++
++
++
++ cat >>confdefs.h <<_ACEOF
++ #define DEFAULT_STRINGS_ALL $default_strings_all
++ _ACEOF
++
++
+
+ GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+diff -cpr ../binutils-2.24.orig/binutils/configure.in binutils/configure.in
+*** ../binutils-2.24.orig/binutils/configure.in 2014-10-31 11:50:20.430222717 +0000
+--- binutils/configure.in 2014-10-31 12:00:48.092790946 +0000
+*************** fi], [default_ar_deterministic=0])
+*** 57,62 ****
+--- 57,74 ----
+ AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
+ [Should ar and ranlib use -D behavior by default?])
+
++ AC_ARG_ENABLE(default-strings-all,
++ [AS_HELP_STRING([--disable-default-strings-all],
++ [strings defaults to --data behavior])], [
++ if test "${enableval}" = no; then
++ default_strings_all=0
++ else
++ default_strings_all=1
++ fi], [default_strings_all=1])
++
++ AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
++ [Should strings use -a behavior by default?])
++
+ AM_BINUTILS_WARNINGS
+
+ AC_CONFIG_HEADERS(config.h:config.in)
+diff -cpr ../binutils-2.24.orig/binutils/doc/binutils.texi binutils/doc/binutils.texi
+*** ../binutils-2.24.orig/binutils/doc/binutils.texi 2014-10-31 11:50:20.579223666 +0000
+--- binutils/doc/binutils.texi 2014-10-31 11:59:23.052339164 +0000
+*************** strings [@option{-afovV}] [@option{-}@va
+*** 2653,2667 ****
+
+ @c man begin DESCRIPTION strings
+
+! For each @var{file} given, @sc{gnu} @command{strings} prints the printable
+! character sequences that are at least 4 characters long (or the number
+! given with the options below) and are followed by an unprintable
+! character. By default, it only prints the strings from the initialized
+! and loaded sections of object files; for other types of files, it prints
+! the strings from the whole file.
+
+! @command{strings} is mainly useful for determining the contents of non-text
+! files.
+
+ @c man end
+
+--- 2653,2676 ----
+
+ @c man begin DESCRIPTION strings
+
+! For each @var{file} given, @sc{gnu} @command{strings} prints the
+! printable character sequences that are at least 4 characters long (or
+! the number given with the options below) and are followed by an
+! unprintable character.
+!
+! Depending upon how the strings program was configured it will default
+! to either displaying all the printable sequences that it can find in
+! each file, or only those sequences that are in loadable, initialized
+! data sections. If the file type in unrecognizable, or if strings is
+! reading from stdin then it will always display all of the printable
+! sequences that it can find.
+!
+! For backwards compatibility any file that occurs after a command line
+! option of just @option{-} will also be scanned in full, regardless of
+! the presence of any @option{-d} option.
+
+! @command{strings} is mainly useful for determining the contents of
+! non-text files.
+
+ @c man end
+
+*************** files.
+*** 2671,2678 ****
+ @item -a
+ @itemx --all
+ @itemx -
+! Do not scan only the initialized and loaded sections of object files;
+! scan the whole files.
+
+ @item -f
+ @itemx --print-file-name
+--- 2680,2704 ----
+ @item -a
+ @itemx --all
+ @itemx -
+! Scan the whole file, regardless of what sections it contains or
+! whether those sections are loaded or initialized. Normally this is
+! the default behaviour, but strings can be configured so that the
+! @option{-d} is the default instead.
+!
+! The @option{-} option is position dependent and forces strings to
+! perform full scans of any file that is mentioned after the @option{-}
+! on the command line, even if the @option{-d} option has been
+! specified.
+!
+! @item -d
+! @itemx --data
+! Only print strings from initialized, loaded data sections in the
+! file. This may reduce the amount of garbage in the output, but it
+! also exposes the strings program to any security flaws that may be
+! present in the BFD library used to scan and load sections. Strings
+! can be configured so that this option is the default behaviour. In
+! such cases the @option{-a} option can be used to avoid using the BFD
+! library and instead just print all of the strings found in the file.
+
+ @item -f
+ @itemx --print-file-name
+diff -cpr ../binutils-2.24.orig/binutils/NEWS binutils/NEWS
+*** ../binutils-2.24.orig/binutils/NEWS 2014-10-31 11:50:20.338222131 +0000
+--- binutils/NEWS 2014-10-31 11:59:52.315493579 +0000
+***************
+*** 1,5 ****
+--- 1,10 ----
+ -*- text -*-
+
++ * Add --data option to strings to only print strings in loadable, initialized
++ data sections. Change the default behaviour to be --all, but add a new
++ configure time option of --disable-default-strings-all to restore the old
++ default behaviour.
++
+ Changes in 2.24:
+
+ * Objcopy now supports wildcard characters in command line options that take
+diff -cpr ../binutils-2.24.orig/binutils/strings.c binutils/strings.c
+*** ../binutils-2.24.orig/binutils/strings.c 2014-10-31 11:50:20.464222934 +0000
+--- binutils/strings.c 2014-10-31 12:01:33.901035485 +0000
+***************
+*** 23,29 ****
+ Options:
+ --all
+ -a
+! - Do not scan only the initialized data section of object files.
+
+ --print-file-name
+ -f Print the name of the file before each string.
+--- 23,32 ----
+ Options:
+ --all
+ -a
+! - Scan each file in its entirety.
+!
+! --data
+! -d Scan only the initialized data section(s) of object files.
+
+ --print-file-name
+ -f Print the name of the file before each string.
+*************** static int encoding_bytes;
+*** 107,112 ****
+--- 110,116 ----
+ static struct option long_options[] =
+ {
+ {"all", no_argument, NULL, 'a'},
++ {"data", no_argument, NULL, 'd'},
+ {"print-file-name", no_argument, NULL, 'f'},
+ {"bytes", required_argument, NULL, 'n'},
+ {"radix", required_argument, NULL, 't'},
+*************** typedef struct
+*** 128,134 ****
+
+ static void strings_a_section (bfd *, asection *, void *);
+ static bfd_boolean strings_object_file (const char *);
+! static bfd_boolean strings_file (char *file);
+ static void print_strings (const char *, FILE *, file_ptr, int, int, char *);
+ static void usage (FILE *, int);
+ static long get_char (FILE *, file_ptr *, int *, char **);
+--- 132,138 ----
+
+ static void strings_a_section (bfd *, asection *, void *);
+ static bfd_boolean strings_object_file (const char *);
+! static bfd_boolean strings_file (char *);
+ static void print_strings (const char *, FILE *, file_ptr, int, int, char *);
+ static void usage (FILE *, int);
+ static long get_char (FILE *, file_ptr *, int *, char **);
+*************** main (int argc, char **argv)
+*** 158,168 ****
+ string_min = 4;
+ print_addresses = FALSE;
+ print_filenames = FALSE;
+! datasection_only = TRUE;
+ target = NULL;
+ encoding = 's';
+
+! while ((optc = getopt_long (argc, argv, "afhHn:ot:e:T:Vv0123456789",
+ long_options, (int *) 0)) != EOF)
+ {
+ switch (optc)
+--- 162,175 ----
+ string_min = 4;
+ print_addresses = FALSE;
+ print_filenames = FALSE;
+! if (DEFAULT_STRINGS_ALL)
+! datasection_only = FALSE;
+! else
+! datasection_only = TRUE;
+ target = NULL;
+ encoding = 's';
+
+! while ((optc = getopt_long (argc, argv, "adfhHn:ot:e:T:Vv0123456789",
+ long_options, (int *) 0)) != EOF)
+ {
+ switch (optc)
+*************** main (int argc, char **argv)
+*** 171,176 ****
+--- 178,187 ----
+ datasection_only = FALSE;
+ break;
+
++ case 'd':
++ datasection_only = TRUE;
++ break;
++
+ case 'f':
+ print_filenames = TRUE;
+ break;
+*************** usage (FILE *stream, int status)
+*** 635,642 ****
+ {
+ fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
+ fprintf (stream, _(" Display printable strings in [file(s)] (stdin by default)\n"));
+! fprintf (stream, _(" The options are:\n\
+ -a - --all Scan the entire file, not just the data section\n\
+ -f --print-file-name Print the name of the file before each string\n\
+ -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n\
+ -<number> least [number] characters (default 4).\n\
+--- 646,663 ----
+ {
+ fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
+ fprintf (stream, _(" Display printable strings in [file(s)] (stdin by default)\n"));
+! fprintf (stream, _(" The options are:\n"));
+!
+! if (DEFAULT_STRINGS_ALL)
+! fprintf (stream, _("\
+! -a - --all Scan the entire file, not just the data section [default]\n\
+! -d --data Only scan the data sections in the file\n"));
+! else
+! fprintf (stream, _("\
+ -a - --all Scan the entire file, not just the data section\n\
++ -d --data Only scan the data sections in the file [default]\n"));
++
++ fprintf (stream, _("\
+ -f --print-file-name Print the name of the file before each string\n\
+ -n --bytes=[number] Locate & print any NUL-terminated sequence of at\n\
+ -<number> least [number] characters (default 4).\n\
+
+Only in binutils: strings.c.rej
diff --git a/binutils-2.24-symbol-warning.patch b/binutils-2.24-symbol-warning.patch
new file mode 100644
index 0000000..aff6c48
--- /dev/null
+++ b/binutils-2.24-symbol-warning.patch
@@ -0,0 +1,114 @@
+From 4c6d802e592b3762a149c343bc5722e065e57841 Mon Sep 17 00:00:00 2001
+From: H.J. Lu <hjl.tools at gmail.com>
+Date: Wed, 26 Mar 2014 12:18:59 -0700
+Subject: [PATCH] Scan all input files for symbol reference warning
+
+This patch scans all input files for symbol reference warning if the
+symbol reference doesn't exist in the current input file.
+
+ld/
+
+ PR ld/16756
+ * ldmain.c (symbol_warning): New function.
+ (warning_callback): Use it. Scan all input files for a reference
+ to SYMBOL.
+
+ld/testsuite/
+
+ PR ld/16756
+ * ld-plugin/lto.exp: Expect filename and line number for PR
+ ld/12760 test.
+---
+ ld/ChangeLog | 7 ++++
+ ld/ldmain.c | 43 ++++++++++++++++----------
+ ld/testsuite/ChangeLog | 64 ++++++++++++++++++++++------------------
+ ld/testsuite/ld-plugin/lto.exp | 4 +-
+ 4 files changed, 70 insertions(+), 48 deletions(-)
+
+diff --git a/ld/ldmain.c b/ld/ldmain.c
+index ffc9f84..14253a6 100644
+--- a/ld/ldmain.c
++++ b/ld/ldmain.c
+@@ -1150,6 +1150,25 @@ struct warning_callback_info
+ asymbol **asymbols;
+ };
+
++/* Look through the relocs to see if we can find a plausible address
++ for SYMBOL in ABFD. Return TRUE if found. Otherwise return FALSE. */
++
++static bfd_boolean
++symbol_warning (const char *warning, const char *symbol, bfd *abfd)
++{
++ struct warning_callback_info cinfo;
++
++ if (!bfd_generic_link_read_symbols (abfd))
++ einfo (_("%B%F: could not read symbols: %E\n"), abfd);
++
++ cinfo.found = FALSE;
++ cinfo.warning = warning;
++ cinfo.symbol = symbol;
++ cinfo.asymbols = bfd_get_outsymbols (abfd);
++ bfd_map_over_sections (abfd, warning_find_reloc, &cinfo);
++ return cinfo.found;
++}
++
+ /* This is called when there is a reference to a warning symbol. */
+
+ static bfd_boolean
+--- a/ld/ldmain.c 2014-06-24 14:04:00.700594584 -0400
++++ b/ld/ldmain.c 2014-06-24 14:07:19.452270808 -0400
+@@ -1172,24 +1172,14 @@
+ einfo ("%P: %s%s\n", _("warning: "), warning);
+ else if (symbol == NULL)
+ einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
+- else if ((abfd->flags & BFD_PLUGIN) == 0)
++ else if (! symbol_warning (warning, symbol, abfd))
+ {
+- struct warning_callback_info cinfo;
+-
+- /* Look through the relocs to see if we can find a plausible
+- address. */
+-
+- if (!bfd_generic_link_read_symbols (abfd))
+- einfo (_("%B%F: could not read symbols: %E\n"), abfd);
+-
+- cinfo.found = FALSE;
+- cinfo.warning = warning;
+- cinfo.symbol = symbol;
+- cinfo.asymbols = bfd_get_outsymbols (abfd);
+- bfd_map_over_sections (abfd, warning_find_reloc, &cinfo);
+-
+- if (! cinfo.found)
+- einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
++ bfd *b;
++ /* Search all input files for a reference to SYMBOL. */
++ for (b = info->input_bfds; b; b = b->link_next)
++ if (b != abfd && symbol_warning (warning, symbol, b))
++ return TRUE;
++ einfo ("%B: %s%s\n", abfd, _("warning: "), warning);
+ }
+
+ return TRUE;
+diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
+index af7307f..53543a6 100644
+--- a/ld/testsuite/ld-plugin/lto.exp
++++ b/ld/testsuite/ld-plugin/lto.exp
+@@ -116,14 +116,14 @@ set lto_link_tests {
+ "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" ""
+ {dummy.c} {} "pr12758.exe"}
+ {"Build libdummy.a PR ld/12760"
+- "" ""
++ "" "-g -O0"
+ {pr12760a.c} {} "libdummy.a"}
+ {"Build libpr12760.a"
+ "" "-flto -O2 -ffat-lto-objects"
+ {pr12760b.c} {} "libpr12760.a"}
+ {"PR ld/12760"
+ "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" ""
+- {dummy.c} {} "pr12760.exe" "c" "warning: Bad bar"}
++ {dummy.c} {} "pr12760.exe" "c" "pr12760a.c:6: warning: Bad bar"}
+ {"Build libpr13183.a"
+ "-T" "-flto -O2 -ffat-lto-objects"
+ {pr13183a.c} {} "libpr13183.a"}
+--
+1.7.1
diff --git a/binutils-2.24-weak-sym-merge.patch b/binutils-2.24-weak-sym-merge.patch
new file mode 100644
index 0000000..0625f0d
--- /dev/null
+++ b/binutils-2.24-weak-sym-merge.patch
@@ -0,0 +1,22 @@
+*** ../binutils-2.24.orig/bfd/elflink.c 2014-08-15 14:12:59.933394436 +0100
+--- bfd/elflink.c 2014-08-15 14:40:54.787075416 +0100
+*************** _bfd_elf_merge_symbol (bfd *abfd,
+*** 1437,1443 ****
+ if (!(oldbfd != NULL
+ && (oldbfd->flags & BFD_PLUGIN) != 0
+ && (abfd->flags & BFD_PLUGIN) == 0))
+! *skip = TRUE;
+
+ /* Merge st_other. If the symbol already has a dynamic index,
+ but visibility says it should not be visible, turn it into a
+--- 1437,1446 ----
+ if (!(oldbfd != NULL
+ && (oldbfd->flags & BFD_PLUGIN) != 0
+ && (abfd->flags & BFD_PLUGIN) == 0))
+! {
+! newdef = FALSE;
+! *skip = TRUE;
+! }
+
+ /* Merge st_other. If the symbol already has a dynamic index,
+ but visibility says it should not be visible, turn it into a
diff --git a/binutils-HEAD-change-ld-notice-interface.patch b/binutils-HEAD-change-ld-notice-interface.patch
new file mode 100644
index 0000000..db2ea9b
--- /dev/null
+++ b/binutils-HEAD-change-ld-notice-interface.patch
@@ -0,0 +1,398 @@
+From 4613510308cea27713e8c7424b2afee9b99f6226 Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra at gmail.com>
+Date: Tue, 12 Aug 2014 10:43:33 +0930
+Subject: [PATCH] Change ld "notice" interface for better handling of
+ indirect symbols
+
+The main aim of this change was to have non_ir_ref set correctly on
+new indirect symbols. I could have added a "copy" param to the "notice"
+function, so that indirect symbols could be created in plugin_notice,
+but it seemed cleaner to create indirect syms earlier and pass them
+rather than "string" to "notice".
+
+include/
+ * bfdlink.h (struct bfd_link_callbacks <notice>): Remove "string"
+ param, add "inh".
+bfd/
+ * coff-aux.c (coff_m68k_aux_link_add_one_symbol): Only call "notice"
+ here when not calling the generic add_symbol function. Formatting.
+ Correct handling of indirect symbols. Update notice call.
+ * elflink.c (_bfd_elf_notice_as_needed): Update notice call.
+ * linker.c (_bfd_generic_link_add_one_symbol): Create indirect
+ symbols early. Update notice call. Add comments regarding weak
+ symbols vs. indirect.
+ld/
+ * ldmain.c (notice): Update args.
+ * plugin.c (plugin_notice): Likewise. Follow warning sym link.
+ Handle new indirect symbol.
+---
+ bfd/coff-aux.c | 62 ++++++++++++++++++++++-------------------
+ bfd/elflink.c | 2 +-
+ bfd/linker.c | 82 +++++++++++++++++++++++++++++--------------------------
+ include/bfdlink.h | 13 ++++-----
+ ld/ldmain.c | 6 ++--
+ ld/plugin.c | 33 ++++++++++++----------
+ 9 files changed, 128 insertions(+), 91 deletions(-)
+
+diff --git a/bfd/coff-aux.c b/bfd/coff-aux.c
+index e79c77a..d95b98b 100644
+--- a/bfd/coff-aux.c
++++ b/bfd/coff-aux.c
+@@ -73,20 +73,17 @@ coff_m68k_aux_link_add_one_symbol (struct bfd_link_info *info,
+ bfd_boolean collect,
+ struct bfd_link_hash_entry **hashp)
+ {
+- struct bfd_link_hash_entry *h;
++ struct bfd_link_hash_entry *h, *inh, *t;
+
+- if ((flags & (BSF_WARNING | BSF_CONSTRUCTOR | BSF_WEAK)) == 0 &&
+- !bfd_is_und_section (section) &&
+- !bfd_is_com_section (section))
++ if ((flags & (BSF_WARNING | BSF_CONSTRUCTOR | BSF_WEAK)) == 0
++ && !bfd_is_und_section (section)
++ && !bfd_is_com_section (section))
+ {
+ /* The new symbol is a definition or an indirect definition */
+
+ /* This bit copied from linker.c */
+ if (hashp != NULL && *hashp != NULL)
+- {
+- h = *hashp;
+- BFD_ASSERT (strcmp (h->root.string, name) == 0);
+- }
++ h = *hashp;
+ else
+ {
+ h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE);
+@@ -98,37 +95,46 @@ coff_m68k_aux_link_add_one_symbol (struct bfd_link_info *info,
+ }
+ }
+
+- if (info->notice_hash != (struct bfd_hash_table *) NULL
+- && (bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE)
+- != (struct bfd_hash_entry *) NULL))
+- {
+- if (! (*info->callbacks->notice) (info, h, abfd, section, value,
+- flags, string))
+- return FALSE;
+- }
+-
+ if (hashp != (struct bfd_link_hash_entry **) NULL)
+ *hashp = h;
+ /* end duplication from linker.c */
+
+- if (h->type == bfd_link_hash_defined
+- || h->type == bfd_link_hash_indirect)
++ t = h;
++ inh = NULL;
++ if (h->type == bfd_link_hash_indirect)
+ {
+- asection *msec;
++ inh = h->u.i.link;
++ t = inh;
++ }
+
+- if (h->type == bfd_link_hash_defined)
+- msec = h->u.def.section;
+- else
+- msec = bfd_ind_section_ptr;
++ if (t->type == bfd_link_hash_defined)
++ {
++ asection *msec = t->u.def.section;
++ bfd_boolean special = FALSE;
+
+ if (bfd_is_abs_section (msec) && !bfd_is_abs_section (section))
+ {
+- h->u.def.section = section;
+- h->u.def.value = value;
+- return TRUE;
++ t->u.def.section = section;
++ t->u.def.value = value;
++ special = TRUE;
+ }
+ else if (bfd_is_abs_section (section) && !bfd_is_abs_section (msec))
+- return TRUE;
++ special = TRUE;
++
++ if (special)
++ {
++ if (info->notice_all
++ || (info->notice_hash != NULL
++ && bfd_hash_lookup (info->notice_hash, name,
++ FALSE, FALSE) != NULL))
++ {
++ if (!(*info->callbacks->notice) (info, h, inh,
++ abfd, section, value, flags))
++ return FALSE;
++ }
++
++ return TRUE;
++ }
+ }
+ }
+
+diff --git a/bfd/elflink.c b/bfd/elflink.c
+index 69a87a6..de0a734 100644
+--- a/bfd/elflink.c
++++ b/bfd/elflink.c
+@@ -3299,7 +3299,7 @@ _bfd_elf_notice_as_needed (bfd *ibfd,
+ struct bfd_link_info *info,
+ enum notice_asneeded_action act)
+ {
+- return (*info->callbacks->notice) (info, NULL, ibfd, NULL, act, 0, NULL);
++ return (*info->callbacks->notice) (info, NULL, NULL, ibfd, NULL, act, 0);
+ }
+
+ /* Add symbols from an ELF object file to the linker hash table. */
+diff --git a/bfd/linker.c b/bfd/linker.c
+index 1a5ecef..abdf5b0 100644
+--- a/bfd/linker.c
++++ b/bfd/linker.c
+@@ -1442,13 +1442,23 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
+ {
+ enum link_row row;
+ struct bfd_link_hash_entry *h;
++ struct bfd_link_hash_entry *inh = NULL;
+ bfd_boolean cycle;
+
+ BFD_ASSERT (section != NULL);
+
+ if (bfd_is_ind_section (section)
+ || (flags & BSF_INDIRECT) != 0)
+- row = INDR_ROW;
++ {
++ row = INDR_ROW;
++ /* Create the indirect symbol here. This is for the benefit of
++ the plugin "notice" function.
++ STRING is the name of the symbol we want to indirect to. */
++ inh = bfd_wrapped_link_hash_lookup (abfd, info, string, TRUE,
++ copy, FALSE);
++ if (inh == NULL)
++ return FALSE;
++ }
+ else if ((flags & BSF_WARNING) != 0)
+ row = WARN_ROW;
+ else if ((flags & BSF_CONSTRUCTOR) != 0)
+@@ -1493,8 +1503,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
+ || (info->notice_hash != NULL
+ && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL))
+ {
+- if (! (*info->callbacks->notice) (info, h,
+- abfd, section, value, flags, string))
++ if (! (*info->callbacks->notice) (info, h, inh,
++ abfd, section, value, flags))
+ return FALSE;
+ }
+
+@@ -1728,44 +1738,40 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
+ return FALSE;
+ /* Fall through. */
+ case IND:
+- /* Create an indirect symbol. */
+- {
+- struct bfd_link_hash_entry *inh;
+-
+- /* STRING is the name of the symbol we want to indirect
+- to. */
+- inh = bfd_wrapped_link_hash_lookup (abfd, info, string, TRUE,
+- copy, FALSE);
+- if (inh == NULL)
++ if (inh->type == bfd_link_hash_indirect
++ && inh->u.i.link == h)
++ {
++ (*_bfd_error_handler)
++ (_("%B: indirect symbol `%s' to `%s' is a loop"),
++ abfd, name, string);
++ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+- if (inh->type == bfd_link_hash_indirect
+- && inh->u.i.link == h)
+- {
+- (*_bfd_error_handler)
+- (_("%B: indirect symbol `%s' to `%s' is a loop"),
+- abfd, name, string);
+- bfd_set_error (bfd_error_invalid_operation);
+- return FALSE;
+- }
+- if (inh->type == bfd_link_hash_new)
+- {
+- inh->type = bfd_link_hash_undefined;
+- inh->u.undef.abfd = abfd;
+- bfd_link_add_undef (info->hash, inh);
+- }
++ }
++ if (inh->type == bfd_link_hash_new)
++ {
++ inh->type = bfd_link_hash_undefined;
++ inh->u.undef.abfd = abfd;
++ bfd_link_add_undef (info->hash, inh);
++ }
+
+- /* If the indirect symbol has been referenced, we need to
+- push the reference down to the symbol we are
+- referencing. */
+- if (h->type != bfd_link_hash_new)
+- {
+- row = UNDEF_ROW;
+- cycle = TRUE;
+- }
++ /* If the indirect symbol has been referenced, we need to
++ push the reference down to the symbol we are referencing. */
++ if (h->type != bfd_link_hash_new)
++ {
++ /* ??? If inh->type == bfd_link_hash_undefweak this
++ converts inh to bfd_link_hash_undefined. */
++ row = UNDEF_ROW;
++ cycle = TRUE;
++ }
+
+- h->type = bfd_link_hash_indirect;
+- h->u.i.link = inh;
+- }
++ h->type = bfd_link_hash_indirect;
++ h->u.i.link = inh;
++ /* Not setting h = h->u.i.link here means that when cycle is
++ set above we'll always go to REFC, and then cycle again
++ to the indirected symbol. This means that any successful
++ change of an existing symbol to indirect counts as a
++ reference. ??? That may not be correct when the existing
++ symbol was defweak. */
+ break;
+
+ case SET:
+diff --git a/include/bfdlink.h b/include/bfdlink.h
+index 58dba2a..125683d 100644
+--- a/include/bfdlink.h
++++ b/include/bfdlink.h
+@@ -640,15 +640,14 @@ struct bfd_link_callbacks
+ (struct bfd_link_info *, const char *name,
+ bfd *abfd, asection *section, bfd_vma address);
+ /* A function which is called when a symbol in notice_hash is
+- defined or referenced. H is the symbol. ABFD, SECTION and
+- ADDRESS are the (new) value of the symbol. If SECTION is
+- bfd_und_section, this is a reference. FLAGS are the symbol
+- BSF_* flags. STRING is the name of the symbol to indirect to if
+- the sym is indirect, or the warning string if a warning sym. */
++ defined or referenced. H is the symbol, INH the indirect symbol
++ if applicable. ABFD, SECTION and ADDRESS are the (new) value of
++ the symbol. If SECTION is bfd_und_section, this is a reference.
++ FLAGS are the symbol BSF_* flags. */
+ bfd_boolean (*notice)
+ (struct bfd_link_info *, struct bfd_link_hash_entry *h,
+- bfd *abfd, asection *section, bfd_vma address, flagword flags,
+- const char *string);
++ struct bfd_link_hash_entry *inh,
++ bfd *abfd, asection *section, bfd_vma address, flagword flags);
+ /* Error or warning link info message. */
+ void (*einfo)
+ (const char *fmt, ...);
+diff --git a/ld/ldmain.c b/ld/ldmain.c
+index ea25afe..77235d5 100644
+--- a/ld/ldmain.c
++++ b/ld/ldmain.c
+@@ -137,7 +137,7 @@ static bfd_boolean unattached_reloc
+ (struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma);
+ static bfd_boolean notice
+ (struct bfd_link_info *, struct bfd_link_hash_entry *,
+- bfd *, asection *, bfd_vma, flagword, const char *);
++ struct bfd_link_hash_entry *, bfd *, asection *, bfd_vma, flagword);
+
+ static struct bfd_link_callbacks link_callbacks =
+ {
+@@ -1461,11 +1461,11 @@ unattached_reloc (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ static bfd_boolean
+ notice (struct bfd_link_info *info,
+ struct bfd_link_hash_entry *h,
++ struct bfd_link_hash_entry *inh ATTRIBUTE_UNUSED,
+ bfd *abfd,
+ asection *section,
+ bfd_vma value,
+- flagword flags ATTRIBUTE_UNUSED,
+- const char *string ATTRIBUTE_UNUSED)
++ flagword flags ATTRIBUTE_UNUSED)
+ {
+ const char *name;
+
+diff --git a/ld/plugin.c b/ld/plugin.c
+index 8d6ae05..8cca7d0 100644
+--- a/ld/plugin.c
++++ b/ld/plugin.c
+@@ -127,8 +127,9 @@ static const size_t tv_header_size = ARRAY_SIZE (tv_header_tags);
+
+ /* Forward references. */
+ static bfd_boolean plugin_notice (struct bfd_link_info *,
+- struct bfd_link_hash_entry *, bfd *,
+- asection *, bfd_vma, flagword, const char *);
++ struct bfd_link_hash_entry *,
++ struct bfd_link_hash_entry *,
++ bfd *, asection *, bfd_vma, flagword);
+
+ #if !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H)
+
+@@ -962,16 +963,21 @@ plugin_call_cleanup (void)
+ static bfd_boolean
+ plugin_notice (struct bfd_link_info *info,
+ struct bfd_link_hash_entry *h,
++ struct bfd_link_hash_entry *inh,
+ bfd *abfd,
+ asection *section,
+ bfd_vma value,
+- flagword flags,
+- const char *string)
++ flagword flags)
+ {
++ struct bfd_link_hash_entry *orig_h = h;
++
+ if (h != NULL)
+ {
+ bfd *sym_bfd;
+
++ if (h->type == bfd_link_hash_warning)
++ h = h->u.i.link;
++
+ /* Nothing to do here if this def/ref is from an IR dummy BFD. */
+ if (is_ir_dummy_bfd (abfd))
+ ;
+@@ -981,16 +987,15 @@ plugin_notice (struct bfd_link_info *info,
+ else if (bfd_is_ind_section (section)
+ || (flags & BSF_INDIRECT) != 0)
+ {
++ /* ??? Some of this is questionable. See comments in
++ _bfd_generic_link_add_one_symbol for case IND. */
+ if (h->type != bfd_link_hash_new)
+ {
+- struct bfd_link_hash_entry *inh;
+-
+ h->non_ir_ref = TRUE;
+- inh = bfd_wrapped_link_hash_lookup (abfd, info, string, FALSE,
+- FALSE, FALSE);
+- if (inh != NULL)
+- inh->non_ir_ref = TRUE;
++ inh->non_ir_ref = TRUE;
+ }
++ else if (inh->type == bfd_link_hash_new)
++ inh->non_ir_ref = TRUE;
+ }
+
+ /* Nothing to do here for warning symbols. */
+@@ -1031,13 +1036,13 @@ plugin_notice (struct bfd_link_info *info,
+ }
+
+ /* Continue with cref/nocrossref/trace-sym processing. */
+- if (h == NULL
++ if (orig_h == NULL
+ || orig_notice_all
+ || (info->notice_hash != NULL
+- && bfd_hash_lookup (info->notice_hash, h->root.string,
++ && bfd_hash_lookup (info->notice_hash, orig_h->root.string,
+ FALSE, FALSE) != NULL))
+- return (*orig_callbacks->notice) (info, h,
+- abfd, section, value, flags, string);
++ return (*orig_callbacks->notice) (info, orig_h, inh,
++ abfd, section, value, flags);
+ return TRUE;
+ }
+
+--
+1.9.3
+
diff --git a/cross-binutils.spec b/cross-binutils.spec
index 97d2577..3e4267e 100644
--- a/cross-binutils.spec
+++ b/cross-binutils.spec
@@ -48,7 +48,7 @@
Summary: A GNU collection of cross-compilation binary utilities
Name: %{cross}-binutils
Version: 2.24
-Release: 6%{?dist}
+Release: 7%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@@ -56,12 +56,12 @@ URL: http://sources.redhat.com/binutils
# Note - the Linux Kernel binutils releases are too unstable and contain too
# many controversial patches so we stick with the official FSF version
# instead.
-Source: http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2
+Source: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.bz2
Source2: binutils-2.19.50.0.1-output-format.sed
# Bring up to date with what's in the git release branch
-Patch00: binutils-2.24-cab6c3ee9785f072a373afe31253df0451db93cf.patch
+Patch00: binutils-2.24-cde98f8566e14f52b896abc92c357cdd14717505.patch
Patch01: binutils-2.20.51.0.2-libtool-lib64.patch
Patch02: binutils-2.20.51.0.10-ppc64-pie.patch
@@ -93,6 +93,19 @@ Patch17: binutils-2.24-set-section-macros.patch
Patch18: binutils-2.24-fake-zlib-sections.patch
# Fix detections little endian PPC shared libraries
Patch19: binutils-2.24-ldforcele.patch
+Patch20: binutils-2.24-arm-static-tls.patch
+Patch21: binutils-2.24-fat-lto-objects.patch
+Patch22: binutils-2.24-symbol-warning.patch
+Patch23: binutils-2.24-aarch64-ld-shared-non-PIC-xfail.patch
+Patch24: binutils-2.24-weak-sym-merge.patch
+Patch25: binutils-2.24-indirect-chain.patch
+Patch26: binutils-2.24-aarch64-fix-final_link_relocate.patch
+Patch27: binutils-2.24-aarch64-fix-gotplt-offset-ifunc.patch
+Patch28: binutils-2.24-aarch64-fix-static-ifunc.patch
+Patch29: binutils-2.24-aarch64-fix-ie-relax.patch
+Patch30: binutils-HEAD-change-ld-notice-interface.patch
+Patch31: binutils-2.24-corrupt-binaries.patch
+Patch32: binutils-2.24-strings-default-all.patch
# Fix formatless sprintfs in Score-specific code.
Patch100: cross-binutils-2.24-score-sprintf.patch
@@ -226,11 +239,24 @@ cd %{srcdir}
%patch12 -p0 -b .kernel-ld-r~
%patch13 -p0 -b .aarch64~
%patch14 -p0 -b .mkopc~
-#%patch15 -p0 -b .elf-aarch64~
+%patch15 -p0 -b .elf-aarch64~
%patch16 -p0 -b .ref-addr~
%patch17 -p0 -b .sec-macros~
%patch18 -p0 -b .fake-zlib~
%patch19 -p0 -b .ldforcele~
+%patch20 -p1 -b .armstatictls~
+%patch21 -p1 -b .fatlto~
+%patch22 -p1 -b .symwarn~
+%patch23 -p1 -b .ld-aarch64-xfails~
+#%patch24 -p0 -b .weak-sym-merge~ # in patch 00
+#%patch25 -p0 -b .indirect-chain~ # in patch 00
+#%patch26 -p1 -b .aa64-final-link~ # in patch 00
+#%patch27 -p1 -b .aa64-1~ # in patch 00
+#%patch28 -p1 -b .aa64-2~ # in patch 00
+#%patch29 -p1 -b .aa64-3~ # in patch 00
+%patch30 -p1 -b .ldplugin~
+%patch31 -p0 -b .corrupt-binaries~
+%patch32 -p0 -b .strings-all~
%patch100 -p1 -b .score~
%patch101 -p0 -b .kernel-ld-r-fix~
More information about the scm-commits
mailing list