mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
binutils: Upgrade to 2.38 release
Release Notes are here [1] [1] https://lists.gnu.org/archive/html/info-gnu/2022-02/msg00009.html (From OE-Core rev: 77a1038828e638518dceda969da0817aa13eb5d3) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
LIC_FILES_CHKSUM="\
|
||||
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
|
||||
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\
|
||||
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\
|
||||
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\
|
||||
file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\
|
||||
file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
|
||||
file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\
|
||||
file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\
|
||||
file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\
|
||||
"
|
||||
|
||||
# When upgrading to 2.37, please make sure there is no trailing .0, so
|
||||
# that upstream version check can work correctly.
|
||||
PV = "2.37"
|
||||
CVE_VERSION = "2.37"
|
||||
SRCBRANCH ?= "binutils-2_37-branch"
|
||||
|
||||
UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
|
||||
|
||||
SRCREV ?= "87d4632d36323091e731eb07b8aa65f90293da66"
|
||||
BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${SRCBRANCH};protocol=git"
|
||||
SRC_URI = "\
|
||||
${BINUTILS_GIT_URI} \
|
||||
file://0005-Point-scripts-location-to-libdir.patch \
|
||||
file://0006-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch \
|
||||
file://0007-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch \
|
||||
file://0008-warn-for-uses-of-system-directories-when-cross-linki.patch \
|
||||
file://0011-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch \
|
||||
file://0013-Use-libtool-2.4.patch \
|
||||
file://0014-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \
|
||||
file://0015-sync-with-OE-libtool-changes.patch \
|
||||
file://0016-Check-for-clang-before-checking-gcc-version.patch \
|
||||
file://0017-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch \
|
||||
file://0001-elf-Discard-input-.note.gnu.build-id-sections.patch \
|
||||
file://0001-CVE-2021-42574.patch \
|
||||
file://161e87d12167b1e36193385485c1f6ce92f74f02.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
@@ -0,0 +1,35 @@
|
||||
LIC_FILES_CHKSUM="\
|
||||
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
|
||||
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\
|
||||
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\
|
||||
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\
|
||||
file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\
|
||||
file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
|
||||
file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\
|
||||
file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\
|
||||
file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\
|
||||
"
|
||||
|
||||
# When upgrading to 2.39, please make sure there is no trailing .0, so
|
||||
# that upstream version check can work correctly.
|
||||
PV = "2.38"
|
||||
CVE_VERSION = "2.38"
|
||||
SRCBRANCH ?= "binutils-2_38-branch"
|
||||
|
||||
UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
|
||||
|
||||
SRCREV ?= "a96f7ba94b69b588bf524624ff2410b31420c957"
|
||||
BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${SRCBRANCH};protocol=git"
|
||||
SRC_URI = "\
|
||||
${BINUTILS_GIT_URI} \
|
||||
file://0004-Point-scripts-location-to-libdir.patch \
|
||||
file://0005-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch \
|
||||
file://0006-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch \
|
||||
file://0007-warn-for-uses-of-system-directories-when-cross-linki.patch \
|
||||
file://0008-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch \
|
||||
file://0009-Use-libtool-2.4.patch \
|
||||
file://0010-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \
|
||||
file://0011-sync-with-OE-libtool-changes.patch \
|
||||
file://0012-Check-for-clang-before-checking-gcc-version.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
File diff suppressed because it is too large
Load Diff
+6
-6
@@ -1,4 +1,4 @@
|
||||
From 257ad1ce148417e1cefe2332d8acc5c8216c2522 Mon Sep 17 00:00:00 2001
|
||||
From 07bb7fbdacaf9cd6a1a252ffbc98f4e05e305d50 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 2 Mar 2015 01:58:54 +0000
|
||||
Subject: [PATCH] binutils-crosssdk: Generate relocatable SDKs
|
||||
@@ -21,10 +21,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
3 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gold/layout.cc b/gold/layout.cc
|
||||
index a27cb071c75..32b52890b39 100644
|
||||
index 3efe8d98ae9..9cc389664a6 100644
|
||||
--- a/gold/layout.cc
|
||||
+++ b/gold/layout.cc
|
||||
@@ -5032,7 +5032,7 @@ Layout::create_interp(const Target* target)
|
||||
@@ -5033,7 +5033,7 @@ Layout::create_interp(const Target* target)
|
||||
gold_assert(interp != NULL);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ index a27cb071c75..32b52890b39 100644
|
||||
Output_section_data* odata = new Output_data_const(interp, len, 1);
|
||||
|
||||
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
|
||||
index 088417ef2d5..46a2db7005c 100755
|
||||
index 278f212bdad..0c52ebee4d0 100755
|
||||
--- a/ld/genscripts.sh
|
||||
+++ b/ld/genscripts.sh
|
||||
@@ -304,6 +304,7 @@ DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}"
|
||||
@@ -59,10 +59,10 @@ index 088417ef2d5..46a2db7005c 100755
|
||||
DATA_ALIGNMENT=${DATA_ALIGNMENT_}
|
||||
RELOCATING=" "
|
||||
diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
|
||||
index 29a8f0781d5..75e46f4adaf 100644
|
||||
index bf2268bb0ad..b1811ef130f 100644
|
||||
--- a/ld/scripttempl/elf.sc
|
||||
+++ b/ld/scripttempl/elf.sc
|
||||
@@ -147,8 +147,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then
|
||||
@@ -148,8 +148,8 @@ if test -z "$DATA_SEGMENT_ALIGN"; then
|
||||
DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
|
||||
fi
|
||||
fi
|
||||
|
||||
-215
@@ -1,215 +0,0 @@
|
||||
From b2e18d3ea300f7491705b6e86a7cc3d6366e3b1f Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Tue, 30 Nov 2021 20:40:38 -0800
|
||||
Subject: [PATCH] elf: Discard input .note.gnu.build-id sections
|
||||
|
||||
1. Discard input .note.gnu.build-id sections.
|
||||
2. Clear the build ID field before writing.
|
||||
3. Use bfd_make_section_anyway_with_flags to create the output
|
||||
.note.gnu.build-id section.
|
||||
|
||||
PR ld/28639
|
||||
* ldelf.c (ldelf_after_open): Discard input .note.gnu.build-id
|
||||
sections, excluding the first one.
|
||||
(write_build_id): Clear the build ID field before writing.
|
||||
(ldelf_setup_build_id): Use bfd_make_section_anyway_with_flags
|
||||
to create the output .note.gnu.build-id section.
|
||||
* testsuite/ld-elf/build-id.exp: New file.
|
||||
* testsuite/ld-elf/pr28639a.rd: Likewise.
|
||||
* testsuite/ld-elf/pr28639b.rd: Likewise.
|
||||
* testsuite/ld-elf/pr28639c.rd: Likewise.
|
||||
* testsuite/ld-elf/pr28639d.rd: Likewise.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Reference to upstream patch:
|
||||
[https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=1f1d0f8888a6c944e612b416a2a6e11abcf5199f]
|
||||
---
|
||||
ld/ldelf.c | 15 ++++++-
|
||||
ld/testsuite/ld-elf/build-id.exp | 77 ++++++++++++++++++++++++++++++++
|
||||
ld/testsuite/ld-elf/pr28639a.rd | 6 +++
|
||||
ld/testsuite/ld-elf/pr28639b.rd | 6 +++
|
||||
ld/testsuite/ld-elf/pr28639c.rd | 10 +++++
|
||||
ld/testsuite/ld-elf/pr28639d.rd | 4 ++
|
||||
6 files changed, 117 insertions(+), 1 deletion(-)
|
||||
create mode 100644 ld/testsuite/ld-elf/build-id.exp
|
||||
create mode 100644 ld/testsuite/ld-elf/pr28639a.rd
|
||||
create mode 100644 ld/testsuite/ld-elf/pr28639b.rd
|
||||
create mode 100644 ld/testsuite/ld-elf/pr28639c.rd
|
||||
create mode 100644 ld/testsuite/ld-elf/pr28639d.rd
|
||||
|
||||
diff --git a/ld/ldelf.c b/ld/ldelf.c
|
||||
index 21e655bb55c..8501d98b48f 100644
|
||||
--- a/ld/ldelf.c
|
||||
+++ b/ld/ldelf.c
|
||||
@@ -1043,6 +1043,15 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
|
||||
/* Do not allow executable files to be used as inputs to the link. */
|
||||
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
|
||||
{
|
||||
+ /* Discard input .note.gnu.build-id sections. */
|
||||
+ s = bfd_get_section_by_name (abfd, ".note.gnu.build-id");
|
||||
+ while (s != NULL)
|
||||
+ {
|
||||
+ if (s != elf_tdata (link_info.output_bfd)->o->build_id.sec)
|
||||
+ s->flags |= SEC_EXCLUDE;
|
||||
+ s = bfd_get_next_section_by_name (NULL, s);
|
||||
+ }
|
||||
+
|
||||
if (abfd->xvec->flavour == bfd_target_elf_flavour
|
||||
&& !bfd_input_just_syms (abfd)
|
||||
&& elf_tdata (abfd) != NULL
|
||||
@@ -1387,6 +1396,9 @@ write_build_id (bfd *abfd)
|
||||
id_bits = contents + size;
|
||||
size = asec->size - size;
|
||||
|
||||
+ /* Clear the build ID field. */
|
||||
+ memset (id_bits, 0, size);
|
||||
+
|
||||
bfd_h_put_32 (abfd, sizeof "GNU", &e_note->namesz);
|
||||
bfd_h_put_32 (abfd, size, &e_note->descsz);
|
||||
bfd_h_put_32 (abfd, NT_GNU_BUILD_ID, &e_note->type);
|
||||
@@ -1418,7 +1430,8 @@ ldelf_setup_build_id (bfd *ibfd)
|
||||
|
||||
flags = (SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY
|
||||
| SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA);
|
||||
- s = bfd_make_section_with_flags (ibfd, ".note.gnu.build-id", flags);
|
||||
+ s = bfd_make_section_anyway_with_flags (ibfd, ".note.gnu.build-id",
|
||||
+ flags);
|
||||
if (s != NULL && bfd_set_section_alignment (s, 2))
|
||||
{
|
||||
struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd);
|
||||
diff --git a/ld/testsuite/ld-elf/build-id.exp b/ld/testsuite/ld-elf/build-id.exp
|
||||
new file mode 100644
|
||||
index 00000000000..19c22a75c4d
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/build-id.exp
|
||||
@@ -0,0 +1,77 @@
|
||||
+# Expect script for --build-id tests.
|
||||
+# Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# This file is part of the GNU Binutils.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
+# MA 02110-1301, USA.
|
||||
+#
|
||||
+
|
||||
+# Exclude non-ELF targets.
|
||||
+
|
||||
+if ![is_elf_format] {
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+if { [istarget frv-*-*] || [istarget lm32-*-*] } {
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+if { !([istarget *-*-linux*]
|
||||
+ || [istarget arm*-*-uclinuxfdpiceabi]
|
||||
+ || [istarget *-*-nacl*]
|
||||
+ || [istarget *-*-gnu*]) } then {
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+run_ld_link_tests [list \
|
||||
+ [list \
|
||||
+ "pr28639a.o" \
|
||||
+ "-r --build-id=md5" \
|
||||
+ "" \
|
||||
+ "" \
|
||||
+ {start.s} \
|
||||
+ {{readelf {--notes} pr28639a.rd}} \
|
||||
+ "pr28639a.o" \
|
||||
+ ] \
|
||||
+ [list \
|
||||
+ "pr28639a.o" \
|
||||
+ "-r --build-id" \
|
||||
+ "" \
|
||||
+ "" \
|
||||
+ {dummy.s} \
|
||||
+ {{readelf {--notes} pr28639b.rd}} \
|
||||
+ "pr28639b.o" \
|
||||
+ ] \
|
||||
+ [list \
|
||||
+ "pr28639a" \
|
||||
+ "--build-id tmpdir/pr28639a.o tmpdir/pr28639b.o" \
|
||||
+ "" \
|
||||
+ "" \
|
||||
+ {dummy.s} \
|
||||
+ {{readelf {--notes} pr28639b.rd} \
|
||||
+ {readelf {--notes} pr28639c.rd}} \
|
||||
+ "pr28639a" \
|
||||
+ ] \
|
||||
+ [list \
|
||||
+ "pr28639b" \
|
||||
+ "--build-id=none tmpdir/pr28639a.o tmpdir/pr28639b.o" \
|
||||
+ "" \
|
||||
+ "" \
|
||||
+ {dummy.s} \
|
||||
+ {{readelf {--notes} pr28639d.rd}} \
|
||||
+ "pr28639b" \
|
||||
+ ] \
|
||||
+]
|
||||
diff --git a/ld/testsuite/ld-elf/pr28639a.rd b/ld/testsuite/ld-elf/pr28639a.rd
|
||||
new file mode 100644
|
||||
index 00000000000..e85087064d0
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/pr28639a.rd
|
||||
@@ -0,0 +1,6 @@
|
||||
+#...
|
||||
+Displaying notes found in: \.note\.gnu\.build-id
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x00000010 NT_GNU_BUILD_ID \(unique build ID bitstring\)
|
||||
+ Build ID: [0-9a-f]+
|
||||
+#pass
|
||||
diff --git a/ld/testsuite/ld-elf/pr28639b.rd b/ld/testsuite/ld-elf/pr28639b.rd
|
||||
new file mode 100644
|
||||
index 00000000000..04dcb04bec2
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/pr28639b.rd
|
||||
@@ -0,0 +1,6 @@
|
||||
+#...
|
||||
+Displaying notes found in: \.note\.gnu\.build-id
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x00000014 NT_GNU_BUILD_ID \(unique build ID bitstring\)
|
||||
+ Build ID: [0-9a-f]+
|
||||
+#pass
|
||||
diff --git a/ld/testsuite/ld-elf/pr28639c.rd b/ld/testsuite/ld-elf/pr28639c.rd
|
||||
new file mode 100644
|
||||
index 00000000000..64221e5fa51
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/pr28639c.rd
|
||||
@@ -0,0 +1,10 @@
|
||||
+#failif
|
||||
+#...
|
||||
+Displaying notes found in: \.note\.gnu\.build-id
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x[0-9a-f]+ NT_GNU_BUILD_ID \(unique build ID bitstring\)
|
||||
+ Build ID: [0-9a-f]+
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x[0-9a-f]+ NT_GNU_BUILD_ID \(unique build ID bitstring\)
|
||||
+ Build ID: [0-9a-f]+
|
||||
+#...
|
||||
diff --git a/ld/testsuite/ld-elf/pr28639d.rd b/ld/testsuite/ld-elf/pr28639d.rd
|
||||
new file mode 100644
|
||||
index 00000000000..897c8493efa
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/pr28639d.rd
|
||||
@@ -0,0 +1,4 @@
|
||||
+#failif
|
||||
+#...
|
||||
+Displaying notes found in: \.note\.gnu\.build-id
|
||||
+#...
|
||||
--
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
From 6e93d0328f499569db7ce6396f94f304ce340df8 Mon Sep 17 00:00:00 2001
|
||||
From f820ab7ea7e94d4df548be3388163ff2efb2ea96 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 6 Mar 2017 23:37:05 -0800
|
||||
Subject: [PATCH] binutils-cross: Do not generate linker script directories
|
||||
@@ -22,7 +22,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
1 file changed, 25 deletions(-)
|
||||
|
||||
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
|
||||
index 46a2db7005c..4bb7c33f560 100755
|
||||
index 0c52ebee4d0..1acbe66bd2e 100755
|
||||
--- a/ld/genscripts.sh
|
||||
+++ b/ld/genscripts.sh
|
||||
@@ -235,31 +235,6 @@ append_to_lib_path()
|
||||
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
From d49016d3faf684319bf3ac37450558920d70be03 Mon Sep 17 00:00:00 2001
|
||||
From b2ccd25828b40310caeb094c0413e3a30a4dc0a5 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Purdie <richard.purdie@linuxfoundation.org>
|
||||
Date: Wed, 19 Feb 2020 09:51:16 -0800
|
||||
Subject: [PATCH] binutils-nativesdk: Search for alternative ld.so.conf in SDK
|
||||
@@ -29,7 +29,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
5 files changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/ld/Makefile.am b/ld/Makefile.am
|
||||
index f8e99325361..fd196541f59 100644
|
||||
index b55a873d927..61db131fb0d 100644
|
||||
--- a/ld/Makefile.am
|
||||
+++ b/ld/Makefile.am
|
||||
@@ -42,7 +42,8 @@ ZLIBINC = @zlibinc@
|
||||
@@ -43,10 +43,10 @@ index f8e99325361..fd196541f59 100644
|
||||
NO_WERROR = @NO_WERROR@
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
|
||||
diff --git a/ld/Makefile.in b/ld/Makefile.in
|
||||
index ef2e99e08da..cb8f5bfb70e 100644
|
||||
index 61e93eeaf1e..860eb21a785 100644
|
||||
--- a/ld/Makefile.in
|
||||
+++ b/ld/Makefile.in
|
||||
@@ -555,7 +555,8 @@ ZLIB = @zlibdir@ -lz
|
||||
@@ -556,7 +556,8 @@ ZLIB = @zlibdir@ -lz
|
||||
ZLIBINC = @zlibinc@
|
||||
ELF_CLFAGS = -DELF_LIST_OPTIONS=@elf_list_options@ \
|
||||
-DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \
|
||||
@@ -57,10 +57,10 @@ index ef2e99e08da..cb8f5bfb70e 100644
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
|
||||
|
||||
diff --git a/ld/ldelf.c b/ld/ldelf.c
|
||||
index 21e655bb55c..d1615003ede 100644
|
||||
index 121c25d948f..34cbc60e5e9 100644
|
||||
--- a/ld/ldelf.c
|
||||
+++ b/ld/ldelf.c
|
||||
@@ -911,7 +911,7 @@ ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force,
|
||||
@@ -930,7 +930,7 @@ ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force,
|
||||
|
||||
info.path = NULL;
|
||||
info.len = info.alloc = 0;
|
||||
@@ -70,7 +70,7 @@ index 21e655bb55c..d1615003ede 100644
|
||||
if (!ldelf_parse_ld_so_conf (&info, tmppath))
|
||||
{
|
||||
diff --git a/ld/ldmain.c b/ld/ldmain.c
|
||||
index 42660eb9a3c..5a4a4d5da3d 100644
|
||||
index ea72b14a301..1ae90a77749 100644
|
||||
--- a/ld/ldmain.c
|
||||
+++ b/ld/ldmain.c
|
||||
@@ -70,6 +70,7 @@ char *program_name;
|
||||
@@ -82,7 +82,7 @@ index 42660eb9a3c..5a4a4d5da3d 100644
|
||||
/* The canonical representation of ld_sysroot. */
|
||||
char *ld_canon_sysroot;
|
||||
diff --git a/ld/ldmain.h b/ld/ldmain.h
|
||||
index 39d08a6c378..4c3519e7970 100644
|
||||
index f6d05a02f59..e60292cd522 100644
|
||||
--- a/ld/ldmain.h
|
||||
+++ b/ld/ldmain.h
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
From 1a9fcaae50e63b993019bd4dc00219e43421efdc Mon Sep 17 00:00:00 2001
|
||||
From 7a7b777cdfded080aab1021fa6bcdb20345f5cfd Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 2 Mar 2015 01:09:58 +0000
|
||||
Subject: [PATCH] Point scripts location to libdir
|
||||
@@ -12,7 +12,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ld/Makefile.am b/ld/Makefile.am
|
||||
index fd196541f59..d94fa7e64e1 100644
|
||||
index 61db131fb0d..5b5ee64d121 100644
|
||||
--- a/ld/Makefile.am
|
||||
+++ b/ld/Makefile.am
|
||||
@@ -51,7 +51,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
|
||||
@@ -25,10 +25,10 @@ index fd196541f59..d94fa7e64e1 100644
|
||||
EMUL = @EMUL@
|
||||
EMULATION_OFILES = @EMULATION_OFILES@
|
||||
diff --git a/ld/Makefile.in b/ld/Makefile.in
|
||||
index cb8f5bfb70e..9a58879c5ca 100644
|
||||
index 860eb21a785..d719747919c 100644
|
||||
--- a/ld/Makefile.in
|
||||
+++ b/ld/Makefile.in
|
||||
@@ -563,7 +563,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
|
||||
@@ -564,7 +564,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
|
||||
# We put the scripts in the directory $(scriptdir)/ldscripts.
|
||||
# We can't put the scripts in $(datadir) because the SEARCH_DIR
|
||||
# directives need to be different for native and cross linkers.
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
From 29517900352336708495d41902b5b7e8cc9a401a Mon Sep 17 00:00:00 2001
|
||||
From edddb1f294d667eac94649ba0665fe464990ed18 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 2 Mar 2015 01:27:17 +0000
|
||||
Subject: [PATCH] Only generate an RPATH entry if LD_RUN_PATH is not empty
|
||||
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/ld/ldelf.c b/ld/ldelf.c
|
||||
index d1615003ede..6a894285b11 100644
|
||||
index 34cbc60e5e9..b1965a9e96f 100644
|
||||
--- a/ld/ldelf.c
|
||||
+++ b/ld/ldelf.c
|
||||
@@ -1250,6 +1250,8 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
|
||||
@@ -1277,6 +1277,8 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
|
||||
&& command_line.rpath == NULL)
|
||||
{
|
||||
path = (const char *) getenv ("LD_RUN_PATH");
|
||||
@@ -26,7 +26,7 @@ index d1615003ede..6a894285b11 100644
|
||||
if (path
|
||||
&& ldelf_search_needed (path, &n, force,
|
||||
is_linux, elfsize))
|
||||
@@ -1610,6 +1612,8 @@ ldelf_before_allocation (char *audit, char *depaudit,
|
||||
@@ -1636,6 +1638,8 @@ ldelf_before_allocation (char *audit, char *depaudit,
|
||||
rpath = command_line.rpath;
|
||||
if (rpath == NULL)
|
||||
rpath = (const char *) getenv ("LD_RUN_PATH");
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
From 37581c8ce9d98a1183706e12a2c9a73f7f40462d Mon Sep 17 00:00:00 2001
|
||||
From fc9e8b99969bb32a4b009eab763bade6c554ef73 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 2 Mar 2015 01:39:01 +0000
|
||||
Subject: [PATCH] don't let the distro compiler point to the wrong installation
|
||||
@@ -17,10 +17,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
|
||||
index 4f1213b983b..2ba18b75cac 100644
|
||||
index abef3c4601b..880c8826482 100644
|
||||
--- a/libiberty/Makefile.in
|
||||
+++ b/libiberty/Makefile.in
|
||||
@@ -367,7 +367,8 @@ install-strip: install
|
||||
@@ -385,7 +385,8 @@ install-strip: install
|
||||
# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the
|
||||
# default multilib, so we have to take CFLAGS into account as well,
|
||||
# since it will be passed the multilib flags.
|
||||
+33
-15
@@ -1,4 +1,4 @@
|
||||
From 99e1565b9d2b929d4ee4e9da6f63766b22b23fc3 Mon Sep 17 00:00:00 2001
|
||||
From 9fb1bafb20371d82b674778d2a8b5c9444fed417 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Fri, 15 Jan 2016 06:31:09 +0000
|
||||
Subject: [PATCH] warn for uses of system directories when cross linking
|
||||
@@ -58,10 +58,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
ld/ld.texi | 12 ++++++++++++
|
||||
ld/ldfile.c | 17 +++++++++++++++++
|
||||
ld/ldlex.h | 2 ++
|
||||
ld/ldmain.c | 2 ++
|
||||
ld/ldmain.c | 6 ++++--
|
||||
ld/lexsup.c | 16 ++++++++++++++++
|
||||
9 files changed, 86 insertions(+)
|
||||
9 files changed, 88 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ld/config.in b/ld/config.in
|
||||
index 26d55a00d47..ffad464783c 100644
|
||||
--- a/ld/config.in
|
||||
+++ b/ld/config.in
|
||||
@@ -43,6 +43,9 @@
|
||||
@@ -74,9 +76,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
/* Additional extension a shared object might have. */
|
||||
#undef EXTRA_SHLIB_EXTENSION
|
||||
|
||||
diff --git a/ld/configure b/ld/configure
|
||||
index 26150d62898..1f9ec8ec580 100755
|
||||
--- a/ld/configure
|
||||
+++ b/ld/configure
|
||||
@@ -829,6 +829,7 @@ with_lib_path
|
||||
@@ -831,6 +831,7 @@ with_lib_path
|
||||
enable_targets
|
||||
enable_64_bit_bfd
|
||||
with_sysroot
|
||||
@@ -84,7 +88,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
enable_gold
|
||||
enable_got
|
||||
enable_compressed_debug_sections
|
||||
@@ -1498,6 +1499,8 @@ Optional Features:
|
||||
@@ -1500,6 +1501,8 @@ Optional Features:
|
||||
--enable-checking enable run-time checks
|
||||
--enable-targets alternative target configurations
|
||||
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
|
||||
@@ -93,7 +97,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
|
||||
--enable-got=<type> GOT handling scheme (target, single, negative,
|
||||
multigot)
|
||||
@@ -15215,6 +15218,19 @@ fi
|
||||
@@ -15312,6 +15315,19 @@ fi
|
||||
|
||||
|
||||
|
||||
@@ -113,9 +117,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
# Check whether --enable-gold was given.
|
||||
if test "${enable_gold+set}" = set; then :
|
||||
enableval=$enable_gold; case "${enableval}" in
|
||||
diff --git a/ld/configure.ac b/ld/configure.ac
|
||||
index 7f4cff079b7..57d1abff870 100644
|
||||
--- a/ld/configure.ac
|
||||
+++ b/ld/configure.ac
|
||||
@@ -106,6 +106,16 @@ AC_SUBST(use_sysroot)
|
||||
@@ -102,6 +102,16 @@ AC_SUBST(use_sysroot)
|
||||
AC_SUBST(TARGET_SYSTEM_ROOT)
|
||||
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
|
||||
|
||||
@@ -132,6 +138,8 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
dnl Use --enable-gold to decide if this linker should be the default.
|
||||
dnl "install_as_default" is set to false if gold is the default linker.
|
||||
dnl "installed_linker" is the installed BFD linker name.
|
||||
diff --git a/ld/ld.h b/ld/ld.h
|
||||
index f3086bf30de..db5064243c7 100644
|
||||
--- a/ld/ld.h
|
||||
+++ b/ld/ld.h
|
||||
@@ -162,6 +162,14 @@ typedef struct
|
||||
@@ -149,9 +157,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
/* Big or little endian as set on command line. */
|
||||
enum endian_enum endian;
|
||||
|
||||
diff --git a/ld/ld.texi b/ld/ld.texi
|
||||
index fc75e9b3625..dca697d626e 100644
|
||||
--- a/ld/ld.texi
|
||||
+++ b/ld/ld.texi
|
||||
@@ -2863,6 +2863,18 @@ string identifying the original linked f
|
||||
@@ -2892,6 +2892,18 @@ string identifying the original linked file does not change.
|
||||
|
||||
Passing @code{none} for @var{style} disables the setting from any
|
||||
@code{--build-id} options earlier on the command line.
|
||||
@@ -170,9 +180,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
@end table
|
||||
|
||||
@c man end
|
||||
diff --git a/ld/ldfile.c b/ld/ldfile.c
|
||||
index 731ae5f7aed..dd8f03fd960 100644
|
||||
--- a/ld/ldfile.c
|
||||
+++ b/ld/ldfile.c
|
||||
@@ -117,6 +117,23 @@ ldfile_add_library_path (const char *nam
|
||||
@@ -117,6 +117,23 @@ ldfile_add_library_path (const char *name, bool cmdline)
|
||||
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
|
||||
else
|
||||
new_dirs->name = xstrdup (name);
|
||||
@@ -196,9 +208,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
}
|
||||
|
||||
/* Try to open a BFD for a lang_input_statement. */
|
||||
diff --git a/ld/ldlex.h b/ld/ldlex.h
|
||||
index bc58fea73cc..a1595589197 100644
|
||||
--- a/ld/ldlex.h
|
||||
+++ b/ld/ldlex.h
|
||||
@@ -163,6 +163,8 @@ enum option_values
|
||||
@@ -164,6 +164,8 @@ enum option_values
|
||||
OPTION_CTF_VARIABLES,
|
||||
OPTION_NO_CTF_VARIABLES,
|
||||
OPTION_CTF_SHARE_TYPES,
|
||||
@@ -207,9 +221,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
};
|
||||
|
||||
/* The initial parser states. */
|
||||
diff --git a/ld/ldmain.c b/ld/ldmain.c
|
||||
index 1ae90a77749..f40750fd816 100644
|
||||
--- a/ld/ldmain.c
|
||||
+++ b/ld/ldmain.c
|
||||
@@ -321,6 +321,8 @@ main (int argc, char **argv)
|
||||
@@ -322,6 +322,8 @@ main (int argc, char **argv)
|
||||
command_line.warn_mismatch = true;
|
||||
command_line.warn_search_mismatch = true;
|
||||
command_line.check_section_addresses = -1;
|
||||
@@ -218,7 +234,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
/* We initialize DEMANGLING based on the environment variable
|
||||
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
|
||||
@@ -1444,7 +1446,7 @@ undefined_symbol (struct bfd_link_info *
|
||||
@@ -1447,7 +1449,7 @@ undefined_symbol (struct bfd_link_info *info,
|
||||
argv[1] = "undefined-symbol";
|
||||
argv[2] = (char *) name;
|
||||
argv[3] = NULL;
|
||||
@@ -227,7 +243,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
if (verbose)
|
||||
einfo (_("%P: About to run error handling script '%s' with arguments: '%s' '%s'\n"),
|
||||
argv[0], argv[1], argv[2]);
|
||||
@@ -1465,7 +1467,7 @@ undefined_symbol (struct bfd_link_info *
|
||||
@@ -1468,7 +1470,7 @@ undefined_symbol (struct bfd_link_info *info,
|
||||
carry on to issue the normal error message. */
|
||||
}
|
||||
#endif /* SUPPORT_ERROR_HANDLING_SCRIPT */
|
||||
@@ -236,9 +252,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
if (section != NULL)
|
||||
{
|
||||
if (error_count < MAX_ERRORS_IN_A_ROW)
|
||||
diff --git a/ld/lexsup.c b/ld/lexsup.c
|
||||
index 5acc47ed5a0..d03c6136ccf 100644
|
||||
--- a/ld/lexsup.c
|
||||
+++ b/ld/lexsup.c
|
||||
@@ -595,6 +595,14 @@ static const struct ld_option ld_options
|
||||
@@ -600,6 +600,14 @@ static const struct ld_option ld_options[] =
|
||||
" <method> is: share-unconflicted (default),\n"
|
||||
" share-duplicated"),
|
||||
TWO_DASHES },
|
||||
@@ -253,7 +271,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
};
|
||||
|
||||
#define OPTION_COUNT ARRAY_SIZE (ld_options)
|
||||
@@ -1686,6 +1694,14 @@ parse_args (unsigned argc, char **argv)
|
||||
@@ -1702,6 +1710,14 @@ parse_args (unsigned argc, char **argv)
|
||||
config.print_map_discarded = true;
|
||||
break;
|
||||
|
||||
+3
-4
@@ -1,4 +1,4 @@
|
||||
From b77c5a67d4ac2513d0b4bab5e4dd1c33b339689b Mon Sep 17 00:00:00 2001
|
||||
From 00ae1ee97ad3ad0624798b28c6bab94a19b3ef39 Mon Sep 17 00:00:00 2001
|
||||
From: Zhenhua Luo <zhenhua.luo@nxp.com>
|
||||
Date: Sat, 11 Jun 2016 22:08:29 -0500
|
||||
Subject: [PATCH] fix the incorrect assembling for ppc wait mnemonic
|
||||
@@ -7,15 +7,14 @@ The wait mnemonic for ppc targets is incorrectly assembled into 0x7c00003c due
|
||||
to duplicated address definition with waitasec instruction. The issue causes
|
||||
kernel boot calltrace for ppc targets when wait instruction is executed.
|
||||
|
||||
Signed-off-by: Zhenhua Luo <zhenhua.luo@nxp.com>
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Zhenhua Luo <zhenhua.luo@nxp.com>
|
||||
---
|
||||
opcodes/ppc-opc.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
|
||||
index 13d8b6c3c07..cd979f9c80c 100644
|
||||
index a424dd924de..406d5b60917 100644
|
||||
--- a/opcodes/ppc-opc.c
|
||||
+++ b/opcodes/ppc-opc.c
|
||||
@@ -6378,8 +6378,6 @@ const struct powerpc_opcode powerpc_opcodes[] = {
|
||||
+2907
-817
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,4 +1,4 @@
|
||||
From ff256618bf85acca889920a1fb63ddea64cc98bc Mon Sep 17 00:00:00 2001
|
||||
From 1c4581a059afe2799bb825b388ae92f8fa6f19a3 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Mon, 2 Mar 2015 01:42:38 +0000
|
||||
Subject: [PATCH] Fix rpath in libtool when sysroot is enabled
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
From 4b612f902c596838ab260194f840a466f8291618 Mon Sep 17 00:00:00 2001
|
||||
From d71c715554a054c534954b0aa357ca699ed68430 Mon Sep 17 00:00:00 2001
|
||||
From: Ross Burton <ross.burton@intel.com>
|
||||
Date: Mon, 6 Mar 2017 23:33:27 -0800
|
||||
Subject: [PATCH] sync with OE libtool changes
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
From 707a5d49ecaa4fd722176d764251360a44fc5655 Mon Sep 17 00:00:00 2001
|
||||
From 787d7cd71d7886d3193c0fd747101c54ad7c3cd8 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 15 Apr 2020 14:17:20 -0700
|
||||
Subject: [PATCH] Check for clang before checking gcc version
|
||||
@@ -18,10 +18,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index e8ba1a1d3de..e00d4764583 100755
|
||||
index 6a1da1665d8..916656dc233 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -5275,7 +5275,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
@@ -5287,7 +5287,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
@@ -31,7 +31,7 @@ index e8ba1a1d3de..e00d4764583 100755
|
||||
#endif
|
||||
int main() {}
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 3a8a3ae1f3b..c7f08b802d0 100644
|
||||
index 2b10e9a1b02..677a0196c2b 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1309,7 +1309,7 @@ if test "$GCC" = yes; then
|
||||
-234
@@ -1,234 +0,0 @@
|
||||
From 1c611b40e6bfc8029bff7696814330b5bc0ee5c0 Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Mon, 26 Jul 2021 05:59:55 -0700
|
||||
Subject: [PATCH] bfd: Close the file descriptor if there is no archive fd
|
||||
|
||||
Close the file descriptor if there is no archive plugin file descriptor
|
||||
to avoid running out of file descriptors on thin archives with many
|
||||
archive members.
|
||||
|
||||
bfd/
|
||||
|
||||
PR ld/28138
|
||||
* plugin.c (bfd_plugin_close_file_descriptor): Close the file
|
||||
descriptor there is no archive plugin file descriptor.
|
||||
|
||||
ld/
|
||||
|
||||
PR ld/28138
|
||||
* testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for
|
||||
native build.
|
||||
|
||||
PR ld/28138
|
||||
* testsuite/ld-plugin/lto.exp: Run ld/28138 tests.
|
||||
* testsuite/ld-plugin/pr28138.c: New file.
|
||||
* testsuite/ld-plugin/pr28138-1.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-2.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-3.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-4.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-5.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-6.c: Likewise.
|
||||
* testsuite/ld-plugin/pr28138-7.c: Likewise.
|
||||
|
||||
(cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742)
|
||||
(cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2)
|
||||
|
||||
Upstream-Status: Accepted [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=1c611b40e6bfc8029bff7696814330b5bc0ee5c0]
|
||||
---
|
||||
bfd/plugin.c | 8 +++++++
|
||||
ld/testsuite/ld-plugin/lto.exp | 34 ++++++++++++++++++++++++++++++
|
||||
ld/testsuite/ld-plugin/pr28138-1.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-2.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-3.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-4.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-5.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-6.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138-7.c | 6 ++++++
|
||||
ld/testsuite/ld-plugin/pr28138.c | 20 ++++++++++++++++++
|
||||
10 files changed, 104 insertions(+)
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-1.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-2.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-3.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-4.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-5.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-6.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138-7.c
|
||||
create mode 100644 ld/testsuite/ld-plugin/pr28138.c
|
||||
|
||||
diff --git a/bfd/plugin.c b/bfd/plugin.c
|
||||
index 6cfa2b66470..3bab8febe88 100644
|
||||
--- a/bfd/plugin.c
|
||||
+++ b/bfd/plugin.c
|
||||
@@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *abfd, int fd)
|
||||
&& !bfd_is_thin_archive (abfd->my_archive))
|
||||
abfd = abfd->my_archive;
|
||||
|
||||
+ /* Close the file descriptor if there is no archive plugin file
|
||||
+ descriptor. */
|
||||
+ if (abfd->archive_plugin_fd == -1)
|
||||
+ {
|
||||
+ close (fd);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
abfd->archive_plugin_fd_open_count--;
|
||||
/* Dup the archive plugin file descriptor for later use, which
|
||||
will be closed by _bfd_archive_close_and_cleanup. */
|
||||
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
|
||||
index def69e43ab3..999d911ce6a 100644
|
||||
--- a/ld/testsuite/ld-plugin/lto.exp
|
||||
+++ b/ld/testsuite/ld-plugin/lto.exp
|
||||
@@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_shared_available] } {
|
||||
}
|
||||
}
|
||||
|
||||
+run_cc_link_tests [list \
|
||||
+ [list \
|
||||
+ "Build pr28138.a" \
|
||||
+ "-T" "" \
|
||||
+ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \
|
||||
+ pr28138-6.c pr28138-7.c} {} "pr28138.a" \
|
||||
+ ] \
|
||||
+ [list \
|
||||
+ "Build pr28138.o" \
|
||||
+ "" "" \
|
||||
+ {pr28138.c} {} \
|
||||
+ ] \
|
||||
+]
|
||||
+
|
||||
+set exec_output [run_host_cmd "sh" \
|
||||
+ "-c \"ulimit -n 20; \
|
||||
+ $CC -Btmpdir/ld -o tmpdir/pr28138 \
|
||||
+ tmpdir/pr28138.o tmpdir/pr28138.a\""]
|
||||
+set exec_output [prune_warnings $exec_output]
|
||||
+if [string match "" $exec_output] then {
|
||||
+ if { [isnative] } {
|
||||
+ set exec_output [run_host_cmd "tmpdir/pr28138" ""]
|
||||
+ if [string match "PASS" $exec_output] then {
|
||||
+ pass "PR ld/28138"
|
||||
+ } else {
|
||||
+ fail "PR ld/28138"
|
||||
+ }
|
||||
+ } else {
|
||||
+ pass "PR ld/28138"
|
||||
+ }
|
||||
+} else {
|
||||
+ fail "PR ld/28138"
|
||||
+}
|
||||
+
|
||||
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"]
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-1.c b/ld/testsuite/ld-plugin/pr28138-1.c
|
||||
new file mode 100644
|
||||
index 00000000000..51d119e1642
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-1.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a0(void);
|
||||
+int
|
||||
+a1(void)
|
||||
+{
|
||||
+ return 1 + a0();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-2.c b/ld/testsuite/ld-plugin/pr28138-2.c
|
||||
new file mode 100644
|
||||
index 00000000000..1120cd797e9
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-2.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a1(void);
|
||||
+int
|
||||
+a2(void)
|
||||
+{
|
||||
+ return 1 + a1();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-3.c b/ld/testsuite/ld-plugin/pr28138-3.c
|
||||
new file mode 100644
|
||||
index 00000000000..ec464947ee6
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-3.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a2(void);
|
||||
+int
|
||||
+a3(void)
|
||||
+{
|
||||
+ return 1 + a2();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-4.c b/ld/testsuite/ld-plugin/pr28138-4.c
|
||||
new file mode 100644
|
||||
index 00000000000..475701b2c5c
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-4.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a3(void);
|
||||
+int
|
||||
+a4(void)
|
||||
+{
|
||||
+ return 1 + a3();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-5.c b/ld/testsuite/ld-plugin/pr28138-5.c
|
||||
new file mode 100644
|
||||
index 00000000000..e24f86c363e
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-5.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a4(void);
|
||||
+int
|
||||
+a5(void)
|
||||
+{
|
||||
+ return 1 + a4();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-6.c b/ld/testsuite/ld-plugin/pr28138-6.c
|
||||
new file mode 100644
|
||||
index 00000000000..b5b938bdb21
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-6.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a5(void);
|
||||
+int
|
||||
+a6(void)
|
||||
+{
|
||||
+ return 1 + a5();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138-7.c b/ld/testsuite/ld-plugin/pr28138-7.c
|
||||
new file mode 100644
|
||||
index 00000000000..4ef75bf0f0c
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138-7.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+extern int a6(void);
|
||||
+int
|
||||
+a7(void)
|
||||
+{
|
||||
+ return 1 + a6();
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-plugin/pr28138.c b/ld/testsuite/ld-plugin/pr28138.c
|
||||
new file mode 100644
|
||||
index 00000000000..68252c9f382
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-plugin/pr28138.c
|
||||
@@ -0,0 +1,20 @@
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+extern int a7(void);
|
||||
+
|
||||
+int
|
||||
+a0(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ if (a7() == 7)
|
||||
+ {
|
||||
+ printf ("PASS\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
--
|
||||
2.31.1
|
||||
|
||||
-247
@@ -1,247 +0,0 @@
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Wed, 15 Dec 2021 01:18:42 +0000 (+1030)
|
||||
Subject: PR28694, Out-of-bounds write in stab_xcoff_builtin_type
|
||||
CVE: CVE-2021-45078
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=161e87d12167b1e36193385485c1f6ce92f74f02]
|
||||
|
||||
PR28694, Out-of-bounds write in stab_xcoff_builtin_type
|
||||
|
||||
PR 28694
|
||||
* stabs.c (stab_xcoff_builtin_type): Make typenum unsigned.
|
||||
Negate typenum earlier, simplifying bounds checking. Correct
|
||||
off-by-one indexing. Adjust switch cases.
|
||||
---
|
||||
|
||||
diff --git a/binutils/stabs.c b/binutils/stabs.c
|
||||
index 274bfb0e7fa..83ee3ea5fa4 100644
|
||||
--- a/binutils/stabs.c
|
||||
+++ b/binutils/stabs.c
|
||||
@@ -202,7 +202,7 @@ static debug_type stab_find_type (void *, struct stab_handle *, const int *);
|
||||
static bool stab_record_type
|
||||
(void *, struct stab_handle *, const int *, debug_type);
|
||||
static debug_type stab_xcoff_builtin_type
|
||||
- (void *, struct stab_handle *, int);
|
||||
+ (void *, struct stab_handle *, unsigned int);
|
||||
static debug_type stab_find_tagged_type
|
||||
(void *, struct stab_handle *, const char *, int, enum debug_type_kind);
|
||||
static debug_type *stab_demangle_argtypes
|
||||
@@ -3496,166 +3496,167 @@ stab_record_type (void *dhandle ATTRIBUTE_UNUSED, struct stab_handle *info,
|
||||
|
||||
static debug_type
|
||||
stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
|
||||
- int typenum)
|
||||
+ unsigned int typenum)
|
||||
{
|
||||
debug_type rettype;
|
||||
const char *name;
|
||||
|
||||
- if (typenum >= 0 || typenum < -XCOFF_TYPE_COUNT)
|
||||
+ typenum = -typenum - 1;
|
||||
+ if (typenum >= XCOFF_TYPE_COUNT)
|
||||
{
|
||||
- fprintf (stderr, _("Unrecognized XCOFF type %d\n"), typenum);
|
||||
+ fprintf (stderr, _("Unrecognized XCOFF type %d\n"), -typenum - 1);
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
- if (info->xcoff_types[-typenum] != NULL)
|
||||
- return info->xcoff_types[-typenum];
|
||||
+ if (info->xcoff_types[typenum] != NULL)
|
||||
+ return info->xcoff_types[typenum];
|
||||
|
||||
- switch (-typenum)
|
||||
+ switch (typenum)
|
||||
{
|
||||
- case 1:
|
||||
+ case 0:
|
||||
/* The size of this and all the other types are fixed, defined
|
||||
by the debugging format. */
|
||||
name = "int";
|
||||
rettype = debug_make_int_type (dhandle, 4, false);
|
||||
break;
|
||||
- case 2:
|
||||
+ case 1:
|
||||
name = "char";
|
||||
rettype = debug_make_int_type (dhandle, 1, false);
|
||||
break;
|
||||
- case 3:
|
||||
+ case 2:
|
||||
name = "short";
|
||||
rettype = debug_make_int_type (dhandle, 2, false);
|
||||
break;
|
||||
- case 4:
|
||||
+ case 3:
|
||||
name = "long";
|
||||
rettype = debug_make_int_type (dhandle, 4, false);
|
||||
break;
|
||||
- case 5:
|
||||
+ case 4:
|
||||
name = "unsigned char";
|
||||
rettype = debug_make_int_type (dhandle, 1, true);
|
||||
break;
|
||||
- case 6:
|
||||
+ case 5:
|
||||
name = "signed char";
|
||||
rettype = debug_make_int_type (dhandle, 1, false);
|
||||
break;
|
||||
- case 7:
|
||||
+ case 6:
|
||||
name = "unsigned short";
|
||||
rettype = debug_make_int_type (dhandle, 2, true);
|
||||
break;
|
||||
- case 8:
|
||||
+ case 7:
|
||||
name = "unsigned int";
|
||||
rettype = debug_make_int_type (dhandle, 4, true);
|
||||
break;
|
||||
- case 9:
|
||||
+ case 8:
|
||||
name = "unsigned";
|
||||
rettype = debug_make_int_type (dhandle, 4, true);
|
||||
break;
|
||||
- case 10:
|
||||
+ case 9:
|
||||
name = "unsigned long";
|
||||
rettype = debug_make_int_type (dhandle, 4, true);
|
||||
break;
|
||||
- case 11:
|
||||
+ case 10:
|
||||
name = "void";
|
||||
rettype = debug_make_void_type (dhandle);
|
||||
break;
|
||||
- case 12:
|
||||
+ case 11:
|
||||
/* IEEE single precision (32 bit). */
|
||||
name = "float";
|
||||
rettype = debug_make_float_type (dhandle, 4);
|
||||
break;
|
||||
- case 13:
|
||||
+ case 12:
|
||||
/* IEEE double precision (64 bit). */
|
||||
name = "double";
|
||||
rettype = debug_make_float_type (dhandle, 8);
|
||||
break;
|
||||
- case 14:
|
||||
+ case 13:
|
||||
/* This is an IEEE double on the RS/6000, and different machines
|
||||
with different sizes for "long double" should use different
|
||||
negative type numbers. See stabs.texinfo. */
|
||||
name = "long double";
|
||||
rettype = debug_make_float_type (dhandle, 8);
|
||||
break;
|
||||
- case 15:
|
||||
+ case 14:
|
||||
name = "integer";
|
||||
rettype = debug_make_int_type (dhandle, 4, false);
|
||||
break;
|
||||
- case 16:
|
||||
+ case 15:
|
||||
name = "boolean";
|
||||
rettype = debug_make_bool_type (dhandle, 4);
|
||||
break;
|
||||
- case 17:
|
||||
+ case 16:
|
||||
name = "short real";
|
||||
rettype = debug_make_float_type (dhandle, 4);
|
||||
break;
|
||||
- case 18:
|
||||
+ case 17:
|
||||
name = "real";
|
||||
rettype = debug_make_float_type (dhandle, 8);
|
||||
break;
|
||||
- case 19:
|
||||
+ case 18:
|
||||
/* FIXME */
|
||||
name = "stringptr";
|
||||
rettype = NULL;
|
||||
break;
|
||||
- case 20:
|
||||
+ case 19:
|
||||
/* FIXME */
|
||||
name = "character";
|
||||
rettype = debug_make_int_type (dhandle, 1, true);
|
||||
break;
|
||||
- case 21:
|
||||
+ case 20:
|
||||
name = "logical*1";
|
||||
rettype = debug_make_bool_type (dhandle, 1);
|
||||
break;
|
||||
- case 22:
|
||||
+ case 21:
|
||||
name = "logical*2";
|
||||
rettype = debug_make_bool_type (dhandle, 2);
|
||||
break;
|
||||
- case 23:
|
||||
+ case 22:
|
||||
name = "logical*4";
|
||||
rettype = debug_make_bool_type (dhandle, 4);
|
||||
break;
|
||||
- case 24:
|
||||
+ case 23:
|
||||
name = "logical";
|
||||
rettype = debug_make_bool_type (dhandle, 4);
|
||||
break;
|
||||
- case 25:
|
||||
+ case 24:
|
||||
/* Complex type consisting of two IEEE single precision values. */
|
||||
name = "complex";
|
||||
rettype = debug_make_complex_type (dhandle, 8);
|
||||
break;
|
||||
- case 26:
|
||||
+ case 25:
|
||||
/* Complex type consisting of two IEEE double precision values. */
|
||||
name = "double complex";
|
||||
rettype = debug_make_complex_type (dhandle, 16);
|
||||
break;
|
||||
- case 27:
|
||||
+ case 26:
|
||||
name = "integer*1";
|
||||
rettype = debug_make_int_type (dhandle, 1, false);
|
||||
break;
|
||||
- case 28:
|
||||
+ case 27:
|
||||
name = "integer*2";
|
||||
rettype = debug_make_int_type (dhandle, 2, false);
|
||||
break;
|
||||
- case 29:
|
||||
+ case 28:
|
||||
name = "integer*4";
|
||||
rettype = debug_make_int_type (dhandle, 4, false);
|
||||
break;
|
||||
- case 30:
|
||||
+ case 29:
|
||||
/* FIXME */
|
||||
name = "wchar";
|
||||
rettype = debug_make_int_type (dhandle, 2, false);
|
||||
break;
|
||||
- case 31:
|
||||
+ case 30:
|
||||
name = "long long";
|
||||
rettype = debug_make_int_type (dhandle, 8, false);
|
||||
break;
|
||||
- case 32:
|
||||
+ case 31:
|
||||
name = "unsigned long long";
|
||||
rettype = debug_make_int_type (dhandle, 8, true);
|
||||
break;
|
||||
- case 33:
|
||||
+ case 32:
|
||||
name = "logical*8";
|
||||
rettype = debug_make_bool_type (dhandle, 8);
|
||||
break;
|
||||
- case 34:
|
||||
+ case 33:
|
||||
name = "integer*8";
|
||||
rettype = debug_make_int_type (dhandle, 8, false);
|
||||
break;
|
||||
@@ -3664,9 +3665,7 @@ stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
|
||||
}
|
||||
|
||||
rettype = debug_name_type (dhandle, name, rettype);
|
||||
-
|
||||
- info->xcoff_types[-typenum] = rettype;
|
||||
-
|
||||
+ info->xcoff_types[typenum] = rettype;
|
||||
return rettype;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user