gnu: binutils: Update to 2.38.
If this commit gives a deja vu, you are not dreaming; see commit
3e3a37b2bc
.
* gnu/packages/base.scm (binutils): Update to 2.38.
[source](patches): Remove obsolete.
[arguments]: Add #:make-flags.
[properties]: New field.
(binutils+documentation): New variable.
(binutils-gold): Inherit from BINUTILS+DOCUMENTATION.
* gnu/packages/make-bootstrap.scm (%binutils-static)[arguments]: Inherit
#:make-flags.
* gnu/packages/patches/binutils-2.37-file-descriptor-leak.patch,
gnu/packages/patches/binutils-CVE-2021-45078.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
master
parent
6c80f4949f
commit
40f96ea667
|
@ -907,12 +907,10 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/beancount-disable-googleapis-fonts.patch \
|
%D%/packages/patches/beancount-disable-googleapis-fonts.patch \
|
||||||
%D%/packages/patches/beignet-correct-file-names.patch \
|
%D%/packages/patches/beignet-correct-file-names.patch \
|
||||||
%D%/packages/patches/bidiv-update-fribidi.patch \
|
%D%/packages/patches/bidiv-update-fribidi.patch \
|
||||||
%D%/packages/patches/binutils-2.37-file-descriptor-leak.patch \
|
|
||||||
%D%/packages/patches/binutils-boot-2.20.1a.patch \
|
%D%/packages/patches/binutils-boot-2.20.1a.patch \
|
||||||
%D%/packages/patches/binutils-loongson-workaround.patch \
|
%D%/packages/patches/binutils-loongson-workaround.patch \
|
||||||
%D%/packages/patches/binutils-mingw-w64-timestamp.patch \
|
%D%/packages/patches/binutils-mingw-w64-timestamp.patch \
|
||||||
%D%/packages/patches/binutils-mingw-w64-deterministic.patch \
|
%D%/packages/patches/binutils-mingw-w64-deterministic.patch \
|
||||||
%D%/packages/patches/binutils-CVE-2021-45078.patch \
|
|
||||||
%D%/packages/patches/bloomberg-bde-cmake-module-path.patch \
|
%D%/packages/patches/bloomberg-bde-cmake-module-path.patch \
|
||||||
%D%/packages/patches/bloomberg-bde-tools-fix-install-path.patch \
|
%D%/packages/patches/bloomberg-bde-tools-fix-install-path.patch \
|
||||||
%D%/packages/patches/bpftrace-disable-bfd-disasm.patch \
|
%D%/packages/patches/bpftrace-disable-bfd-disasm.patch \
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
;;; Copyright © 2016, 2018 Alex Vong <alexvong1995@gmail.com>
|
;;; Copyright © 2016, 2018 Alex Vong <alexvong1995@gmail.com>
|
||||||
;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
|
;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
|
||||||
;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||||
;;; Copyright © 2017, 2018, 2020 Marius Bakke <mbakke@fastmail.com>
|
;;; Copyright © 2017, 2018, 2020, 2022 Marius Bakke <marius@gnu.org>
|
||||||
;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
|
;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
|
||||||
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
|
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
|
||||||
;;; Copyright © 2018, 2019, 2022 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2018, 2019, 2022 Ricardo Wurmus <rekado@elephly.net>
|
||||||
|
@ -511,17 +511,15 @@ change. GNU make offers many powerful extensions over the standard utility.")
|
||||||
(define-public binutils
|
(define-public binutils
|
||||||
(package
|
(package
|
||||||
(name "binutils")
|
(name "binutils")
|
||||||
(version "2.37")
|
(version "2.38")
|
||||||
(source
|
(source
|
||||||
(origin
|
(origin
|
||||||
(method url-fetch)
|
(method url-fetch)
|
||||||
(uri (string-append "mirror://gnu/binutils/binutils-"
|
(uri (string-append "mirror://gnu/binutils/binutils-"
|
||||||
version ".tar.bz2"))
|
version ".tar.bz2"))
|
||||||
(sha256
|
(sha256
|
||||||
(base32 "1m3b2rdfv1dmdpd0bzg1hy7i8a2qng53szc6livyi3nh6101mz37"))
|
(base32 "1y0fb4qgxaxfyf81x9fqq9w5609mkah0b7wm1f7ab9kpy0fcf3h7"))
|
||||||
(patches (search-patches "binutils-loongson-workaround.patch"
|
(patches (search-patches "binutils-loongson-workaround.patch"))))
|
||||||
"binutils-2.37-file-descriptor-leak.patch"
|
|
||||||
"binutils-CVE-2021-45078.patch"))))
|
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:out-of-source? #t ;recommended in the README
|
`(#:out-of-source? #t ;recommended in the README
|
||||||
|
@ -550,7 +548,16 @@ change. GNU make offers many powerful extensions over the standard utility.")
|
||||||
"--enable-compressed-debug-sections=all"
|
"--enable-compressed-debug-sections=all"
|
||||||
"--enable-lto"
|
"--enable-lto"
|
||||||
"--enable-separate-code"
|
"--enable-separate-code"
|
||||||
"--enable-threads")))
|
"--enable-threads")
|
||||||
|
;; XXX: binutils 2.38 was released without generated manuals:
|
||||||
|
;; <https://sourceware.org/bugzilla/show_bug.cgi?id=28909>. To avoid
|
||||||
|
;; a circular dependency on texinfo, prevent the build system from
|
||||||
|
;; creating the manuals by calling "true" instead of "makeinfo" ...
|
||||||
|
#:make-flags '("MAKEINFO=true")))
|
||||||
|
|
||||||
|
;; ... and "hide" this package such that users who install binutils get
|
||||||
|
;; the version with documentation defined below.
|
||||||
|
(properties '((hidden? . #t)))
|
||||||
|
|
||||||
(synopsis "Binary utilities: bfd gas gprof ld")
|
(synopsis "Binary utilities: bfd gas gprof ld")
|
||||||
(description
|
(description
|
||||||
|
@ -563,6 +570,16 @@ included.")
|
||||||
(license gpl3+)
|
(license gpl3+)
|
||||||
(home-page "https://www.gnu.org/software/binutils/")))
|
(home-page "https://www.gnu.org/software/binutils/")))
|
||||||
|
|
||||||
|
(define-public binutils+documentation
|
||||||
|
(package/inherit binutils
|
||||||
|
(native-inputs
|
||||||
|
(list texinfo))
|
||||||
|
(arguments
|
||||||
|
(substitute-keyword-arguments (package-arguments binutils)
|
||||||
|
((#:make-flags flags ''())
|
||||||
|
''())))
|
||||||
|
(properties '())))
|
||||||
|
|
||||||
;; FIXME: ath9k-firmware-htc-binutils.patch do not apply on 2.34 because of a
|
;; FIXME: ath9k-firmware-htc-binutils.patch do not apply on 2.34 because of a
|
||||||
;; big refactoring of xtensa-modules.c (commit 567607c11fbf7105 upstream).
|
;; big refactoring of xtensa-modules.c (commit 567607c11fbf7105 upstream).
|
||||||
;; Keep this version around until the patch is updated.
|
;; Keep this version around until the patch is updated.
|
||||||
|
@ -584,7 +601,7 @@ included.")
|
||||||
(properties '())))
|
(properties '())))
|
||||||
|
|
||||||
(define-public binutils-gold
|
(define-public binutils-gold
|
||||||
(package/inherit binutils
|
(package/inherit binutils+documentation
|
||||||
(name "binutils-gold")
|
(name "binutils-gold")
|
||||||
(arguments
|
(arguments
|
||||||
(substitute-keyword-arguments (package-arguments binutils)
|
(substitute-keyword-arguments (package-arguments binutils)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
|
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
|
||||||
;;; Copyright © 2018, 2019 Mark H Weaver <mhw@netris.org>
|
;;; Copyright © 2018, 2019 Mark H Weaver <mhw@netris.org>
|
||||||
;;; Copyright © 2018, 2019, 2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
;;; Copyright © 2018, 2019, 2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
|
;;; Copyright © 2019, 2020, 2022 Marius Bakke <marius@gnu.org>
|
||||||
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
|
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
|
||||||
;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
|
;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
|
||||||
;;;
|
;;;
|
||||||
|
@ -388,6 +388,10 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
|
||||||
(package-arguments binutils))
|
(package-arguments binutils))
|
||||||
((#:configure-flags flags _ ...)
|
((#:configure-flags flags _ ...)
|
||||||
flags)))
|
flags)))
|
||||||
|
#:make-flags ,(match (memq #:make-flags (package-arguments binutils))
|
||||||
|
((#:make-flags flags _ ...)
|
||||||
|
flags)
|
||||||
|
(_ ''()))
|
||||||
#:strip-flags '("--strip-all")
|
#:strip-flags '("--strip-all")
|
||||||
#:phases (modify-phases %standard-phases
|
#:phases (modify-phases %standard-phases
|
||||||
(add-before 'configure 'all-static
|
(add-before 'configure 'all-static
|
||||||
|
|
|
@ -1,231 +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)
|
|
||||||
---
|
|
||||||
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.27.0
|
|
|
@ -1,257 +0,0 @@
|
||||||
Fix CVE-2021-45078 (incomplete fix for CVE-2018-12699):
|
|
||||||
|
|
||||||
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45078
|
|
||||||
https://sourceware.org/bugzilla/show_bug.cgi?id=28694
|
|
||||||
|
|
||||||
Patch copied from upstream source repository:
|
|
||||||
|
|
||||||
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=161e87d12167b1e36193385485c1f6ce92f74f02
|
|
||||||
|
|
||||||
From 161e87d12167b1e36193385485c1f6ce92f74f02 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Alan Modra <amodra@gmail.com>
|
|
||||||
Date: Wed, 15 Dec 2021 11:48:42 +1030
|
|
||||||
Subject: [PATCH] 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.
|
|
||||||
---
|
|
||||||
binutils/stabs.c | 87 ++++++++++++++++++++++++------------------------
|
|
||||||
1 file changed, 43 insertions(+), 44 deletions(-)
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
Reference in New Issue