sync some patches from community

This commit is contained in:
linwei9 2020-06-30 16:52:08 +08:00
parent c75d6cf0b0
commit 5a6675a633
8 changed files with 433 additions and 8 deletions

View File

@ -0,0 +1,82 @@
From 9f57ab49b32bc14c0ff3834876a185af0a4c6e6b Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Tue, 21 Apr 2020 15:16:21 +0100
Subject: [PATCH] BFD: Exclude sections with no content from compress check.
The check in bfd_get_full_section_contents is trying to check that we don't
allocate more space for a section than the size of the section is on disk.
Previously we excluded linker created sections since they didn't have a size on
disk. However we also need to exclude sections with no content as well such as
the BSS section. Space for these would not have been allocated by the assembler
and so the check would incorrectly fail.
bfd/ChangeLog:
PR binutils/24753
* compress.c (bfd_get_full_section_contents): Exclude sections with no
content.
gas/ChangeLog:
PR binutils/24753
* testsuite/gas/arm/pr24753.d: New test.
* testsuite/gas/arm/pr24753.s: New test.
(cherry picked from commit c36876fe5b5bac1c404ab2ca82bfbfb2ed9a2717)
---
bfd/compress.c | 3 +++
gas/testsuite/gas/arm/pr24753.d | 7 +++++++
gas/testsuite/gas/arm/pr24753.s | 12 ++++++++++++
3 files changed, 24 insertions(+)
create mode 100644 gas/testsuite/gas/arm/pr24753.d
create mode 100644 gas/testsuite/gas/arm/pr24753.s
diff --git a/bfd/compress.c b/bfd/compress.c
index ce6bb2b..728ba39 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -255,6 +255,9 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
/* PR 24753: Linker created sections can be larger than
the file size, eg if they are being used to hold stubs. */
&& (bfd_section_flags (sec) & SEC_LINKER_CREATED) == 0
+ /* PR 24753: Sections which have no content should also be
+ excluded as they contain no size on disk. */
+ && (bfd_section_flags (sec) & SEC_HAS_CONTENTS) != 0
/* The MMO file format supports its own special compression
technique, but it uses COMPRESS_SECTION_NONE when loading
a section's contents. */
diff --git a/gas/testsuite/gas/arm/pr24753.d b/gas/testsuite/gas/arm/pr24753.d
new file mode 100644
index 0000000..01990d1
--- /dev/null
+++ b/gas/testsuite/gas/arm/pr24753.d
@@ -0,0 +1,7 @@
+#skip: *-*-pe *-*-wince *-*-vxworks
+#objdump: -d
+#name: PR24753: Don't error on sections with no content size mismatch with file
+
+.*: +file format .*arm.*
+
+#...
diff --git a/gas/testsuite/gas/arm/pr24753.s b/gas/testsuite/gas/arm/pr24753.s
new file mode 100644
index 0000000..5ba33fd
--- /dev/null
+++ b/gas/testsuite/gas/arm/pr24753.s
@@ -0,0 +1,12 @@
+.text
+.global _start
+_start:
+ nop
+
+.section .text2, "ax", %progbits
+_func:
+ nop
+
+.bss
+.fill 0x8000
+
--
1.8.3.1

View File

@ -0,0 +1,34 @@
From 82f439d028c65663a0baf0a17ef5c4a2ea5c84a7 Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Tue, 11 Feb 2020 15:55:25 +0000
Subject: [PATCH] Import a fix from the mainline sources that prevents a
potential illegal memory access when parsing PE binaries.
PR 25447
* coffgen.c (_bfd_coff_close_and_cleanup): Do not clear the keep
syms and keep strings flags as these may have been set in order to
prevent a bogus call to free.
---
bfd/coffgen.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 2bfcf1a..3ddd2d8 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -3175,8 +3175,10 @@ _bfd_coff_close_and_cleanup (bfd *abfd)
&& bfd_family_coff (abfd)
&& coff_data (abfd) != NULL)
{
- obj_coff_keep_syms (abfd) = FALSE;
- obj_coff_keep_strings (abfd) = FALSE;
+ /* PR 25447:
+ Do not clear the keep_syms and keep_strings flags.
+ These may have been set by pe_ILF_build_a_bfd() indicating
+ that the syms and strings pointers are not to be freed. */
if (!_bfd_coff_free_symbols (abfd))
return FALSE;
}
--
1.8.3.1

View File

@ -0,0 +1,43 @@
From acc4a8b8ac83077819948126bc7501d35eb1ea74 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Sat, 22 Feb 2020 12:46:33 +1030
Subject: [PATCH] PR25585, PHDR segment not covered by LOAD segment
I closed this bug as invalid, but I think it is worth mentioning in NEWS
that older linkers didn't check PT_PHDR very well. The patch also allows
people to force an output file with --noinhibit-exec after the error.
bfd/
PR 25585
* elf.c (assign_file_positions_for_load_sections): Continue linking
on "PHDR segment not covered by LOAD segment" errors.
ld/
PR 25585
* NEWS: Mention better "PHDR segment not covered by LOAD segment"
checking.
(cherry picked from commit 7b3c27152b5695177a2cd5adc0d7b0255f99aca0)
---
bfd/elf.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/bfd/elf.c b/bfd/elf.c
index a8d98a6..f02b724 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5934,7 +5934,11 @@ assign_file_positions_for_load_sections (bfd *abfd,
_bfd_error_handler (_("%pB: error: PHDR segment not covered"
" by LOAD segment"),
abfd);
- return FALSE;
+ if (link_info == NULL)
+ return FALSE;
+ /* Arrange for the linker to exit with an error, deleting
+ the output file unless --noinhibit-exec is given. */
+ link_info->callbacks->info ("%X");
}
/* Check that all sections are in a PT_LOAD segment.
--
1.8.3.1

View File

@ -0,0 +1,104 @@
From f7aec2b8e09768f284085259e08bfc1f61a0ae27 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Mon, 30 Mar 2020 09:28:02 +1030
Subject: [PATCH] PR25745, powerpc64-ld overflows string buffer in --stats mode
PR 25745
* elf64-ppc.c (ppc64_elf_build_stubs): Use asprintf to form
statistics message.
(cherry picked from commit 988b7300bc990abafd982bdcd217c58bc1e0679a)
---
bfd/elf64-ppc.c | 76 ++++++++++++++++++++++++++++++---------------------------
1 files changed, 40 insertions(+), 36 deletions(-)
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index bea722c..47ff648 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -14116,42 +14116,46 @@ ppc64_elf_build_stubs (struct bfd_link_info *info,
if (stats != NULL)
{
- size_t len;
- *stats = bfd_malloc (500);
- if (*stats == NULL)
- return FALSE;
-
- len = sprintf (*stats,
- ngettext ("linker stubs in %u group\n",
- "linker stubs in %u groups\n",
- stub_sec_count),
- stub_sec_count);
- sprintf (*stats + len, _(" branch %lu\n"
- " branch toc adj %lu\n"
- " branch notoc %lu\n"
- " branch both %lu\n"
- " long branch %lu\n"
- " long toc adj %lu\n"
- " long notoc %lu\n"
- " long both %lu\n"
- " plt call %lu\n"
- " plt call save %lu\n"
- " plt call notoc %lu\n"
- " plt call both %lu\n"
- " global entry %lu"),
- htab->stub_count[ppc_stub_long_branch - 1],
- htab->stub_count[ppc_stub_long_branch_r2off - 1],
- htab->stub_count[ppc_stub_long_branch_notoc - 1],
- htab->stub_count[ppc_stub_long_branch_both - 1],
- htab->stub_count[ppc_stub_plt_branch - 1],
- htab->stub_count[ppc_stub_plt_branch_r2off - 1],
- htab->stub_count[ppc_stub_plt_branch_notoc - 1],
- htab->stub_count[ppc_stub_plt_branch_both - 1],
- htab->stub_count[ppc_stub_plt_call - 1],
- htab->stub_count[ppc_stub_plt_call_r2save - 1],
- htab->stub_count[ppc_stub_plt_call_notoc - 1],
- htab->stub_count[ppc_stub_plt_call_both - 1],
- htab->stub_count[ppc_stub_global_entry - 1]);
+ char *groupmsg;
+ if (asprintf (&groupmsg,
+ ngettext ("linker stubs in %u group\n",
+ "linker stubs in %u groups\n",
+ stub_sec_count),
+ stub_sec_count) < 0)
+ *stats = NULL;
+ else
+ {
+ if (asprintf (stats, _("%s"
+ " branch %lu\n"
+ " branch toc adj %lu\n"
+ " branch notoc %lu\n"
+ " branch both %lu\n"
+ " long branch %lu\n"
+ " long toc adj %lu\n"
+ " long notoc %lu\n"
+ " long both %lu\n"
+ " plt call %lu\n"
+ " plt call save %lu\n"
+ " plt call notoc %lu\n"
+ " plt call both %lu\n"
+ " global entry %lu"),
+ groupmsg,
+ htab->stub_count[ppc_stub_long_branch - 1],
+ htab->stub_count[ppc_stub_long_branch_r2off - 1],
+ htab->stub_count[ppc_stub_long_branch_notoc - 1],
+ htab->stub_count[ppc_stub_long_branch_both - 1],
+ htab->stub_count[ppc_stub_plt_branch - 1],
+ htab->stub_count[ppc_stub_plt_branch_r2off - 1],
+ htab->stub_count[ppc_stub_plt_branch_notoc - 1],
+ htab->stub_count[ppc_stub_plt_branch_both - 1],
+ htab->stub_count[ppc_stub_plt_call - 1],
+ htab->stub_count[ppc_stub_plt_call_r2save - 1],
+ htab->stub_count[ppc_stub_plt_call_notoc - 1],
+ htab->stub_count[ppc_stub_plt_call_both - 1],
+ htab->stub_count[ppc_stub_global_entry - 1]) < 0)
+ *stats = NULL;
+ free (groupmsg);
+ }
}
return TRUE;
}
--
1.8.3.1

View File

@ -0,0 +1,31 @@
From 40bfb9762747f8336b17c70a0173d10200fa62eb Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Thu, 27 Feb 2020 17:28:47 +1030
Subject: [PATCH] Re: PR24511, nm should not mark symbols in .init_array as "t"
PR 24511
* syms.c (bfd_decode_symclass): Reverse order of coff_section_type
and decode_section_type calls.
---
bfd/syms.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bfd/syms.c b/bfd/syms.c
index 128cf19..8a8b74f 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -705,9 +705,9 @@ bfd_decode_symclass (asymbol *symbol)
c = 'a';
else if (symbol->section)
{
- c = decode_section_type (symbol->section);
+ c = coff_section_type (symbol->section->name);
if (c == '?')
- c = coff_section_type (symbol->section->name);
+ c = decode_section_type (symbol->section);
}
else
return '?';
--
1.8.3.1

View File

@ -1,24 +1,31 @@
Summary: Binary utilities
Name: binutils
Version: 2.34
Release: 1
Release: 2
License: GPLv3+
URL: https://sourceware.org/binutils
Source: https://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
Patch01: binutils-2.20.51.0.2-libtool-lib64.patch
Patch02: export-demangle.h-in-devel-package.patch
Patch0: binutils-2.20.51.0.2-libtool-lib64.patch
Patch1: export-demangle.h-in-devel-package.patch
#BUZ:845084
Patch03: binutils-2.22.52.0.4-no-config-h-check.patch
Patch2: binutils-2.22.52.0.4-no-config-h-check.patch
#BUG:1452111
Patch04: binutils-2.29-revert-PLT-elision.patch
Patch05: binutils-2.27-aarch64-ifunc.patch
Patch3: binutils-2.29-revert-PLT-elision.patch
Patch4: binutils-2.27-aarch64-ifunc.patch
#Stop gold from complaining about relocs
Patch06: binutils-gold-ignore-discarded-note-relocs.patch
Patch5: binutils-gold-ignore-discarded-note-relocs.patch
#PATCH-CVE-UPSTREAM
Patch7: CVE-2019-1010204.patch
Patch6: CVE-2019-1010204.patch
Patch7: Import-a-fix-from-the-mainline-sources-that-prevents.patch
Patch8: PR25585-PHDR-segment-not-covered-by-LOAD-segment.patch
Patch9: Re-PR24511-nm-should-not-mark-symbols-in-.init_array.patch
Patch10: powerpc64-ld-infinite-loop.patch
Patch11: PR25745-powerpc64-ld-overflows-string-buffer-in-stat.patch
Patch12: BFD-Exclude-sections-with-no-content-from-compress-c.patch
Patch13: gas-PR-25863-Fix-scalar-vmul-inside-it-block-when-as.patch
Provides: bundled(libiberty)
@ -304,6 +311,12 @@ fi
%{_infodir}/bfd*info*
%changelog
* Mon Jun 29 2020 linwei<linwei54@huawei.com> - 2.34-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:sync some patches from community
* Mon May 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.34-1
- Type:requirement
- ID:NA

View File

@ -0,0 +1,85 @@
From a72427b1ae01304da0b5170e1e53f68c6d46c1de Mon Sep 17 00:00:00 2001
From: Andre Simoes Dias Vieira <andre.simoesdiasvieira@arm.com>
Date: Mon, 4 May 2020 13:05:42 +0100
Subject: [PATCH] gas: PR 25863: Fix scalar vmul inside it block when
assembling for MVE
This fixes PR 25863 by fixing the condition in the parsing of vmul in
do_mve_vmull. It also simplifies the code in there fixing latent issues that
would lead to NEON code being accepted when it shouldn't.
2020-05-07 Andre Vieira <andre.simoesdiasvieira@arm.com>
Backport from mainline.
2020-05-04 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR gas/25863
* config/tc-arm.c (do_mve_vmull): Fix scalar and NEON parsing of vmul.
* testsuite/gas/arm/mve-scalar-vmult-it.d: New test.
* testsuite/gas/arm/mve-scalar-vmult-it.s: New test.
---
gas/config/tc-arm.c | 12 +++---------
gas/testsuite/gas/arm/mve-scalar-vmul-it.d | 11 +++++++++++
gas/testsuite/gas/arm/mve-scalar-vmul-it.s | 5 +++++
3 files changed, 19 insertions(+), 9 deletions(-)
create mode 100644 gas/testsuite/gas/arm/mve-scalar-vmul-it.d
create mode 100644 gas/testsuite/gas/arm/mve-scalar-vmul-it.s
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 8ad2d6d..7550f90 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -18221,19 +18221,13 @@ do_mve_vmull (void)
enum neon_shape rs = neon_select_shape (NS_HHH, NS_FFF, NS_DDD, NS_DDS,
NS_QQS, NS_QQQ, NS_QQR, NS_NULL);
- if (!ARM_CPU_HAS_FEATURE (cpu_variant, mve_ext)
- && inst.cond == COND_ALWAYS
+ if (inst.cond == COND_ALWAYS
&& ((unsigned)inst.instruction) == M_MNEM_vmullt)
{
+
if (rs == NS_QQQ)
{
-
- struct neon_type_el et = neon_check_type (3, rs, N_EQK , N_EQK,
- N_SUF_32 | N_F64 | N_P8
- | N_P16 | N_I_MVE | N_KEY);
- if (((et.type == NT_poly) && et.size == 8
- && ARM_CPU_IS_ANY (cpu_variant))
- || (et.type == NT_integer) || (et.type == NT_float))
+ if (!ARM_CPU_HAS_FEATURE (cpu_variant, mve_ext))
goto neon_vmul;
}
else
diff --git a/gas/testsuite/gas/arm/mve-scalar-vmul-it.d b/gas/testsuite/gas/arm/mve-scalar-vmul-it.d
new file mode 100644
index 0000000..f4564a5
--- /dev/null
+++ b/gas/testsuite/gas/arm/mve-scalar-vmul-it.d
@@ -0,0 +1,11 @@
+# name: Armv8.1-M Mainline scalar vmul instructions in it blocks (with MVE)
+# as: -march=armv8.1-m.main+mve.fp+fp.dp
+# objdump: -dr --prefix-addresses --show-raw-insn -marmv8.1-m.main
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+[^>]*> bfbc itt lt
+[^>]*> ee20 0a81 vmullt.f32 s0, s1, s2
+[^>]*> ee21 0b02 vmullt.f64 d0, d1, d2
+#...
diff --git a/gas/testsuite/gas/arm/mve-scalar-vmul-it.s b/gas/testsuite/gas/arm/mve-scalar-vmul-it.s
new file mode 100644
index 0000000..e6c24ac
--- /dev/null
+++ b/gas/testsuite/gas/arm/mve-scalar-vmul-it.s
@@ -0,0 +1,5 @@
+.syntax unified
+.text
+itt lt
+vmullt.f32 s0, s1, s2
+vmullt.f64 d0, d1, d2
--
1.8.3.1

View File

@ -0,0 +1,33 @@
From de9c1b7cfe6e57ea8b677dc2de06e83de50f47c2 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 11 Mar 2020 14:43:16 +1030
Subject: [PATCH] powerpc64-ld infinite loop
If this code dealing with possible conversion of inline plt sequences
is ever executed, ld will hang. A binary with such sequences and of
code size larger than approximately 90% the reach of an unconditional
branch is the trigger. Oops.
* elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.
(cherry picked from commit 435edf0bf231240ccecb474b74ebb49dc8db2633)
---
bfd/elf64-ppc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletion(-)
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 73ea286..bea722c 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7507,7 +7507,7 @@ ppc64_elf_inline_plt (struct bfd_link_info *info)
return FALSE;
relend = relstart + sec->reloc_count;
- for (rel = relstart; rel < relend; )
+ for (rel = relstart; rel < relend; rel++)
{
enum elf_ppc64_reloc_type r_type;
unsigned long r_symndx;
--
1.8.3.1