- Add power10 fix power10-fix.patch for #1142.

OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/mold?expand=0&rev=107
This commit is contained in:
Martin Liška 2023-11-06 18:22:50 +00:00 committed by Git OBS Bridge
parent 0768abbb20
commit f40d5bcc2d
3 changed files with 35 additions and 0 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 6 18:20:07 UTC 2023 - Martin Liška <martin.liska@hey.com>
- Add power10 fix power10-fix.patch for #1142.
-------------------------------------------------------------------
Sun Nov 5 06:53:29 UTC 2023 - Martin Liška <martin.liska@hey.com>

View File

@ -25,6 +25,7 @@ Group: Development/Tools/Building
URL: https://github.com/rui314/mold
Source: https://github.com/rui314/mold/archive/v%{version}/mold-%{version}.tar.gz
Patch0: build-blake-3-as-static.patch
Patch1: power10-fix.patch
BuildRequires: cmake
%if %{suse_version} < 1550
BuildRequires: gcc11-c++

29
power10-fix.patch Normal file
View File

@ -0,0 +1,29 @@
From 31c3b5397b91ea058dbd9e773e2a2c397f17558e Mon Sep 17 00:00:00 2001
From: Rui Ueyama <ruiu@cs.stanford.edu>
Date: Mon, 6 Nov 2023 13:25:27 +0900
Subject: [PATCH] [POWER10] Emit dynamic relocation for ifunc
Previously, we didn't emit a dynamic relocation for a statically-
initialized function pointer pointing to an ifunc on POWER10, e.g.
int fn() __attribute__((ifunc("resolve_fn")));
void *ptr = fn;
Fixes https://github.com/rui314/mold/issues/1142
---
elf/input-sections.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/elf/input-sections.cc b/elf/input-sections.cc
index 864e72bb1..70187ef39 100644
--- a/elf/input-sections.cc
+++ b/elf/input-sections.cc
@@ -274,7 +274,7 @@ static Action get_absrel_action(Context<E> &ctx, Symbol<E> &sym) {
template <typename E>
static Action get_dyn_absrel_action(Context<E> &ctx, Symbol<E> &sym) {
if (sym.is_ifunc())
- return ctx.arg.pic ? IFUNC_DYNREL : NONE;
+ return sym.is_pde_ifunc(ctx) ? NONE : IFUNC_DYNREL;
// This is a decision table for absolute relocations for the pointer
// size data (e.g. R_X86_64_64). Unlike the absrel_table, we can emit