From bfc9d3bcb82d17bfb0719575aa5a04800f3fd14a Mon Sep 17 00:00:00 2001 From: Alexey Pavlov Date: Tue, 2 Jun 2020 09:56:56 +0300 Subject: [PATCH] binutils: Import upstream pacthes --- binutils/1000-PR24511.patch | 31 +++++++++++++++++++++++++++++++ binutils/1001-PR25447.patch | 34 ++++++++++++++++++++++++++++++++++ binutils/PKGBUILD | 14 +++++++++++--- 3 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 binutils/1000-PR24511.patch create mode 100644 binutils/1001-PR25447.patch diff --git a/binutils/1000-PR24511.patch b/binutils/1000-PR24511.patch new file mode 100644 index 00000000..a3a54112 --- /dev/null +++ b/binutils/1000-PR24511.patch @@ -0,0 +1,31 @@ +From 40bfb9762747f8336b17c70a0173d10200fa62eb Mon Sep 17 00:00:00 2001 +From: Alan Modra +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 128cf191453..8a8b74f3f92 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 '?'; +-- +2.18.2 + diff --git a/binutils/1001-PR25447.patch b/binutils/1001-PR25447.patch new file mode 100644 index 00000000..37b92cfb --- /dev/null +++ b/binutils/1001-PR25447.patch @@ -0,0 +1,34 @@ +From 82f439d028c65663a0baf0a17ef5c4a2ea5c84a7 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +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 2bfcf1a6b14..3ddd2d89a83 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; + } +-- +2.18.2 + diff --git a/binutils/PKGBUILD b/binutils/PKGBUILD index e3283132..57d6d048 100644 --- a/binutils/PKGBUILD +++ b/binutils/PKGBUILD @@ -2,7 +2,7 @@ pkgname=binutils pkgver=2.34 -pkgrel=2 +pkgrel=3 pkgdesc="A set of programs to assemble and manipulate binary and object files" arch=('i686' 'x86_64') url="https://www.gnu.org/software/binutils/" @@ -15,16 +15,24 @@ options=('staticlibs' '!distcc' '!ccache') install=binutils.install source=(https://ftp.gnu.org/gnu/binutils/binutils-${pkgver}.tar.bz2 0050-bfd-Increase-_bfd_coff_max_nscns-to-65279.patch - 0100-binutils-2.30-msys2.patch) + 0100-binutils-2.30-msys2.patch + 1000-PR24511.patch + 1001-PR25447.patch) sha256sums=('89f010078b6cf69c23c27897d686055ab89b198dddf819efb0a4f2c38a0b36e6' '604e76e0f702ced493ee22aa3c1768b4776b2008a7d70ae0dd35fe5be3522141' - '21a5f835d8e9c1d7daba1ffb8369fce8e38be05949997c4039b5cb10d8589082') + '21a5f835d8e9c1d7daba1ffb8369fce8e38be05949997c4039b5cb10d8589082' + 'ee802df23360ad8b51cbc52aa0845916bb36098fbe6940e93a8f4c74ac5f18e9' + 'c1363575e0a13c7cacc696b68bedf2937c872422d6af286a7dc25f8b9c678ba7') prepare() { cd "${srcdir}"/binutils-${pkgver} patch -p1 -i "${srcdir}"/0050-bfd-Increase-_bfd_coff_max_nscns-to-65279.patch patch -p1 -i "${srcdir}"/0100-binutils-2.30-msys2.patch + # Upstream patches + patch -p1 -i "${srcdir}"/1000-PR24511.patch + patch -p1 -i "${srcdir}"/1001-PR25447.patch + # hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS" sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure