mirror of
https://github.com/richfelker/musl-cross-make.git
synced 2025-08-17 22:03:22 +02:00
add patches to fix riscv & s390x ld not binding PIE symbols at link time
these should probably be backported to older binutils too, but they don't apply as-is since the code has been refactored. I don't consider this a high priority; use of old binutils should probably be treated as deprecated at some point.
This commit is contained in:
parent
baad915870
commit
2398261280
45
patches/binutils-2.44/0003-riscv-pie-symbol-binding.diff
Normal file
45
patches/binutils-2.44/0003-riscv-pie-symbol-binding.diff
Normal 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
|
13
patches/binutils-2.44/0004-s390x-pie-symbol-binding.diff
Normal file
13
patches/binutils-2.44/0004-s390x-pie-symbol-binding.diff
Normal file
@ -0,0 +1,13 @@
|
||||
See riscv-pie.patch
|
||||
|
||||
--- a/bfd/elf64-s390.c
|
||||
+++ b/bfd/elf64-s390.c
|
||||
@@ -2953,7 +2953,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
|| r_type == R_390_PC32DBL
|
||||
|| r_type == R_390_PC64
|
||||
|| !bfd_link_pic (info)
|
||||
- || !SYMBOLIC_BIND (info, h)
|
||||
+ || !(bfd_link_pie (info) || SYMBOLIC_BIND (info, h))
|
||||
|| !h->def_regular))
|
||||
{
|
||||
outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
|
Loading…
x
Reference in New Issue
Block a user