import binutils-2.30-90.el8

This commit is contained in:
CentOS Sources 2021-03-30 10:49:57 -04:00 committed by Stepan Oksanichenko
parent b931a56fce
commit 3b7530658a
11 changed files with 119544 additions and 84 deletions

View File

@ -30,7 +30,6 @@ diff -rup binutils.orig/bfd/elf-bfd.h binutils-2.30/bfd/elf-bfd.h
/* The linker may need to keep track of the number of relocs that it
decides to copy as dynamic relocs in check_relocs for each symbol.
Only in binutils-2.30/bfd: elf-bfd.h.orig
diff -rup binutils.orig/bfd/elf-properties.c binutils-2.30/bfd/elf-properties.c
--- binutils.orig/bfd/elf-properties.c 2020-04-07 11:32:17.280776377 +0100
+++ binutils-2.30/bfd/elf-properties.c 2020-04-07 13:34:03.899784089 +0100
@ -572,7 +571,6 @@ diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
/* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME
segment. */
eh_frame_hdr = elf_eh_frame_hdr (abfd);
Only in binutils-2.30/bfd: elf.c.orig
diff -rup binutils.orig/bfd/elfxx-target.h binutils-2.30/bfd/elfxx-target.h
--- binutils.orig/bfd/elfxx-target.h 2020-04-07 11:32:17.267776472 +0100
+++ binutils-2.30/bfd/elfxx-target.h 2020-04-07 13:34:03.899784089 +0100
@ -594,7 +592,6 @@ diff -rup binutils.orig/bfd/elfxx-target.h binutils-2.30/bfd/elfxx-target.h
elf_backend_compact_eh_encoding,
elf_backend_cant_unwind_opcode,
elf_backend_init_secondary_reloc_section,
Only in binutils-2.30/bfd: elfxx-target.h.orig
diff -rup binutils.orig/bfd/elfxx-x86.c binutils-2.30/bfd/elfxx-x86.c
--- binutils.orig/bfd/elfxx-x86.c 2020-04-07 11:32:17.271776442 +0100
+++ binutils-2.30/bfd/elfxx-x86.c 2020-04-07 13:34:03.899784089 +0100
@ -1377,7 +1374,6 @@ diff -rup binutils.orig/binutils/readelf.c binutils-2.30/binutils/readelf.c
default:
/* Handle unrecognised types. An error message should have already been
created by get_gnu_elf_note_type(), so all that we need to do is to
Only in binutils-2.30/binutils: readelf.c.orig
diff -rup binutils.orig/binutils/testsuite/binutils-all/i386/empty.d binutils-2.30/binutils/testsuite/binutils-all/i386/empty.d
--- binutils.orig/binutils/testsuite/binutils-all/i386/empty.d 2020-04-07 11:32:17.248776609 +0100
+++ binutils-2.30/binutils/testsuite/binutils-all/i386/empty.d 2020-04-07 13:34:03.901784074 +0100
@ -1781,8 +1777,6 @@ diff -rup binutils.orig/gas/config/tc-i386.c binutils-2.30/gas/config/tc-i386.c
#endif
#if (defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) \
|| defined (TE_PE) || defined (TE_PEP))
Only in binutils-2.30/gas/config: tc-i386.c.orig
Only in binutils-2.30/gas/config: tc-i386.c.rej
diff -rup binutils.orig/gas/config/tc-i386.h binutils-2.30/gas/config/tc-i386.h
--- binutils.orig/gas/config/tc-i386.h 2020-04-07 11:32:17.526774588 +0100
+++ binutils-2.30/gas/config/tc-i386.h 2020-04-07 13:34:03.904784053 +0100
@ -1798,7 +1792,6 @@ diff -rup binutils.orig/gas/config/tc-i386.h binutils-2.30/gas/config/tc-i386.h
#ifdef TE_PE
#define O_secrel O_md1
Only in binutils-2.30/gas/config: tc-i386.h.orig
diff -rup binutils.orig/gas/config.in binutils-2.30/gas/config.in
--- binutils.orig/gas/config.in 2020-04-07 11:32:17.532774544 +0100
+++ binutils-2.30/gas/config.in 2020-04-07 13:34:03.904784053 +0100
@ -1913,16 +1906,11 @@ diff -rup binutils.orig/gas/testsuite/gas/i386/i386.exp binutils-2.30/gas/testsu
}
+ run_dump_test "property-1"
+ run_dump_test "property-2"
+ # run_dump_test "property-2"
+
if { [gas_64_check] } then {
run_dump_test "att-regs"
run_dump_test "intel-regs"
Only in binutils-2.30/gas/testsuite/gas/i386: i386.exp.orig
Only in binutils-2.30/gas/testsuite/gas/i386: property-1.d
Only in binutils-2.30/gas/testsuite/gas/i386: property-1.s
Only in binutils-2.30/gas/testsuite/gas/i386: property-2.d
Only in binutils-2.30/gas/testsuite/gas/i386: property-2.s
diff -rup binutils.orig/include/bfdlink.h binutils-2.30/include/bfdlink.h
--- binutils.orig/include/bfdlink.h 2020-04-07 11:32:17.506774733 +0100
+++ binutils-2.30/include/bfdlink.h 2020-04-07 13:34:03.906784038 +0100
@ -2157,14 +2145,6 @@ diff -rup binutils.orig/ld/testsuite/ld-elf/elf.exp binutils-2.30/ld/testsuite/l
}
set LDFLAGS $old_ldflags
Only in binutils-2.30/ld/testsuite/ld-elf: pr23900-1-32.rd
Only in binutils-2.30/ld/testsuite/ld-elf: pr23900-1-64.rd
Only in binutils-2.30/ld/testsuite/ld-elf: pr23900-1.d
Only in binutils-2.30/ld/testsuite/ld-elf: pr23900-1.s
Only in binutils-2.30/ld/testsuite/ld-elf: pr23900-2.s
Only in binutils-2.30/ld/testsuite/ld-elf: pr23900-2a.d
Only in binutils-2.30/ld/testsuite/ld-elf: pr23900-2b.d
Only in binutils-2.30/ld/testsuite/ld-elf: stack-noexec.rd
diff -rup binutils.orig/ld/testsuite/ld-i386/ibt-plt-1.d binutils-2.30/ld/testsuite/ld-i386/ibt-plt-1.d
--- binutils.orig/ld/testsuite/ld-i386/ibt-plt-1.d 2020-04-07 11:32:17.358775810 +0100
+++ binutils-2.30/ld/testsuite/ld-i386/ibt-plt-1.d 2020-04-07 13:34:03.907784031 +0100
@ -3556,3 +3536,275 @@ diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-x86-shstk3b.d binutils-2
+ Properties: x86 ISA needed: i486, 586, SSE2, SSE3
+ x86 ISA used: <None>
+ x86 feature used: x86
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/property-1.s 2020-08-20 15:44:27.696983474 +0100
@@ -0,0 +1,30 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length. */
+ .long 3f - 1f /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .long 5 /* note type. */
+0:
+ .asciz "GNU" /* vendor name. */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ /* GNU_PROPERTY_X86_ISA_1_USED */
+ .long 0xc0010000 /* pr_type. */
+ .long 5f - 4f /* pr_datasz. */
+4:
+ .long 0
+5:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+3:
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/property-1.d 2020-08-20 15:44:27.696983474 +0100
@@ -0,0 +1,8 @@
+#name: i386 property 1
+#as: -mx86-used-note=no --generate-missing-build-notes=no
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: <None>
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/property-2.d 2020-08-20 15:44:34.770964195 +0100
@@ -0,0 +1,9 @@
+#name: i386 property 2
+#as: -mx86-used-note=yes --generate-missing-build-notes=no
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: CMOV, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, AVX, AVX2, FMA, AVX512F, AVX512CD, AVX512ER, AVX512PF, AVX512VL, AVX512DQ, AVX512BW, AVX512_4FMAPS, AVX512_4VNNIW, AVX512_BITALG, AVX512_IFMA, AVX512_VBMI, AVX512_VBMI2, AVX512_VNNI, AVX512_BF16
+ x86 feature used: x86, x87, MMX, XMM, YMM, ZMM, FXSR, XSAVE, XSAVEOPT, XSAVEC
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/property-2.s 2020-08-20 15:44:34.770964195 +0100
@@ -0,0 +1,32 @@
+ .text
+ fsin
+ movq %mm0, %mm1
+ fxsave (%eax)
+ xsave (%eax)
+ xsaveopt (%eax)
+ xsavec (%eax)
+ cmove %eax,%ebx
+ movaps %xmm0, %xmm1
+ movapd %xmm0, %xmm1
+ mwait
+ psignb %xmm0, %xmm1
+ blendvpd %xmm0, %xmm1
+ pcmpgtq %xmm0, %xmm1
+ vmovaps %xmm0, %xmm1
+ vpabsb %ymm0, %ymm1
+ vfmadd231ps %ymm0, %ymm1, %ymm1
+ vmovaps %zmm0, %zmm1
+ vplzcntd %zmm0, %zmm1
+ vrsqrt28pd %zmm0, %zmm1
+ vscatterpf0dpd (%eax,%ymm1){%k1}
+ {evex} vpmovzxdq %xmm0, %xmm1
+ vandnpd %zmm0, %zmm0, %zmm1
+ vpmaxuw %zmm0, %zmm0, %zmm1
+ v4fnmaddss (%ecx), %xmm4, %xmm1
+ vpopcntb %zmm0, %zmm1
+ vp4dpwssd (%ecx), %zmm0, %zmm1
+ vpmadd52luq (%ecx), %zmm0, %zmm1
+ vpermt2b (%ecx), %zmm0, %zmm1
+ vpcompressb %zmm0, %zmm1
+ vpdpwssds (%ecx), %zmm0, %zmm1
+ vcvtne2ps2bf16 (%ecx), %zmm0, %zmm1
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/pr23900-1-32.rd 2020-08-20 15:46:11.850699543 +0100
@@ -0,0 +1,14 @@
+#source: pr23900-1.s
+#ld:
+#readelf: -l --wide
+#target: *-*-linux* *-*-gnu* *-*-nacl*
+
+#...
+ GNU_PROPERTY .* +0x4
+#...
+ +[0-9]+ +.*\ \.note\.gnu\.property .*
+#...
+ +[0-9]+ +\.note\.gnu\.property
+#...
+ +[0-9]+ +\.note\.gnu\.property
+#...
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/pr23900-1-64.rd 2020-08-20 15:46:16.968685596 +0100
@@ -0,0 +1,14 @@
+#source: pr23900-1.s
+#ld:
+#readelf: -l --wide
+#target: *-*-linux* *-*-gnu* *-*-nacl*
+
+#...
+ GNU_PROPERTY .* +0x8
+#...
+ +[0-9]+ +.*\ \.note\.gnu\.property .*
+#...
+ +[0-9]+ +\.note\.gnu\.property
+#...
+ +[0-9]+ +\.note\.gnu\.property
+#...
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/pr23900-1.d 2020-08-20 15:46:26.546659490 +0100
@@ -0,0 +1,16 @@
+#ld:
+#readelf: --notes --wide -l
+#target: *-*-linux* *-*-gnu* *-*-nacl*
+
+#...
+ GNU_PROPERTY .*
+#...
+ +[0-9]+ +.*\.note\.gnu\.property.*
+#...
+ +[0-9]+ +\.note\.gnu\.property
+#...
+ +[0-9]+ +\.note\.gnu\.property
+#...
+Displaying notes found in: \.note\.gnu\.property
+[ ]+Owner[ ]+Data size[ ]+Description
+[ ]+GNU[ ]+0x0+..[ ]+NT_GNU_PROPERTY_TYPE_0[ ]+Properties: no copy on protected
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/pr23900-1.s 2020-08-20 15:46:30.072649878 +0100
@@ -0,0 +1,30 @@
+ .text
+ .global start /* Used by SH targets. */
+start:
+ .global _start
+_start:
+ .global __start
+__start:
+ .global main /* Used by HPPA targets. */
+main:
+ .globl _main /* Used by LynxOS targets. */
+_main:
+ .dc.a 0
+
+ .section .note.gnu.property, "a"
+ .p2align ALIGN
+ .dc.l .L1 - .L0 /* name length. */
+ .dc.l .L3 - .L1 /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .dc.l 5 /* note type. */
+.L0:
+ .asciz "GNU" /* vendor name. */
+.L1:
+ .p2align ALIGN
+ /* GNU_PROPERTY_NO_COPY_ON_PROTECTED */
+ .dc.l 2 /* pr_type. */
+ .dc.l .L5 - .L4 /* pr_datasz. */
+.L4:
+.L5:
+ .p2align ALIGN
+.L3:
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/pr23900-2.s 2020-08-20 15:46:36.328632828 +0100
@@ -0,0 +1,32 @@
+ .text
+ .global start /* Used by SH targets. */
+start:
+ .global _start
+_start:
+ .global __start
+__start:
+ .global main /* Used by HPPA targets. */
+main:
+ .globl _main /* Used by LynxOS targets. */
+_main:
+ .dc.a 0
+
+ /* NB: Deliberately incorrect section name. Should be
+ .note.gnu.property. */
+ .section .note, "a"
+ .p2align ALIGN
+ .dc.l .L1 - .L0 /* name length. */
+ .dc.l .L3 - .L1 /* data length. */
+ /* NT_GNU_PROPERTY_TYPE_0 */
+ .dc.l 5 /* note type. */
+.L0:
+ .asciz "GNU" /* vendor name. */
+.L1:
+ .p2align ALIGN
+ /* GNU_PROPERTY_NO_COPY_ON_PROTECTED */
+ .dc.l 2 /* pr_type. */
+ .dc.l .L5 - .L4 /* pr_datasz. */
+.L4:
+.L5:
+ .p2align ALIGN
+.L3:
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/pr23900-2a.d 2020-08-20 15:46:42.642615623 +0100
@@ -0,0 +1,9 @@
+#source: pr23900-2.s
+#ld:
+#readelf: --notes --wide
+#target: *-*-linux* *-*-gnu* *-*-nacl*
+
+#...
+Displaying notes found in: \.note
+[ ]+Owner[ ]+Data size[ ]+Description
+[ ]+GNU[ ]+0x0+..[ ]+NT_GNU_PROPERTY_TYPE_0[ ]+Properties: no copy on protected
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/pr23900-2b.d 2020-08-20 15:46:48.738599006 +0100
@@ -0,0 +1,9 @@
+#source: pr23900-2.s
+#ld:
+#readelf: -l --wide
+#target: *-*-linux* *-*-gnu* *-*-nacl*
+
+#failif
+#...
+ GNU_PROPERTY .*
+#...
--- /dev/null 2020-08-20 07:54:24.260993139 +0100
+++ binutils-2.30/ld/testsuite/ld-elf/stack-noexec.rd 2020-08-20 15:46:59.907568567 +0100
@@ -0,0 +1,3 @@
+#...
+ GNU_STACK 0x0+00000 0x0+000000 0x0+000000 0x0+000 0x.+0000 RW 0x[0-9a-f]+
+#pass
diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-3.r binutils-2.30/ld/testsuite/ld-x86-64/property-3.r
--- binutils.orig/ld/testsuite/ld-x86-64/property-3.r 2020-08-21 10:21:01.138676431 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/property-3.r 2020-08-21 10:47:30.373599165 +0100
@@ -3,5 +3,5 @@ Displaying notes found in: .note.gnu.pro
Owner Data size Description
GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
Properties: stack size: 0x800000
- x86 ISA needed: i486, 586
+ x86 ISA needed: i486, 58.*
#pass
diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-4.r binutils-2.30/ld/testsuite/ld-x86-64/property-4.r
--- binutils.orig/ld/testsuite/ld-x86-64/property-4.r 2020-08-21 10:21:01.122676481 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/property-4.r 2020-08-21 10:49:39.940182100 +0100
@@ -3,5 +3,5 @@ Displaying notes found in: .note.gnu.pro
Owner Data size Description
GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
Properties: stack size: 0x800000
- x86 ISA needed: i486, 586, SSE
+ x86 ISA needed: i486, 586, SS.*
#pass
diff -rup binutils.orig/ld/testsuite/ld-x86-64/property-5.r binutils-2.30/ld/testsuite/ld-x86-64/property-5.r
--- binutils.orig/ld/testsuite/ld-x86-64/property-5.r 2020-08-21 10:21:01.127676465 +0100
+++ binutils-2.30/ld/testsuite/ld-x86-64/property-5.r 2020-08-21 10:50:06.198097582 +0100
@@ -3,5 +3,5 @@ Displaying notes found in: .note.gnu.pro
Owner Data size Description
GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
Properties: stack size: 0x900000
- x86 ISA needed: i486, 586, SSE
+ x86 ISA needed: i486, 586, SS.*
#pass

View File

@ -0,0 +1,547 @@
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2020-11-04 14:53:52.144476367 +0000
+++ binutils-2.30/bfd/elfnn-aarch64.c 2020-11-04 14:56:42.275422499 +0000
@@ -2191,6 +2191,9 @@ struct elf_aarch64_obj_tdata
/* Zero to warn when linking objects with incompatible wchar_t sizes. */
int no_wchar_size_warning;
+
+ /* All GNU_PROPERTY_AARCH64_FEATURE_1_AND properties. */
+ uint32_t gnu_and_prop;
};
#define elf_aarch64_tdata(bfd) \
@@ -9311,6 +9314,32 @@ elfNN_aarch64_backend_symbol_processing
sym->flags |= BSF_KEEP;
}
+/* Implement elf_backend_setup_gnu_properties for AArch64. It serves as a
+ wrapper function for _bfd_aarch64_elf_link_setup_gnu_properties to account
+ for the effect of GNU properties of the output_bfd. */
+static bfd *
+elfNN_aarch64_link_setup_gnu_properties (struct bfd_link_info *info)
+{
+ uint32_t prop = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+ bfd *pbfd = _bfd_aarch64_elf_link_setup_gnu_properties (info, &prop);
+ elf_aarch64_tdata (info->output_bfd)->gnu_and_prop = prop;
+ return pbfd;
+}
+
+/* Implement elf_backend_merge_gnu_properties for AArch64. It serves as a
+ wrapper function for _bfd_aarch64_elf_merge_gnu_properties to account
+ for the effect of GNU properties of the output_bfd. */
+static bfd_boolean
+elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
+ bfd *abfd,
+ elf_property *aprop,
+ elf_property *bprop)
+{
+ uint32_t prop
+ = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+ return _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop,
+ bprop, prop);
+}
/* We use this so we can override certain functions
(though currently we don't). */
@@ -9453,6 +9482,12 @@ const struct elf_size_info elfNN_aarch64
#define elf_backend_symbol_processing \
elfNN_aarch64_backend_symbol_processing
+#define elf_backend_setup_gnu_properties \
+ elfNN_aarch64_link_setup_gnu_properties
+
+#define elf_backend_merge_gnu_properties \
+ elfNN_aarch64_merge_gnu_properties
+
#define elf_backend_can_refcount 1
#define elf_backend_can_gc_sections 1
#define elf_backend_plt_readonly 1
diff -rup binutils.orig/bfd/elfxx-aarch64.c binutils-2.30/bfd/elfxx-aarch64.c
--- binutils.orig/bfd/elfxx-aarch64.c 2020-11-04 14:53:52.138476401 +0000
+++ binutils-2.30/bfd/elfxx-aarch64.c 2020-11-04 14:56:42.276422492 +0000
@@ -660,3 +660,183 @@ _bfd_aarch64_elf_write_core_note (bfd *a
}
}
}
+
+/* Find the first input bfd with GNU property and merge it with GPROP. If no
+ such input is found, add it to a new section at the last input. Update
+ GPROP accordingly. */
+bfd *
+_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
+ uint32_t *gprop)
+{
+ asection *sec;
+ bfd *pbfd;
+ bfd *ebfd = NULL;
+ elf_property *prop;
+
+ uint32_t gnu_prop = *gprop;
+
+ /* Find a normal input file with GNU property note. */
+ for (pbfd = info->input_bfds;
+ pbfd != NULL;
+ pbfd = pbfd->link.next)
+ if (bfd_get_flavour (pbfd) == bfd_target_elf_flavour
+ && bfd_count_sections (pbfd) != 0)
+ {
+ ebfd = pbfd;
+
+ if (elf_properties (pbfd) != NULL)
+ break;
+ }
+
+ /* If ebfd != NULL it is either an input with property note or the last
+ input. Either way if we have gnu_prop, we should add it (by creating
+ a section if needed). */
+ if (ebfd != NULL && gnu_prop)
+ {
+ prop = _bfd_elf_get_property (ebfd,
+ GNU_PROPERTY_AARCH64_FEATURE_1_AND,
+ 4);
+ prop->u.number |= gnu_prop;
+ prop->pr_kind = property_number;
+
+ /* pbfd being NULL implies ebfd is the last input. Create the GNU
+ property note section. */
+ if (pbfd == NULL)
+ {
+ sec = bfd_make_section_with_flags (ebfd,
+ NOTE_GNU_PROPERTY_SECTION_NAME,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_IN_MEMORY
+ | SEC_READONLY
+ | SEC_HAS_CONTENTS
+ | SEC_DATA));
+ if (sec == NULL)
+ info->callbacks->einfo (
+ _("%F%P: failed to create GNU property section\n"));
+
+ elf_section_type (sec) = SHT_NOTE;
+ }
+ }
+
+ pbfd = _bfd_elf_link_setup_gnu_properties (info);
+
+ if (bfd_link_relocatable (info))
+ return pbfd;
+
+ /* If pbfd has any GNU_PROPERTY_AARCH64_FEATURE_1_AND properties, update
+ gnu_prop accordingly. */
+ if (pbfd != NULL)
+ {
+ elf_property_list *p;
+
+ /* The property list is sorted in order of type. */
+ for (p = elf_properties (pbfd); p; p = p->next)
+ {
+ /* Check for all GNU_PROPERTY_AARCH64_FEATURE_1_AND. */
+ if (GNU_PROPERTY_AARCH64_FEATURE_1_AND == p->property.pr_type)
+ {
+ gnu_prop = (p->property.u.number
+ & (GNU_PROPERTY_AARCH64_FEATURE_1_PAC
+ | GNU_PROPERTY_AARCH64_FEATURE_1_BTI));
+ break;
+ }
+ else if (GNU_PROPERTY_AARCH64_FEATURE_1_AND < p->property.pr_type)
+ break;
+ }
+ }
+ *gprop = gnu_prop;
+ return pbfd;
+}
+
+/* Define elf_backend_parse_gnu_properties for AArch64. */
+enum elf_property_kind
+_bfd_aarch64_elf_parse_gnu_properties (bfd *abfd, unsigned int type,
+ bfd_byte *ptr, unsigned int datasz)
+{
+ elf_property *prop;
+
+ switch (type)
+ {
+ case GNU_PROPERTY_AARCH64_FEATURE_1_AND:
+ if (datasz != 4)
+ {
+ _bfd_error_handler
+ ( _("error: %pB: <corrupt AArch64 used size: 0x%x>"),
+ abfd, datasz);
+ return property_corrupt;
+ }
+ prop = _bfd_elf_get_property (abfd, type, datasz);
+ /* Combine properties of the same type. */
+ prop->u.number |= bfd_h_get_32 (abfd, ptr);
+ prop->pr_kind = property_number;
+ break;
+
+ default:
+ return property_ignored;
+ }
+
+ return property_number;
+}
+
+/* Merge AArch64 GNU property BPROP with APROP also accounting for PROP.
+ If APROP isn't NULL, merge it with BPROP and/or PROP. Vice-versa if BROP
+ isn't NULL. Return TRUE if there is any update to APROP or if BPROP should
+ be merge with ABFD. */
+bfd_boolean
+_bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *info
+ ATTRIBUTE_UNUSED,
+ bfd *abfd ATTRIBUTE_UNUSED,
+ elf_property *aprop,
+ elf_property *bprop,
+ uint32_t prop)
+{
+ unsigned int orig_number;
+ bfd_boolean updated = FALSE;
+ unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
+
+ switch (pr_type)
+ {
+ case GNU_PROPERTY_AARCH64_FEATURE_1_AND:
+ {
+ if (aprop != NULL && bprop != NULL)
+ {
+ orig_number = aprop->u.number;
+ aprop->u.number = (orig_number & bprop->u.number) | prop;
+ updated = orig_number != aprop->u.number;
+ /* Remove the property if all feature bits are cleared. */
+ if (aprop->u.number == 0)
+ aprop->pr_kind = property_remove;
+ break;
+ }
+ /* If either is NULL, the AND would be 0 so, if there is
+ any PROP, asign it to the input that is not NULL. */
+ if (prop)
+ {
+ if (aprop != NULL)
+ {
+ orig_number = aprop->u.number;
+ aprop->u.number = prop;
+ updated = orig_number != aprop->u.number;
+ }
+ else
+ {
+ bprop->u.number = prop;
+ updated = TRUE;
+ }
+ }
+ /* No PROP and BPROP is NULL, so remove APROP. */
+ else if (aprop != NULL)
+ {
+ aprop->pr_kind = property_remove;
+ updated = TRUE;
+ }
+ }
+ break;
+
+ default:
+ abort ();
+ }
+
+ return updated;
+}
diff -rup binutils.orig/bfd/elfxx-aarch64.h binutils-2.30/bfd/elfxx-aarch64.h
--- binutils.orig/bfd/elfxx-aarch64.h 2020-11-04 14:53:52.134476424 +0000
+++ binutils-2.30/bfd/elfxx-aarch64.h 2020-11-04 14:56:42.276422492 +0000
@@ -65,3 +65,19 @@ _bfd_aarch64_elf_write_core_note (bfd *,
#define elf_backend_grok_prstatus _bfd_aarch64_elf_grok_prstatus
#define elf_backend_grok_psinfo _bfd_aarch64_elf_grok_psinfo
#define elf_backend_write_core_note _bfd_aarch64_elf_write_core_note
+
+extern bfd *
+_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *,
+ uint32_t *);
+
+extern enum elf_property_kind
+_bfd_aarch64_elf_parse_gnu_properties (bfd *, unsigned int,
+ bfd_byte *, unsigned int);
+
+extern bfd_boolean
+_bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *, bfd *,
+ elf_property *, elf_property *,
+ uint32_t);
+
+#define elf_backend_parse_gnu_properties \
+ _bfd_aarch64_elf_parse_gnu_properties
diff -rup binutils.orig/binutils/readelf.c binutils-2.30/binutils/readelf.c
--- binutils.orig/binutils/readelf.c 2020-11-04 14:53:51.723478764 +0000
+++ binutils-2.30/binutils/readelf.c 2020-11-04 14:56:42.277422485 +0000
@@ -17103,6 +17103,33 @@ decode_x86_feature_2 (unsigned int bitma
}
static void
+decode_aarch64_feature_1_and (unsigned int bitmask)
+{
+ while (bitmask)
+ {
+ unsigned int bit = bitmask & (- bitmask);
+
+ bitmask &= ~ bit;
+ switch (bit)
+ {
+ case GNU_PROPERTY_AARCH64_FEATURE_1_BTI:
+ printf ("BTI");
+ break;
+
+ case GNU_PROPERTY_AARCH64_FEATURE_1_PAC:
+ printf ("PAC");
+ break;
+
+ default:
+ printf (_("<unknown: %x>"), bit);
+ break;
+ }
+ if (bitmask)
+ printf (", ");
+ }
+}
+
+static void
print_gnu_property_note (Filedata * filedata, Elf_Internal_Note * pnote)
{
unsigned char * ptr = (unsigned char *) pnote->descdata;
@@ -17236,6 +17263,18 @@ print_gnu_property_note (Filedata * file
break;
}
}
+ else if (filedata->file_header.e_machine == EM_AARCH64)
+ {
+ if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND)
+ {
+ printf ("AArch64 feature: ");
+ if (datasz != 4)
+ printf (_("<corrupt length: %#x> "), datasz);
+ else
+ decode_aarch64_feature_1_and (byte_get (ptr, 4));
+ goto next;
+ }
+ }
}
else
{
diff -rup binutils.orig/include/elf/common.h binutils-2.30/include/elf/common.h
--- binutils.orig/include/elf/common.h 2020-11-04 14:53:52.155476304 +0000
+++ binutils-2.30/include/elf/common.h 2020-11-04 14:56:42.277422485 +0000
@@ -832,6 +832,12 @@
#define GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT (1U << 8)
#define GNU_PROPERTY_X86_FEATURE_2_XSAVEC (1U << 9)
+/* AArch64 specific GNU PROPERTY. */
+#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
+
+#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0)
+#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1)
+
/* Values used in GNU .note.ABI-tag notes (NT_GNU_ABI_TAG). */
#define GNU_ABI_TAG_LINUX 0
#define GNU_ABI_TAG_HURD 1
diff -rup binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp binutils-2.30/ld/testsuite/ld-aarch64/aarch64-elf.exp
--- binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp 2020-11-04 14:53:51.843478081 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/aarch64-elf.exp 2020-11-04 14:56:42.278422479 +0000
@@ -337,6 +337,10 @@ run_dump_test_lp64 "variant_pcs-r"
run_dump_test_lp64 "variant_pcs-shared"
run_dump_test_lp64 "variant_pcs-now"
+run_dump_test "property-bti-pac1"
+run_dump_test "property-bti-pac2"
+run_dump_test "property-bti-pac3"
+
set aarch64elflinktests {
{"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
{} "copy-reloc-so.so"}
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,11 @@
+#name: GNU Property (single input, combine section)
+#source: property-bti-pac1.s
+#as: -march=armv8.5-a -defsym __mult__=0
+#ld: -shared
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI, PAC
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.s 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,37 @@
+ .text
+ .globl _start
+ .type _start,@function
+_start:
+ mov x1, #2
+.ifndef __mult__
+ bl foo
+.endif
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2 /* PAC. */
+4:
+ .p2align 3
+5:
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1 /* BTI. */
+4:
+ .p2align 3
+5:
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac2.s 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,50 @@
+ .text
+ .global foo
+ .type foo, %function
+foo:
+ sub sp, sp, #16
+ mov w0, 9
+ str w0, [sp, 12]
+ ldr w0, [sp, 12]
+ add w0, w0, 4
+ str w0, [sp, 12]
+ nop
+ add sp, sp, 16
+ ret
+ .size foo, .-foo
+ .global bar
+ .type bar, %function
+.ifdef __property_bti__
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1 /* BTI. */
+4:
+ .p2align 3
+5:
+.endif
+.ifdef __property_pac__
+ .section ".note.gnu.property", "a"
+ .p2align 3
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 3
+2: .long 0xc0000000 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2 /* PAC. */
+4:
+ .p2align 3
+5:
+.endif
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac2.d 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,12 @@
+#name: GNU Property (combine multiple with BTI)
+#source: property-bti-pac1.s
+#source: property-bti-pac2.s
+#as: -mabi=lp64 -defsym __property_bti__=1
+#ld: -e _start
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: BTI
--- /dev/null 2020-11-04 08:04:13.849482156 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac3.d 2020-11-04 14:56:42.278422479 +0000
@@ -0,0 +1,12 @@
+#name: GNU Property (combine multiple with PAC)
+#source: property-bti-pac1.s
+#source: property-bti-pac2.s
+#as: -mabi=lp64 -defsym __property_pac__=1
+#ld: -e _start
+#readelf: -n
+#target: *linux*
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: AArch64 feature: PAC
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
--- binutils.orig/bfd/elfnn-aarch64.c 2020-11-25 11:53:26.648275978 +0000
+++ binutils-2.30/bfd/elfnn-aarch64.c 2020-11-25 12:21:39.276864970 +0000
@@ -9331,12 +9331,14 @@ elfNN_aarch64_link_setup_gnu_properties
for the effect of GNU properties of the output_bfd. */
static bfd_boolean
elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
- bfd *abfd,
- elf_property *aprop,
- elf_property *bprop)
+ bfd *abfd,
+ bfd *bbfd ATTRIBUTE_UNUSED,
+ elf_property *aprop,
+ elf_property *bprop)
{
uint32_t prop
= elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+
return _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop,
bprop, prop);
}
diff -rup binutils.orig/bfd/elfxx-aarch64.c binutils-2.30/bfd/elfxx-aarch64.c
--- binutils.orig/bfd/elfxx-aarch64.c 2020-11-25 11:53:26.655275930 +0000
+++ binutils-2.30/bfd/elfxx-aarch64.c 2020-11-25 12:21:34.689895875 +0000
@@ -22,6 +22,7 @@
#include "elfxx-aarch64.h"
#include <stdarg.h>
#include <string.h>
+#include "libbfd.h"
#define MASK(n) ((1u << (n)) - 1)
@@ -835,7 +836,10 @@ _bfd_aarch64_elf_merge_gnu_properties (s
break;
default:
- abort ();
+ _bfd_error_handler
+ ( _("error: %pB: <corrupt AArch64 property note: 0x%x>"),
+ abfd, pr_type);
+ return FALSE;
}
return updated;
diff -rup binutils.orig/ld/testsuite/ld-aarch64/property-bti-pac1.d binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d
--- binutils.orig/ld/testsuite/ld-aarch64/property-bti-pac1.d 2020-11-25 11:53:26.344278044 +0000
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d 2020-11-25 11:57:53.179471900 +0000
@@ -1,6 +1,6 @@
#name: GNU Property (single input, combine section)
#source: property-bti-pac1.s
-#as: -march=armv8.5-a -defsym __mult__=0
+#as: -defsym __mult__=0
#ld: -shared
#readelf: -n
#target: *linux*

View File

@ -0,0 +1,29 @@
--- binutils.orig/bfd/elflink.c 2020-12-08 17:45:26.487260908 +0000
+++ binutils-2.30/bfd/elflink.c 2020-12-08 17:48:06.650728413 +0000
@@ -1895,7 +1895,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
if (skip)
goto nondefault;
- if (hi->def_regular)
+ if (hi->def_regular || ELF_COMMON_DEF_P (hi))
{
/* If the undecorated symbol will have a version added by a
script different to H, then don't indirect to/from the
@@ -2236,7 +2236,7 @@ _bfd_elf_link_assign_sym_version (struct
/* We only need version numbers for symbols defined in regular
objects. */
- if (!h->def_regular)
+ if (!h->def_regular && !ELF_COMMON_DEF_P (h))
return TRUE;
bed = get_elf_backend_data (info->output_bfd);
@@ -9957,7 +9957,7 @@ elf_link_output_extsym (struct bfd_hash_
Elf_Internal_Versym iversym;
Elf_External_Versym *eversym;
- if (!h->def_regular)
+ if (!h->def_regular && !ELF_COMMON_DEF_P (h))
{
if (h->verinfo.verdef == NULL
|| (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd)

View File

@ -0,0 +1,251 @@
diff -rup binutils.orig/include/bfdlink.h binutils-2.30/include/bfdlink.h
--- binutils.orig/include/bfdlink.h 2020-11-02 10:04:27.457826514 +0000
+++ binutils-2.30/include/bfdlink.h 2020-11-02 10:05:14.723537971 +0000
@@ -339,6 +339,9 @@ struct bfd_link_info
/* TRUE if the LTO plugin is active. */
unsigned int lto_plugin_active: 1;
+ /* TRUE if all LTO IR symbols have been read. */
+ unsigned int lto_all_symbols_read : 1;
+
/* TRUE if global symbols in discarded sections should be stripped. */
unsigned int strip_discarded: 1;
diff -rup binutils.orig/ld/ldlang.c binutils-2.30/ld/ldlang.c
--- binutils.orig/ld/ldlang.c 2020-11-02 10:04:16.852890551 +0000
+++ binutils-2.30/ld/ldlang.c 2020-11-02 10:06:12.285185841 +0000
@@ -7162,6 +7162,7 @@ lang_process (void)
if (plugin_call_all_symbols_read ())
einfo (_("%P%F: %s: plugin reported error after all symbols read\n"),
plugin_error_plugin ());
+ link_info.lto_all_symbols_read = TRUE;
/* Open any newly added files, updating the file chains. */
open_input_bfds (*added.tail, OPEN_BFD_NORMAL);
/* Restore the global list pointer now they have all been added. */
diff -rup binutils.orig/ld/plugin.c binutils-2.30/ld/plugin.c
--- binutils.orig/ld/plugin.c 2020-11-02 10:04:16.852890551 +0000
+++ binutils-2.30/ld/plugin.c 2020-11-02 10:08:11.010459546 +0000
@@ -1355,12 +1355,16 @@ plugin_notice (struct bfd_link_info *inf
new value from a real BFD. Weak symbols are not normally
overridden by a new weak definition, and strong symbols
will normally cause multiple definition errors. Avoid
- this by making the symbol appear to be undefined. */
- if (((h->type == bfd_link_hash_defweak
- || h->type == bfd_link_hash_defined)
- && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner))
- || (h->type == bfd_link_hash_common
- && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner)))
+ this by making the symbol appear to be undefined.
+
+ NB: We change the previous definition in the IR object to
+ undefweak only after all LTO symbols have been read. */
+ if (info->lto_all_symbols_read
+ && (((h->type == bfd_link_hash_defweak
+ || h->type == bfd_link_hash_defined)
+ && is_ir_dummy_bfd (sym_bfd = h->u.def.section->owner))
+ || (h->type == bfd_link_hash_common
+ && is_ir_dummy_bfd (sym_bfd = h->u.c.p->section->owner))))
{
h->type = bfd_link_hash_undefweak;
h->u.undef.abfd = sym_bfd;
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-11-02 10:04:16.926890104 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-11-02 10:12:09.551000288 +0000
@@ -214,6 +214,36 @@ set lto_link_tests [list \
[list "Build pr22502b.o" \
"$plug_opt" "-flto $lto_no_fat" \
{pr22502b.c}] \
+ [list "Build pr26262b.o" \
+ "" "-O2" \
+ {pr26262b.c} {} "" "c"] \
+ [list "Build pr26262c.o" \
+ "" "-O2" \
+ {pr26262c.c} {} "" "c"] \
+ [list "Build pr26267a.o" \
+ "" "-O2 -flto $lto_no_fat" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267b.o" \
+ "" "-O2" \
+ {pr26267b.c} {} "" "c"] \
+ [list "Build pr26267c.o" \
+ "" "-O2" \
+ {pr26267c.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "" "-O2" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "-flto tmpdir/pr26267a.o tmpdir/pr26267b.o tmpdir/pr26267c.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267a"] \
+ [list "Build pr26267b" \
+ "-flto tmpdir/pr26267b.o tmpdir/pr26267c.o tmpdir/pr26267a.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267b"] \
]
if { [at_least_gcc_version 4 7] } {
@@ -373,6 +403,16 @@ set lto_run_tests [list \
[list "Run pr22502" \
"-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \
{dummy.c} "pr20267" "pass.out" "-flto -O2" "c"] \
+ [list "Run pr26262a" \
+ "-O2 -flto" "" \
+ {pr26262a.c} "pr26262a" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr26262b.o tmpdir/pr26262c.o"] \
+ [list "Run pr26262b" \
+ "-flto -O2 tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
+ {pr26262a.c} "pr26262b" "pass.out" \
+ "-flto -O2" "c" "" \
+ ""] \
]
if { [at_least_gcc_version 4 7] } {
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26262a.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26262b.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267.err
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267a.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267b.c
Only in binutils-2.30/ld/testsuite/ld-plugin: pr26267c.c
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26262a.c 2020-11-02 10:13:16.624589913 +0000
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int counter;
+extern void foo (void);
+extern void xxx (void);
+
+void
+bar (void)
+{
+}
+
+int
+main(void)
+{
+ bar ();
+ foo ();
+ xxx ();
+ if (counter == 1)
+ printf ("PASS\n");
+ return 0;
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26262b.c 2020-11-02 10:13:27.358523487 +0000
@@ -0,0 +1,16 @@
+#include <stdlib.h>
+
+extern int counter;
+
+void
+foo (void)
+{
+ counter++;
+}
+
+__attribute__((weak))
+void
+bar (void)
+{
+ abort ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26262c.c 2020-11-02 10:47:59.031665605 +0000
@@ -0,0 +1,6 @@
+extern void bar (void);
+void
+xxx (void)
+{
+ bar ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267c.c 2020-11-02 10:13:39.665447327 +0000
@@ -0,0 +1,6 @@
+extern void bar (void);
+void
+xxx (void)
+{
+ bar ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267b.c 2020-11-02 10:13:43.648422679 +0000
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+
+extern int counter;
+
+void
+foo (void)
+{
+ counter++;
+}
+
+void
+bar (void)
+{
+ abort ();
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267a.c 2020-11-02 10:13:47.556398495 +0000
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int counter;
+extern void foo (void);
+extern void xxx (void);
+
+void
+bar (void)
+{
+}
+
+int
+main(void)
+{
+ bar ();
+ foo ();
+ xxx ();
+ if (counter == 1)
+ printf ("PASS\n");
+ return 0;
+}
--- /dev/null 2020-11-02 08:23:19.196542384 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267.err 2020-11-02 10:14:01.785310441 +0000
@@ -0,0 +1,3 @@
+#...
+.*: multiple definition of `bar'; .*
+#...
diff -rup binutils.orig/ld/testsuite/ld-plugin/pr26267.err binutils-2.30/ld/testsuite/ld-plugin/pr26267.err
--- binutils.orig/ld/testsuite/ld-plugin/pr26267.err 2020-11-02 12:51:28.751137533 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/pr26267.err 2020-11-02 13:01:38.430679516 +0000
@@ -1,3 +1,3 @@
#...
-.*: multiple definition of `bar'; .*
+.*: multiple definition of `bar'.*
#...
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-11-02 12:51:28.751137533 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-11-02 13:10:49.531708566 +0000
@@ -404,15 +404,13 @@ set lto_run_tests [list \
"-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \
{dummy.c} "pr20267" "pass.out" "-flto -O2" "c"] \
[list "Run pr26262a" \
- "-O2 -flto" "" \
+ "-O2 -flto tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
{pr26262a.c} "pr26262a" "pass.out" \
- "-flto -O2" "c" "" \
- "tmpdir/pr26262b.o tmpdir/pr26262c.o"] \
+ "-flto -O2" "c" "" ] \
[list "Run pr26262b" \
"-flto -O2 tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
{pr26262a.c} "pr26262b" "pass.out" \
- "-flto -O2" "c" "" \
- ""] \
+ "-flto -O2" "c" "" ] \
]
if { [at_least_gcc_version 4 7] } {

View File

@ -0,0 +1,138 @@
diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-10-09 11:46:13.571665439 +0100
+++ binutils-2.35.1/ld/testsuite/ld-plugin/lto.exp 2020-10-09 11:47:59.113302758 +0100
@@ -319,27 +319,6 @@ set lto_link_elf_tests [list \
[list "PR ld/13244" \
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
- [list "Build libpr15146a.a" \
- "$plug_opt" "-flto -O2" \
- {pr15146a.c} {} "lib15146a.a"] \
- [list "Build pr15146b.so" \
- "-shared" "-O2 -fpic" \
- {pr15146b.c} {} "pr15146b.so" "c"] \
- [list "Build pr15146c.so" \
- "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic" \
- {pr15146c.c} {} "pr15146c.so" "c"] \
- [list "PR ld/15146 (1)" \
- "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \
- {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \
- [list "Build libpr15146d.a" \
- "$plug_opt" "-flto -O2" \
- {pr15146d.c} {} "lib15146d.a"] \
- [list "Build libpr16746a.a" \
- "" "" \
- {pr16746a.c pr16746b.c} {} "lib15146a.a"] \
- [list "Build libpr16746b.a" \
- "$plug_opt" "-O2 -flto" \
- {pr16746c.c pr16746d.c} {} "lib15146b.a"] \
[list "PR ld/16746 (1)" \
"-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
{dummy.c} {} "pr16746a.exe"] \
@@ -602,13 +581,6 @@ run_cc_link_tests $lto_compile_elf_tests
# Restrict these to ELF targets that support shared libs and PIC.
if { [is_elf_format] && [check_lto_shared_available] } {
run_cc_link_tests $lto_link_elf_tests
- set testname "PR ld/15146 (2)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"]
- if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
set testname "PR ld/16746 (3)"
set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
diff -rup binutils.orig/bfd/elflink.c binutils-2.35.1/bfd/elflink.c
--- binutils.orig/bfd/elflink.c 2020-10-09 11:46:14.151663446 +0100
+++ binutils-2.35.1/bfd/elflink.c 2020-10-09 11:46:27.222618528 +0100
@@ -4970,11 +4970,7 @@ elf_link_add_object_symbols (bfd *abfd,
object and a shared object. */
bfd_boolean dynsym = FALSE;
- /* Plugin symbols aren't normal. Don't set def_regular or
- ref_regular for them, or make them dynamic. */
- if ((abfd->flags & BFD_PLUGIN) != 0)
- ;
- else if (! dynamic)
+ if (! dynamic)
{
if (! definition)
{
@@ -5155,10 +5151,6 @@ elf_link_add_object_symbols (bfd *abfd,
&& !bfd_link_relocatable (info))
dynsym = FALSE;
- /* Nor should we make plugin symbols dynamic. */
- if ((abfd->flags & BFD_PLUGIN) != 0)
- dynsym = FALSE;
-
if (definition)
{
h->target_internal = isym->st_target_internal;
@@ -5185,7 +5177,7 @@ elf_link_add_object_symbols (bfd *abfd,
}
}
- if (dynsym && h->dynindx == -1)
+ if (dynsym && (abfd->flags & BFD_PLUGIN) == 0 && h->dynindx == -1)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
goto error_free_vers;
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:23:49.034685727 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:24:48.288484833 +0000
@@ -265,12 +265,6 @@ set lto_link_elf_tests [list \
[list "PR ld/13244" \
"-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
{pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
- [list "PR ld/16746 (1)" \
- "-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
- {dummy.c} {} "pr16746a.exe"] \
- [list "PR ld/16746 (2)" \
- "-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \
- {dummy.c} {} "pr16746b.exe"] \
[list "Build pr21382a.o" \
"" "-O2 -flto" \
{pr21382a.c} {} "" "c"] \
@@ -424,25 +418,6 @@ run_cc_link_tests $lto_link_tests
# by some elf tests besides shared libs tests. So, always compile them.
run_cc_link_tests $lto_compile_elf_tests
-# Restrict these to ELF targets that support shared libs and PIC.
-if { [is_elf_format] && [check_lto_shared_available] } {
- run_cc_link_tests $lto_link_elf_tests
- set testname "PR ld/16746 (3)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
- if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
- set testname "PR ld/16746 (4)"
- set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746d.o tmpdir/pr16746b.o"]
- if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
- pass $testname
- } {
- fail $testname
- }
-}
-
set testname "Build liblto-11.a"
remote_file host delete "tmpdir/liblto-11.a"
set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
--- binutils.orig/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:47:18.581911539 +0000
+++ binutils-2.30/ld/testsuite/ld-plugin/lto.exp 2020-10-28 12:50:25.048280769 +0000
@@ -418,6 +418,11 @@ run_cc_link_tests $lto_link_tests
# by some elf tests besides shared libs tests. So, always compile them.
run_cc_link_tests $lto_compile_elf_tests
+# Restrict these to ELF targets that support shared libs and PIC.
+if { [is_elf_format] && [check_lto_shared_available] } {
+ run_cc_link_tests $lto_link_elf_tests
+}
+
set testname "Build liblto-11.a"
remote_file host delete "tmpdir/liblto-11.a"
set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]

View File

@ -0,0 +1,150 @@
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z13.d binutils-2.30/gas/testsuite/gas/s390/zarch-z13.d
--- binutils.orig/gas/testsuite/gas/s390/zarch-z13.d 2020-06-24 16:02:24.228446160 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z13.d 2020-06-24 16:02:35.952409554 +0100
@@ -17,7 +17,6 @@ Disassembly of section .text:
.*: e7 f0 fd fc 10 46 [ ]*vgmh %v15,253,252
.*: e7 f0 fd fc 20 46 [ ]*vgmf %v15,253,252
.*: e7 f0 fd fc 30 46 [ ]*vgmg %v15,253,252
-.*: e7 f6 9f a0 00 06 [ ]*vl %v15,4000\(%r6,%r9\)
.*: e7 f1 00 00 04 56 [ ]*vlr %v15,%v17
.*: e7 f6 9f a0 d0 05 [ ]*vlrep %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 00 05 [ ]*vlrepb %v15,4000\(%r6,%r9\)
@@ -42,7 +41,6 @@ Disassembly of section .text:
.*: e7 f6 9f a0 10 04 [ ]*vllezh %v15,4000\(%r6,%r9\)
.*: e7 f6 9f a0 20 04 [ ]*vllezf %v15,4000\(%r6,%r9\)
.*: e7 f6 9f a0 30 04 [ ]*vllezg %v15,4000\(%r6,%r9\)
-.*: e7 f1 6f a0 04 36 [ ]*vlm %v15,%v17,4000\(%r6\)
.*: e7 f6 9f a0 d0 07 [ ]*vlbb %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 22 [ ]*vlvg %v15,%r6,4000\(%r9\),13
.*: e7 f6 9f a0 00 22 [ ]*vlvgb %v15,%r6,4000\(%r9\)
@@ -98,12 +96,10 @@ Disassembly of section .text:
.*: e7 f1 00 00 04 5f [ ]*vsegb %v15,%v17
.*: e7 f1 00 00 14 5f [ ]*vsegh %v15,%v17
.*: e7 f1 00 00 24 5f [ ]*vsegf %v15,%v17
-.*: e7 f6 9f a0 00 0e [ ]*vst %v15,4000\(%r6,%r9\)
.*: e7 f6 9f a0 d0 08 [ ]*vsteb %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 09 [ ]*vsteh %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 0b [ ]*vstef %v15,4000\(%r6,%r9\),13
.*: e7 f6 9f a0 d0 0a [ ]*vsteg %v15,4000\(%r6,%r9\),13
-.*: e7 f1 6f a0 04 3e [ ]*vstm %v15,%v17,4000\(%r6\)
.*: e7 f6 9f a0 00 3f [ ]*vstl %v15,%r6,4000\(%r9\)
.*: e7 f1 00 00 d4 d7 [ ]*vuph %v15,%v17,13
.*: e7 f1 00 00 04 d7 [ ]*vuphb %v15,%v17
@@ -680,3 +676,11 @@ Disassembly of section .text:
.*: e3 69 b8 f0 fd 3b [ ]*lzrf %r6,-10000\(%r9,%r11\)
.*: e3 69 b8 f0 fd 2a [ ]*lzrg %r6,-10000\(%r9,%r11\)
.*: b9 3c 00 69 [ ]*prno %r6,%r9
+.*: e7 f6 9f a0 00 06 [ ]*vl %v15,4000\(%r6,%r9\)
+.*: e7 f6 9f a0 d0 06 [ ]*vl %v15,4000\(%r6,%r9\),13
+.*: e7 f1 6f a0 04 36 [ ]*vlm %v15,%v17,4000\(%r6\)
+.*: e7 f1 6f a0 d4 36 [ ]*vlm %v15,%v17,4000\(%r6\),13
+.*: e7 f6 9f a0 00 0e [ ]*vst %v15,4000\(%r6,%r9\)
+.*: e7 f6 9f a0 d0 0e [ ]*vst %v15,4000\(%r6,%r9\),13
+.*: e7 f1 6f a0 04 3e [ ]*vstm %v15,%v17,4000\(%r6\)
+.*: e7 f1 6f a0 d4 3e [ ]*vstm %v15,%v17,4000\(%r6\),13
diff -rup binutils.orig/gas/testsuite/gas/s390/zarch-z13.s binutils-2.30/gas/testsuite/gas/s390/zarch-z13.s
--- binutils.orig/gas/testsuite/gas/s390/zarch-z13.s 2020-06-24 16:02:24.227446163 +0100
+++ binutils-2.30/gas/testsuite/gas/s390/zarch-z13.s 2020-06-24 16:02:35.952409554 +0100
@@ -11,7 +11,6 @@ foo:
vgmh %v15,253,252
vgmf %v15,253,252
vgmg %v15,253,252
- vl %v15,4000(%r6,%r9)
vlr %v15,%v17
vlrep %v15,4000(%r6,%r9),13
vlrepb %v15,4000(%r6,%r9)
@@ -36,7 +35,6 @@ foo:
vllezh %v15,4000(%r6,%r9)
vllezf %v15,4000(%r6,%r9)
vllezg %v15,4000(%r6,%r9)
- vlm %v15,%v17,4000(%r6)
vlbb %v15,4000(%r6,%r9),13
vlvg %v15,%r6,4000(%r9),13
vlvgb %v15,%r6,4000(%r9)
@@ -92,12 +90,10 @@ foo:
vsegb %v15,%v17
vsegh %v15,%v17
vsegf %v15,%v17
- vst %v15,4000(%r6,%r9)
vsteb %v15,4000(%r6,%r9),13
vsteh %v15,4000(%r6,%r9),13
vstef %v15,4000(%r6,%r9),13
vsteg %v15,4000(%r6,%r9),13
- vstm %v15,%v17,4000(%r6)
vstl %v15,%r6,4000(%r9)
vuph %v15,%v17,13
vuphb %v15,%v17
@@ -674,3 +670,11 @@ foo:
lzrf %r6,-10000(%r9,%r11)
lzrg %r6,-10000(%r9,%r11)
ppno %r6,%r9
+ vl %v15,4000(%r6,%r9)
+ vl %v15,4000(%r6,%r9),13
+ vlm %v15,%v17,4000(%r6)
+ vlm %v15,%v17,4000(%r6),13
+ vst %v15,4000(%r6,%r9)
+ vst %v15,4000(%r6,%r9),13
+ vstm %v15,%v17,4000(%r6)
+ vstm %v15,%v17,4000(%r6),13
diff -rup binutils.orig/opcodes/s390-opc.txt binutils-2.30/opcodes/s390-opc.txt
--- binutils.orig/opcodes/s390-opc.txt 2020-06-24 16:02:23.965446981 +0100
+++ binutils-2.30/opcodes/s390-opc.txt 2020-06-24 16:02:35.953409551 +0100
@@ -1159,7 +1159,6 @@ e70000000046 vgmb VRI_V0UU "vector gener
e70000001046 vgmh VRI_V0UU "vector generate mask halfword" z13 zarch vx
e70000002046 vgmf VRI_V0UU "vector generate mask word" z13 zarch vx
e70000003046 vgmg VRI_V0UU "vector generate mask double word" z13 zarch vx
-e70000000006 vl VRX_VRRD "vector memory load" z13 zarch vx
e70000000056 vlr VRX_VV "vector register load" z13 zarch vx
e70000000005 vlrep VRX_VRRDU "vector load and replicate" z13 zarch vx
e70000000005 vlrepb VRX_VRRD "vector load and replicate byte elements" z13 zarch vx
@@ -1184,7 +1183,6 @@ e70000000004 vllezb VRX_VRRD "vector loa
e70000001004 vllezh VRX_VRRD "vector load logical halfword element and zero" z13 zarch vx
e70000002004 vllezf VRX_VRRD "vector load logical word element and zero" z13 zarch vx
e70000003004 vllezg VRX_VRRD "vector load logical double word element and zero" z13 zarch vx
-e70000000036 vlm VRS_VVRD "vector load multiple" z13 zarch vx
e70000000007 vlbb VRX_VRRDU "vector load to block boundary" z13 zarch vx
e70000000022 vlvg VRS_VRRDU "vector load VR element from GR" z13 zarch vx
e70000000022 vlvgb VRS_VRRD "vector load VR byte element from GR" z13 zarch vx
@@ -1240,12 +1238,10 @@ e7000000005f vseg VRR_VV0U "vector sign
e7000000005f vsegb VRR_VV "vector sign extend byte to double word" z13 zarch vx
e7000000105f vsegh VRR_VV "vector sign extend halfword to double word" z13 zarch vx
e7000000205f vsegf VRR_VV "vector sign extend word to double word" z13 zarch vx
-e7000000000e vst VRX_VRRD "vector store" z13 zarch vx
e70000000008 vsteb VRX_VRRDU "vector store byte element" z13 zarch vx
e70000000009 vsteh VRX_VRRDU "vector store halfword element" z13 zarch vx
e7000000000b vstef VRX_VRRDU "vector store word element" z13 zarch vx
e7000000000a vsteg VRX_VRRDU "vector store double word element" z13 zarch vx
-e7000000003e vstm VRS_VVRD "vector store multiple" z13 zarch vx
e7000000003f vstl VRS_VRRD "vector store with length" z13 zarch vx
e700000000d7 vuph VRR_VV0U "vector unpack high" z13 zarch vx
e700000000d7 vuphb VRR_VV "vector unpack high byte" z13 zarch vx
@@ -1680,6 +1676,13 @@ e3000000003b lzrf RXY_RRRD "load and zer
e3000000002a lzrg RXY_RRRD "load and zero rightmost byte 64->64" z13 zarch
b93c ppno RRE_RR "perform pseudorandom number operation" z13 zarch
+# Aligned vector store hints
+
+e70000000006 vl VRX_VRRDU "vector memory load" z13 zarch optparm,vx
+e70000000036 vlm VRS_VVRDU "vector load multiple" z13 zarch optparm,vx
+e7000000000e vst VRX_VRRDU "vector store" z13 zarch optparm,vx
+e7000000003e vstm VRS_VVRDU "vector store multiple" z13 zarch optparm,vx
+
# arch12 instructions
# Vector Enhancements Facility 1
@@ -1882,14 +1885,6 @@ b9a1 tpei RRE_RR "test pending external
b9ac irbm RRE_RR "insert reference bits multiple" arch12 zarch
-# Aligned vector store hints
-
-e70000000006 vl VRX_VRRDU "vector memory load" arch12 zarch optparm
-e70000000036 vlm VRS_VVRDU "vector load multiple" arch12 zarch optparm
-e7000000000e vst VRX_VRRDU "vector store" arch12 zarch optparm
-e7000000003e vstm VRS_VVRDU "vector store multiple" arch12 zarch optparm
-
-
# arch13 instructions
Only in binutils-2.30/opcodes: s390-opc.txt.orig

View File

@ -29,23 +29,6 @@ diff -rup binutils.orig/ld/testsuite/ld-plugin/lto.exp binutils-2.30/ld/testsuit
{pr12942b.cc} {} "" "c++"] \
]]
}
@@ -547,13 +547,16 @@ if { [at_least_gcc_version 4 7] } {
}
# Run "ld -r" to generate inputs for complex LTO tests.
+setup_xfail "*-*-*"
run_dump_test "lto-3r"
remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o"
+setup_xfail "*-*-*"
run_dump_test "lto-5r"
remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
run_cc_link_tests $lto_link_symbol_tests
+setup_xfail "*-*-*"
run_ld_link_tests [list \
[list "PR ld/19317 (2)" \
"-r tmpdir/pr19317.o" "" "" \
diff -rup binutils.orig/ld/testsuite/ld-plugin/plugin-10.d binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d
--- binutils.orig/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 13:46:34.060525235 +0100
+++ binutils-2.30/ld/testsuite/ld-plugin/plugin-10.d 2020-04-06 14:22:06.280196979 +0100

View File

@ -0,0 +1,19 @@
--- binutils.orig/binutils/objcopy.c 2020-10-30 14:21:10.448328799 +0000
+++ binutils-2.30/binutils/objcopy.c 2020-10-30 14:22:08.406136672 +0000
@@ -3257,14 +3257,12 @@ copy_object (bfd *ibfd, bfd *obfd, const
/* It is likely that output sections are in the same order
as the input sections, but do not assume that this is
the case. */
- if (strcmp (bfd_section_name (obfd, merged->sec),
- bfd_section_name (obfd, osec)) != 0)
+ if (merged->sec->output_section != osec)
{
for (merged = merged_note_sections;
merged != NULL;
merged = merged->next)
- if (strcmp (bfd_section_name (obfd, merged->sec),
- bfd_section_name (obfd, osec)) == 0)
+ if (merged->sec->output_section == osec)
break;
if (merged == NULL)

View File

@ -0,0 +1,116 @@
--- binutils.orig/gas/config/tc-i386.c 2020-08-21 10:21:00.595678097 +0100
+++ binutils-2.30/gas/config/tc-i386.c 2020-08-21 10:22:15.009449340 +0100
@@ -8035,7 +8035,8 @@ output_disp (fragS *insn_start_frag, off
int size = disp_size (n);
offsetT val = i.op[n].disps->X_add_number;
- val = offset_in_range (val >> i.memshift, size);
+ val = offset_in_range (val >> (size == 1 ? i.memshift : 0),
+ size);
p = frag_more (size);
md_number_to_chars (p, val, size);
}
--- binutils.orig/gas/testsuite/gas/i386/i386.exp 2020-08-21 10:21:00.669677873 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/i386.exp 2020-08-21 10:39:22.921167674 +0100
@@ -216,6 +216,7 @@ if [expr ([istarget "i*86-*-*"] || [ist
run_dump_test "evex-lig512-intel"
run_dump_test "evex-wig1"
run_dump_test "evex-wig1-intel"
+ run_dump_test "evex-no-scale-32"
run_dump_test "sse2avx"
run_list_test "inval-avx" "-al"
run_list_test "inval-avx512f" "-al"
@@ -692,6 +693,7 @@ if [expr ([istarget "i*86-*-*"] || [ista
run_dump_test "x86-64-avx256int-intel"
run_dump_test "x86-64-avx2"
run_dump_test "x86-64-avx2-intel"
+ run_dump_test "evex-no-scale-64"
run_dump_test "x86-64-avx-gather"
run_dump_test "x86-64-avx-gather-intel"
run_dump_test "x86-64-avx512f"
--- /dev/null 2020-08-21 07:54:54.335936348 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale.s 2020-08-21 10:41:30.411757740 +0100
@@ -0,0 +1,18 @@
+ .allow_index_reg
+ .struct
+ inc %eax
+.equiv is_64bit, . > 1
+
+ .text
+disp:
+.if is_64bit
+ vmovaps -1024(%rip), %zmm0
+ vmovaps 64(,%rax), %zmm0
+ vmovaps 64(,%riz), %zmm0
+.endif
+ vmovaps 64(,%eax), %zmm0
+ vmovaps 64(,%eiz), %zmm0
+ vmovaps 64, %zmm0
+.if !is_64bit
+ addr16 vmovaps 64, %zmm0
+.endif
--- /dev/null 2020-08-21 07:54:54.335936348 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale-32.d 2020-08-21 10:41:37.347735430 +0100
@@ -0,0 +1,14 @@
+#source: evex-no-scale.s
+#objdump: -dw
+#name: ix86 EVEX no disp scaling
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <disp>:
+ +[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 05 40 00 00 00 vmovaps 0x40,%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 06 40 00 vmovaps 0x40,%zmm0
+#pass
--- /dev/null 2020-08-21 07:54:54.335936348 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale-64.d 2020-08-21 10:41:42.539718727 +0100
@@ -0,0 +1,16 @@
+#source: evex-no-scale.s
+#objdump: -dw
+#name: x86-64 EVEX no disp scaling
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <disp>:
+ +[a-f0-9]+: 62 f1 7c 48 28 05 00 fc ff ff vmovaps -0x400\(%rip\),%zmm0 # .*
+ +[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%rax,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0
+ +[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
+#pass
--- binutils.orig/gas/testsuite/gas/i386/evex-no-scale.s 2020-08-21 12:48:57.859030235 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale.s 2020-08-21 12:53:26.631149341 +0100
@@ -5,7 +5,7 @@
.text
disp:
-.if is_64bit
+.ifdef x86_64
vmovaps -1024(%rip), %zmm0
vmovaps 64(,%rax), %zmm0
vmovaps 64(,%riz), %zmm0
@@ -13,6 +13,6 @@ disp:
vmovaps 64(,%eax), %zmm0
vmovaps 64(,%eiz), %zmm0
vmovaps 64, %zmm0
-.if !is_64bit
+.ifndef x86_64
addr16 vmovaps 64, %zmm0
.endif
--- binutils.orig/gas/testsuite/gas/i386/evex-no-scale-64.d 2020-08-21 12:48:57.860030232 +0100
+++ binutils-2.30/gas/testsuite/gas/i386/evex-no-scale-64.d 2020-08-21 13:20:59.174525430 +0100
@@ -11,6 +11,6 @@ Disassembly of section .text:
+[a-f0-9]+: 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%rax,1\),%zmm0
+[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
+[a-f0-9]+: 67 62 f1 7c 48 28 04 05 40 00 00 00 vmovaps 0x40\(,%eax,1\),%zmm0
- +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40\(,%eiz,1\),%zmm0
+ +[a-f0-9]+: 67 62 f1 7c 48 28 04 25 40 00 00 00 addr32 vmovaps 0x40,%zmm0
+[a-f0-9]+: 62 f1 7c 48 28 04 25 40 00 00 00 vmovaps 0x40,%zmm0
#pass

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +1,89 @@
# Binutils SPEC file. Can be invoked with the following parameters:
# Determine if this is a native build or a cross build.
#
# For a cross build add --define "binutils_target <target>" to the command
# line when building the rpms.
#
# For example:
# --define "binutils_target aarch64-linux-gnu"
#
# Cross builds will create a set of binutils executables that will run on the
# host machine but which will create binaries suitable for running on the
# target machine. The cross tools will have the target name as a prefix,
# but for compatibility with the kernel the rpms will use the target name
# as an infix. So for example building with the above define will create a
# set of rpms like this:
#
# binutils-aarch64-linux-gnu-2.35.1-14.fc34.x86_64.rpm
# binutils-aarch64-linux-gnu-debuginfo-2.35.1-14.fc34.x86_64.rpm
# [etc]
#
# and the rpms will contain files like:
#
# /usr/bin/aarch64-linux-gnu-addr2line
# /usr/bin/aarch64-linux-gnu-ar
# /usr/bin/aarch64-linux-gnu-as
# [etc]
%if 0%{!?binutils_target:1}
%define binutils_target %{_target_platform}
%define isnative 1
%define enable_shared 1
%else
%define cross %{binutils_target}-
%define name_cross -%{binutils_target}
%define isnative 0
%define enable_shared 0
%endif
Summary: A GNU collection of binary utilities
Name: binutils%{?name_cross}%{?_with_debug:-debug}
Version: 2.30
Release: 90%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
#----------------------------------------------------------------------------
# Binutils SPEC file. Can be invoked with the following parameters to change
# the default behaviour:
# --define "binutils_target arm-linux-gnu" to create arm-linux-gnu-binutils.
# --with=bootstrap: Build with minimal dependencies.
# --with=debug: Build without optimizations and without splitting the debuginfo.
# --without=docs: Skip building documentation.
# --without=testsuite: Do not run the testsuite. Default is to run it.
# --with=testsuite: Run the testsuite. Default when --with=debug is not to run it.
#
# --with bootstrap Build with minimal dependencies.
# --with debug Build without optimizations and without splitting
# the debuginfo into a separate file.
# --without docs Skip building documentation.
# Default is with docs, except when building a cross binutils.
# --without testsuite Do not run the testsuite. Default is to run it.
# --without gold Disable building of the GOLD linker.
# --with clang To force building with the CLANG.
# --without debuginfod Disable support for debuginfod.
#---Start of Configure Options-----------------------------------------------
# Do not create deterministic archives by default (cf: BZ 1195883)
# Create deterministic archives (ie ones without timestamps).
# Default is off because of BZ 1195883.
%define enable_deterministic_archives 0
# Enable support for GCC LTO compilation.
# Disable if it is necessary to work around bugs in LTO.
%define enable_lto 1
# Disable the default generation of compressed debug sections.
# Enable the compression of debug sections as default behaviour of the
# assembler and linker. This option is disabled for now. The assembler and
# linker have command line options to override the default behaviour.
%define default_compress_debug 0
# Default to read-only-relocations (relro) in shared binaries.
# This is enabled as a security feature.
%define default_relro 1
# Disable the default generation of GNU Build notes by the assembler.
# This has turned out to be problematic for the i686 architecture.
# although the exact reason has not been determined. (See BZ 1572485)
# It also breaks building EFI binaries on AArch64, as these cannot have
# relocations against absolute symbols.
# Enable the default generation of GNU Build notes by the assembler.
# This option is disabled as it has turned out to be problematic for the i686
# architecture, although the exact reason has not been determined. (See
# BZ 1572485). It also breaks building EFI binaries on AArch64, as these
# cannot have relocations against absolute symbols.
%define default_generate_notes 0
# Enable thread support in the GOLD linker (if it is being built). This is
@ -44,6 +102,8 @@
%bcond_without docs
# Default: Always run the testsuite.
%bcond_without testsuite
# Default: Build the gold linker.
%bcond_without gold
%if %{with bootstrap}
%undefine with_docs
@ -54,31 +114,13 @@
%undefine with_testsuite
%endif
%if 0%{!?binutils_target:1}
%define binutils_target %{_target_platform}
%define isnative 1
%define enable_shared 1
%else
%define cross %{binutils_target}-
%define isnative 0
%define enable_shared 0
%endif
#----------------------------------------------------------------------------
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.30
Release: 75%{?dist}
License: GPLv3+
URL: https://sourceware.org/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: https://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
Source2: binutils-2.19.50.0.1-output-format.sed
%if %{with docs}
@ -126,7 +168,6 @@ Patch03: binutils-2.22.52.0.1-export-demangle.h.patch
# order.
Patch04: binutils-2.22.52.0.4-no-config-h-check.patch
# Purpose: Import H.J.Lu's Kernel LTO patch.
# Lifetime: Permanent, but needs continual updating.
# FIXME: Try removing....
Patch05: binutils-2.26-lto.patch
@ -468,11 +509,52 @@ Patch74: binutils-objcopy-set-section-flags-shared.patch
# Lifetime: Fixed in 2.32
Patch75: binutils-s390x-prevent-GOT-rewrite.patch
# Purpose: Have the s/390 assembler include alignment hints in vector
# instructions.
# Lifetime: Fixed in 2.35
Patch76: binutils-s390-alignment-hints.patch
# Purpose: Fix the x86 assembler so that it does not scale non-8-bit
# displacements.
# Lifetime: Fixed in 2.32
Patch77: binutils-x86-gas-scaled-8-bit-displacements.patch
# Purpose: Allow plugin syms to mark as-needed shared libs needed.
# Lifetime: Fixed in 2.36
Patch78: binutils-plugin-as-needed.patch
# Purpose: Fix merging attributes in the presence of multiple
# same-named sections.
# Lifetime: Fixed in 2.36
Patch79: binutils-strip-merge.patch
# Purpose: Properly override IR definitions
# Lifetime: Fixed in 2.35
Patch80: binutils-ld-IR-override.patch
# Purpose: Add support for Intel's TPAUSE and UNWAIT instructions.
# Lifetime: Fixed in 2.31
Patch81: binutils-x86-tpause.patch
# Purpose: Add support for AArch64 GNU Property notes
# Lifetime: Fixed in 2.34
Patch82: binutils-aarch64-properties.patch
# Purpose: Fix the version selected when merging common symbols
# and normal symbols.
# Lifetime: Fixed in 2.36
Patch83: binutils-common-sym-versioning.patch
#----------------------------------------------------------------------------
Provides: bundled(libiberty)
BuildRequires: autoconf automake
%if %{with gold}
%define gold_arches %{ix86} x86_64 %{arm} aarch64 %{power64} s390x
%else
%define gold_arches none
%endif
%if %{with bootstrap}
%define build_gold no
@ -667,6 +749,14 @@ using libelf instead of BFD.
%patch73 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
%patch79 -p1
%patch80 -p1
%patch81 -p1
%patch82 -p1
%patch83 -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
# FIXME - this is no longer true. Maybe try reinstating autotool use ?
@ -954,14 +1044,14 @@ $OUTPUT_FORMAT
INPUT ( %{_libdir}/libopcodes.a -lbfd )
EOH
%else # !isnative
%else
# For cross-binutils we drop the documentation.
rm -rf %{buildroot}%{_infodir}
# We keep these as one can have native + cross binutils of different versions.
#rm -rf {buildroot}{_prefix}/share/locale
#rm -rf {buildroot}{_mandir}
rm -rf %{buildroot}%{_libdir}/libiberty.a
%endif # !isnative
%endif
# This one comes from gcc
rm -f %{buildroot}%{_infodir}/dir
@ -998,7 +1088,7 @@ fi
if [ $1 = 0 ]; then
%{_sbindir}/alternatives --auto %{?cross}ld
fi
%endif # both ld.gold and ld.bfd
%endif
%if %{isnative}
/sbin/ldconfig
@ -1009,8 +1099,8 @@ fi
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/standards.info.gz
%endif # with docs
%endif # isnative
%endif
%endif
exit 0
@ -1022,7 +1112,7 @@ if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.bfd
%{_sbindir}/alternatives --remove %{?cross}ld %{_bindir}/%{?cross}ld.gold
fi
%endif # both ld.gold and ld.bfd
%endif
%if %{isnative}
if [ $1 = 0 ]; then
@ -1035,7 +1125,7 @@ if [ $1 = 0 ]; then
/sbin/install-info --quiet --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz
fi
fi
%endif # isnative
%endif
exit 0
@ -1052,7 +1142,7 @@ exit 0
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
/sbin/install-info --quiet --delete --info-dir=%{_infodir} %{_infodir}/standards.info.gz
fi
%endif # isnative
%endif
#----------------------------------------------------------------------------
@ -1066,29 +1156,31 @@ exit 0
%ghost %{_bindir}/%{?cross}ld
%else
%{_bindir}/%{?cross}ld*
%endif # both ld.gold and ld.bfd
%endif
%if %{with docs}
%{_mandir}/man1/*
%if %{isnative}
%{_infodir}/as.info.gz
%{_infodir}/binutils.info.gz
%{_infodir}/gprof.info.gz
%{_infodir}/ld.info.gz
%{_infodir}/standards.info.gz
%endif # with docs
%endif
%endif
%if %{enable_shared}
%{_libdir}/lib*.so
%exclude %{_libdir}/libbfd.so
%exclude %{_libdir}/libopcodes.so
%endif # enable_shared
%endif
%if %{isnative}
%if %{with docs}
%{_infodir}/[^b]*info*
%{_infodir}/binutils*info*
%endif # with docs
%endif
%files devel
%{_prefix}/include/*
@ -1098,12 +1190,55 @@ exit 0
%if %{with docs}
%{_infodir}/bfd*info*
%endif # with docs
%endif
%endif # isnative
%endif
#----------------------------------------------------------------------------
%changelog
* Mon Jan 1 2021 Nick Clifton <nickc@redhat.com> - 2.30-90
- NVR bump in order to regain access to gating test results.
* Wed Dec 09 2020 Nick Clifton <nickc@redhat.com> - 2.30-89
- Fix snafu preventing the building of the GOLD linekr.
* Wed Dec 09 2020 Nick Clifton <nickc@redhat.com> - 2.30-88
- Fix versioning when merging common and normal symbols. (#1904942)
- Add cross binutils support.
* Wed Nov 25 2020 Nick Clifton <nickc@redhat.com> - 2.30-87
- Fix bug in patch for AArch64 GNU Property notes support. (#1889643)
* Wed Nov 04 2020 Nick Clifton <nickc@redhat.com> - 2.30-86
- Add support for AArch64 GNU Property notes. (#1889643)
* Tue Nov 03 2020 Nick Clifton <nickc@redhat.com> - 2.30-85
- Add support for the TPAUSE and UNWAIT instructions in the x86 assembler. (#1893292)
* Mon Nov 02 2020 Nick Clifton <nickc@redhat.com> - 2.30-84
- Fix problem in linker testsuite triggered by the as-needed update. (#1886071)
* Fri Oct 30 2020 Nick Clifton <nickc@redhat.com> - 2.30-83
- Fix merging attributes in the presence of multiple same-named sections. (#1893197)
* Wed Oct 28 2020 Nick Clifton <nickc@redhat.com> - 2.30-82
- Fix problem in linker testsuite triggered by the as-needed update. (#1886071)
* Fri Oct 23 2020 Nick Clifton <nickc@redhat.com> - 2.30-81
- Allow plugin syms to mark as-needed shared libs needed. (#1886071)
* Wed Sep 16 2020 Nick Clifton <nickc@redhat.com> - 2.30-80
- NVR Bump to allow rebuild.
* Fri Aug 21 2020 Nick Clifton <nickc@redhat.com> - 2.30-79
- Fix x86 assembler's handling of non-8-bit displacements. (#1869401)
* Thu Aug 20 2020 Nick Clifton <nickc@redhat.com> - 2.30-77
- Add tests missing from PT_GNU_SEGMENT patch. (#1870039)
* Wed Jun 24 2020 Nick Clifton <nickc@redhat.com> - 2.30-76
- Have the s.390 assembler include alignment hints with vector instructions. (#1850490)
* Mon Jun 15 2020 Nick Clifton <nickc@redhat.com> - 2.30-75
- Prevent the s/390 linker from rewriting the GOT access for certain symbol types. (#1846972)