mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 03:12:51 +00:00
binutils: 2.40 -> 2.41
Dropped 3 upstreamed / backported patches: - CVE-2023-1972 - mingw-abort-fix - mips64-default-n64 Added one backport to fix `llvm` testsuite failures: - gold-powerpc-for-llvm Changes: https://lists.gnu.org/archive/html/info-gnu/2023-07/msg00009.html
This commit is contained in:
parent
fa4285b1ad
commit
d0f26a4af1
@ -1,23 +0,0 @@
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
index 027d0143735..185028cbd97 100644
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -9030,6 +9030,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
|
||||
bfd_set_error (bfd_error_file_too_big);
|
||||
goto error_return_verdef;
|
||||
}
|
||||
+
|
||||
+ if (amt == 0)
|
||||
+ goto error_return_verdef;
|
||||
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
|
||||
if (elf_tdata (abfd)->verdef == NULL)
|
||||
goto error_return_verdef;
|
||||
@@ -9133,6 +9136,8 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
|
||||
bfd_set_error (bfd_error_file_too_big);
|
||||
goto error_return;
|
||||
}
|
||||
+ if (amt == 0)
|
||||
+ goto error_return;
|
||||
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
|
||||
if (elf_tdata (abfd)->verdef == NULL)
|
||||
goto error_return;
|
@ -33,12 +33,12 @@ assert enableGoldDefault -> enableGold;
|
||||
let
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
version = "2.40";
|
||||
version = "2.41";
|
||||
|
||||
srcs = {
|
||||
normal = fetchurl {
|
||||
url = "mirror://gnu/binutils/binutils-${version}.tar.bz2";
|
||||
hash = "sha256-+CmOsVOks30RLpRapcsoUAQLzyaj6mW1pxXIOv4F5Io=";
|
||||
hash = "sha256-pMS+wFL3uDcAJOYDieGUN38/SLVmGEGOpRBn9nqqsws=";
|
||||
};
|
||||
vc4-none = fetchFromGitHub {
|
||||
owner = "itszor";
|
||||
@ -66,6 +66,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# fetchpatch! All mutable patches (generated by GitHub or cgit) that are
|
||||
# needed here should be included directly in Nixpkgs as files.
|
||||
patches = [
|
||||
# Upstream patch to fix llvm testsuite failure when loading powerpc
|
||||
# objects:
|
||||
# https://sourceware.org/PR30794
|
||||
./gold-powerpc-for-llvm.patch
|
||||
|
||||
# Make binutils output deterministic by default.
|
||||
./deterministic.patch
|
||||
|
||||
@ -90,10 +95,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# not need to know binutils' BINDIR at all. It's an absolute path
|
||||
# where libraries are stored.
|
||||
./plugins-no-BINDIR.patch
|
||||
|
||||
# CVE-2023-1972 fix to bfd/elf.c from:
|
||||
# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c22d38baefc5a7a1e1f5cdc9dbb556b1f0ec5c57
|
||||
./CVE-2023-1972.patch
|
||||
]
|
||||
++ lib.optional targetPlatform.isiOS ./support-ios.patch
|
||||
# Adds AVR-specific options to "size" for compatibility with Atmel's downstream distribution
|
||||
@ -101,15 +102,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# https://github.com/archlinux/svntogit-community/blob/c8d53dd1734df7ab15931f7fad0c9acb8386904c/trunk/avr-size.patch
|
||||
++ lib.optional targetPlatform.isAvr ./avr-size.patch
|
||||
++ lib.optional stdenv.targetPlatform.isWindows ./windres-locate-gcc.patch
|
||||
++ lib.optional stdenv.targetPlatform.isMips64n64
|
||||
# this patch is from debian:
|
||||
# https://sources.debian.org/data/main/b/binutils/2.38-3/debian/patches/mips64-default-n64.diff
|
||||
(if stdenv.targetPlatform.isMusl
|
||||
then substitute { src = ./mips64-default-n64.patch; replacements = [ "--replace" "gnuabi64" "muslabi64" ]; }
|
||||
else ./mips64-default-n64.patch)
|
||||
# This patch fixes a bug in 2.40 on MinGW, which breaks DXVK when cross-building from Darwin.
|
||||
# See https://sourceware.org/bugzilla/show_bug.cgi?id=30079
|
||||
++ lib.optional stdenv.targetPlatform.isMinGW ./mingw-abort-fix.patch
|
||||
;
|
||||
|
||||
outputs = [ "out" "info" "man" "dev" ]
|
||||
|
107
pkgs/development/tools/misc/binutils/gold-powerpc-for-llvm.patch
Normal file
107
pkgs/development/tools/misc/binutils/gold-powerpc-for-llvm.patch
Normal file
@ -0,0 +1,107 @@
|
||||
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=d537f77ef3b18a5fbfd598643aaad957652e9608
|
||||
|
||||
Fix llvm testsuite failure on a single test:
|
||||
FAIL: LLVM :: tools/gold/PowerPC/mtriple.ll (43659 of 49708)
|
||||
ld.gold: internal error in add_output_section_to_load, at output.cc:4097
|
||||
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Thu, 24 Aug 2023 23:42:18 +0000 (+0930)
|
||||
Subject: PR30794, PowerPC gold: internal error in add_output_section_to_load
|
||||
X-Git-Tag: gdb-14-branchpoint~482
|
||||
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=d537f77ef3b18a5fbfd598643aaad957652e9608
|
||||
|
||||
PR30794, PowerPC gold: internal error in add_output_section_to_load
|
||||
|
||||
Caused by commit 5a97377e5513, specifically this code added to
|
||||
Target_powerpc::do_relax
|
||||
+ if (parameters->options().output_is_position_independent())
|
||||
+ this->rela_dyn_size_
|
||||
+ = this->rela_dyn_section(layout)->current_data_size();
|
||||
|
||||
The problem here is that if .rela.dyn isn't already created then the
|
||||
call to rela_dyn_section creates it, and as this comment in
|
||||
Target_powerpc::do_finalize_sections says:
|
||||
// Annoyingly, we need to make these sections now whether or
|
||||
// not we need them. If we delay until do_relax then we
|
||||
// need to mess with the relaxation machinery checkpointing.
|
||||
We can't be creating sections in do_relax.
|
||||
|
||||
PR 30794
|
||||
* powerpc.cc (Target_powerpc::do_relax): Only set rela_dyn_size_
|
||||
for size == 64, and assert that rela_dyn_ already exists.
|
||||
Tidy code setting plt_thread_safe, which also only needs to be
|
||||
set when size == 64 for ELFv1.
|
||||
---
|
||||
|
||||
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
|
||||
index e66d9cbb900..a4fecaae55a 100644
|
||||
--- a/gold/powerpc.cc
|
||||
+++ b/gold/powerpc.cc
|
||||
@@ -3714,12 +3714,7 @@ Target_powerpc<size, big_endian>::do_relax(int pass,
|
||||
unsigned int prev_brlt_size = 0;
|
||||
if (pass == 1)
|
||||
{
|
||||
- bool thread_safe
|
||||
- = this->abiversion() < 2 && parameters->options().plt_thread_safe();
|
||||
- if (size == 64
|
||||
- && this->abiversion() < 2
|
||||
- && !thread_safe
|
||||
- && !parameters->options().user_set_plt_thread_safe())
|
||||
+ if (size == 64 && this->abiversion() < 2)
|
||||
{
|
||||
static const char* const thread_starter[] =
|
||||
{
|
||||
@@ -3747,29 +3742,37 @@ Target_powerpc<size, big_endian>::do_relax(int pass,
|
||||
/* libgo */
|
||||
"__go_go",
|
||||
};
|
||||
+ bool thread_safe = parameters->options().plt_thread_safe();
|
||||
|
||||
- if (parameters->options().shared())
|
||||
- thread_safe = true;
|
||||
- else
|
||||
+ if (!thread_safe
|
||||
+ && !parameters->options().user_set_plt_thread_safe())
|
||||
{
|
||||
- for (unsigned int i = 0;
|
||||
- i < sizeof(thread_starter) / sizeof(thread_starter[0]);
|
||||
- i++)
|
||||
+ if (parameters->options().shared())
|
||||
+ thread_safe = true;
|
||||
+ else
|
||||
{
|
||||
- Symbol* sym = symtab->lookup(thread_starter[i], NULL);
|
||||
- thread_safe = (sym != NULL
|
||||
- && sym->in_reg()
|
||||
- && sym->in_real_elf());
|
||||
- if (thread_safe)
|
||||
- break;
|
||||
+ for (unsigned int i = 0;
|
||||
+ i < sizeof(thread_starter) / sizeof(thread_starter[0]);
|
||||
+ i++)
|
||||
+ {
|
||||
+ Symbol* sym = symtab->lookup(thread_starter[i], NULL);
|
||||
+ thread_safe = (sym != NULL
|
||||
+ && sym->in_reg()
|
||||
+ && sym->in_real_elf());
|
||||
+ if (thread_safe)
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ this->plt_thread_safe_ = thread_safe;
|
||||
}
|
||||
- this->plt_thread_safe_ = thread_safe;
|
||||
|
||||
- if (parameters->options().output_is_position_independent())
|
||||
- this->rela_dyn_size_
|
||||
- = this->rela_dyn_section(layout)->current_data_size();
|
||||
+ if (size == 64
|
||||
+ && parameters->options().output_is_position_independent())
|
||||
+ {
|
||||
+ gold_assert (this->rela_dyn_);
|
||||
+ this->rela_dyn_size_ = this->rela_dyn_->current_data_size();
|
||||
+ }
|
||||
|
||||
this->stub_group_size_ = parameters->options().stub_group_size();
|
||||
bool no_size_errors = true;
|
@ -1,30 +0,0 @@
|
||||
From b7eab2a9d4f4e92692daf14b09fc95ca11b72e30 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Matz <matz@suse.de>
|
||||
Date: Thu, 9 Feb 2023 15:29:00 +0100
|
||||
Subject: [PATCH 1/1] Fix PR30079: abort on mingw
|
||||
|
||||
the early-out in wild_sort is not enough, it might still be
|
||||
that filenames are equal _and_ the wildcard list doesn't specify
|
||||
a sort order either. Don't call compare_section then.
|
||||
|
||||
Tested on all targets.
|
||||
---
|
||||
ld/ldlang.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ld/ldlang.c b/ld/ldlang.c
|
||||
index 84a2914fc26..b5e0d026ae4 100644
|
||||
--- a/ld/ldlang.c
|
||||
+++ b/ld/ldlang.c
|
||||
@@ -649,7 +649,8 @@ wild_sort (lang_wild_statement_type *wild,
|
||||
looking at the sections for this file. */
|
||||
|
||||
/* Find the correct node to append this section. */
|
||||
- if (compare_section (sec->spec.sorted, section, (*tree)->section) < 0)
|
||||
+ if (sec && sec->spec.sorted != none && sec->spec.sorted != by_none
|
||||
+ && compare_section (sec->spec.sorted, section, (*tree)->section) < 0)
|
||||
tree = &((*tree)->left);
|
||||
else
|
||||
tree = &((*tree)->right);
|
||||
--
|
||||
2.31.1
|
@ -1,82 +0,0 @@
|
||||
--- a/bfd/config.bfd
|
||||
+++ b/bfd/config.bfd
|
||||
@@ -927,11 +927,21 @@ case "${targ}" in
|
||||
targ_defvec=mips_elf32_be_vec
|
||||
targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
|
||||
;;
|
||||
- mips64*el-*-linux*)
|
||||
+ mips*64*el-*-linux*-gnuabi64)
|
||||
+ targ_defvec=mips_elf64_trad_le_vec
|
||||
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec"
|
||||
+ want64=true
|
||||
+ ;;
|
||||
+ mips*64*-*-linux*-gnuabi64)
|
||||
+ targ_defvec=mips_elf64_trad_be_vec
|
||||
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec"
|
||||
+ want64=true
|
||||
+ ;;
|
||||
+ mips*64*el-*-linux*)
|
||||
targ_defvec=mips_elf32_ntrad_le_vec
|
||||
targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec"
|
||||
;;
|
||||
- mips64*-*-linux*)
|
||||
+ mips*64*-*-linux*)
|
||||
targ_defvec=mips_elf32_ntrad_be_vec
|
||||
targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
|
||||
;;
|
||||
--- a/binutils/testsuite/binutils-all/mips/mips-note-2-n32.d
|
||||
+++ b/binutils/testsuite/binutils-all/mips/mips-note-2-n32.d
|
||||
@@ -1,4 +1,5 @@
|
||||
#PROG: objcopy
|
||||
+#as: -n32
|
||||
#readelf: --notes --wide
|
||||
#objcopy: --merge-notes
|
||||
#name: MIPS merge notes section (n32)
|
||||
--- a/gas/configure
|
||||
+++ b/gas/configure
|
||||
@@ -12167,6 +12167,9 @@ _ACEOF
|
||||
esac
|
||||
# Decide which ABI to target by default.
|
||||
case ${target} in
|
||||
+ mips*64*-linux-gnuabi64)
|
||||
+ mips_default_abi=N64_ABI
|
||||
+ ;;
|
||||
mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
|
||||
| mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
|
||||
mips_default_abi=N32_ABI
|
||||
--- a/gas/configure.ac
|
||||
+++ b/gas/configure.ac
|
||||
@@ -384,6 +384,9 @@ changequote([,])dnl
|
||||
esac
|
||||
# Decide which ABI to target by default.
|
||||
case ${target} in
|
||||
+ mips*64*-linux-gnuabi64)
|
||||
+ mips_default_abi=N64_ABI
|
||||
+ ;;
|
||||
mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
|
||||
| mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
|
||||
mips_default_abi=N32_ABI
|
||||
--- a/ld/configure.tgt
|
||||
+++ b/ld/configure.tgt
|
||||
@@ -543,11 +543,19 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvx
|
||||
;;
|
||||
mips*-*-windiss) targ_emul=elf32mipswindiss
|
||||
;;
|
||||
-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
|
||||
+mips*64*el-*-linux-gnuabi64) targ_emul=elf64ltsmip
|
||||
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
|
||||
+ targ_extra_libpath=$targ_extra_emuls
|
||||
+ ;;
|
||||
+mips*64*el-*-linux-*) targ_emul=elf32ltsmipn32
|
||||
targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
|
||||
targ_extra_libpath=$targ_extra_emuls
|
||||
;;
|
||||
-mips64*-*-linux-*) targ_emul=elf32btsmipn32
|
||||
+mips*64*-*-linux-gnuabi64) targ_emul=elf64btsmip
|
||||
+ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
|
||||
+ targ_extra_libpath=$targ_extra_emuls
|
||||
+ ;;
|
||||
+mips*64*-*-linux-*) targ_emul=elf32btsmipn32
|
||||
targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
|
||||
targ_extra_libpath=$targ_extra_emuls
|
||||
;;
|
Loading…
Reference in New Issue
Block a user