1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-12 18:59:50 +03:00

main/binutils: backport patch for static-pie on riscv64

This commit is contained in:
Sertonix 2025-07-11 01:38:47 +02:00 committed by Natanael Copa
parent cd9a7a29b8
commit 3b3a910fa4
2 changed files with 48 additions and 1 deletions

View file

@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=binutils
pkgver=2.44
pkgrel=2
pkgrel=3
pkgdesc="Tools necessary to build programs"
url="https://www.gnu.org/software/binutils/"
makedepends_build="bison flex texinfo"
@ -14,6 +14,7 @@ source="https://ftp.gnu.org/gnu/binutils/binutils-with-gold-$pkgver.tar.xz
binutils-ld-fix-static-linking.patch
CVE-2025-1153.patch
CVE-2025-3198.patch
riscv-pie.patch
"
builddir="$srcdir/$pkgname-with-gold-$pkgver"
options="!check"
@ -198,4 +199,5 @@ sha512sums="
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49 binutils-ld-fix-static-linking.patch
48f718ea70b394ac24087fded3634b6cb6b99f6082e95952a02ea7551cf56bef24bcd8ec5877c4e228ea8a750d52117d977bb461f07b5ac84521a15c2a7418df CVE-2025-1153.patch
0b529cb91c83bb24df02042832e383cd18bbd70947e7db16c76b33c2a13b11c238e647d1bfd79d7c477fe739567972567da202c598d0aae59e231f9cad86ca2e CVE-2025-3198.patch
5c5dbe25869415ef4be7d5d91d0eed569f79d248314a7f311d57c9a2db3caa8bfb8fd427e4033aecb573e87178574783062245f3a869a1aef4a0f2fde5472b39 riscv-pie.patch
"

View file

@ -0,0 +1,45 @@
Patch-Source: https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=39c7793ba8bef5aab358511b22764081959cb2ff
From 39c7793ba8bef5aab358511b22764081959cb2ff Mon Sep 17 00:00:00 2001
From: Linsen Zhou <i@lin.moe>
Date: Tue, 8 Jul 2025 06:34:18 +0800
Subject: [PATCH] RISC-V: Bind defined symbol locally in PIE
Reference commit 1dcb9720d62cd053a72c31881b7724ce9f74332c
bfd/
* elfnn-riscv.c (RISCV_COPY_INPUT_RELOC): Bind defined symbol
locally in PIE.
ld/
* testsuite/ld-riscv-elf/pie-bind-locally-a.s: New test source.
* testsuite/ld-riscv-elf/pie-bind-locally-b.s: Likewise.
* testsuite/ld-riscv-elf/pie-bind-locally-rv32.d: New testcase.
* testsuite/ld-riscv-elf/pie-bind-locally-rv64.d: Likewise.
Signed-off-by: Linsen Zhou <i@lin.moe>
---
bfd/elfnn-riscv.c | 2 +-
ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp | 3 +++
ld/testsuite/ld-riscv-elf/pie-bind-locally-a.s | 5 +++++
ld/testsuite/ld-riscv-elf/pie-bind-locally-b.s | 8 ++++++++
ld/testsuite/ld-riscv-elf/pie-bind-locally-rv32.d | 10 ++++++++++
ld/testsuite/ld-riscv-elf/pie-bind-locally-rv64.d | 10 ++++++++++
6 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 ld/testsuite/ld-riscv-elf/pie-bind-locally-a.s
create mode 100644 ld/testsuite/ld-riscv-elf/pie-bind-locally-b.s
create mode 100644 ld/testsuite/ld-riscv-elf/pie-bind-locally-rv32.d
create mode 100644 ld/testsuite/ld-riscv-elf/pie-bind-locally-rv64.d
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 790f0397cf5..2fd01299249 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -99,7 +99,7 @@
((H) != NULL \
&& (H)->dynindx != -1 \
&& (!bfd_link_pic (INFO) \
- || !SYMBOLIC_BIND ((INFO), (H)) \
+ || !(bfd_link_pie ((INFO)) || SYMBOLIC_BIND ((INFO), (H))) \
|| !(H)->def_regular))
/* True if this is actually a static link, or it is a -Bsymbolic link