From f40d5bcc2d488ac668feb5d9c3b0d860afbbae9063ee03d222e86e892044646c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Li=C5=A1ka?= Date: Mon, 6 Nov 2023 18:22:50 +0000 Subject: [PATCH] - Add power10 fix power10-fix.patch for #1142. OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/mold?expand=0&rev=107 --- mold.changes | 5 +++++ mold.spec | 1 + power10-fix.patch | 29 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 power10-fix.patch diff --git a/mold.changes b/mold.changes index 4735703..d06b81f 100644 --- a/mold.changes +++ b/mold.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Nov 6 18:20:07 UTC 2023 - Martin Liška + +- Add power10 fix power10-fix.patch for #1142. + ------------------------------------------------------------------- Sun Nov 5 06:53:29 UTC 2023 - Martin Liška diff --git a/mold.spec b/mold.spec index 0d9a824..4e39ad9 100644 --- a/mold.spec +++ b/mold.spec @@ -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++ diff --git a/power10-fix.patch b/power10-fix.patch new file mode 100644 index 0000000..d87bf98 --- /dev/null +++ b/power10-fix.patch @@ -0,0 +1,29 @@ +From 31c3b5397b91ea058dbd9e773e2a2c397f17558e Mon Sep 17 00:00:00 2001 +From: Rui Ueyama +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 &ctx, Symbol &sym) { + template + static Action get_dyn_absrel_action(Context &ctx, Symbol &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