[COMMITTED] lto: Compile PR ld/23818 test with -fPIC

Message ID CAMe9rOp35rHvhOAEok=LrsU7jpWC-NSDpZNmMhkm2SR5vS=tNw@mail.gmail.com
State New
Headers
Series [COMMITTED] lto: Compile PR ld/23818 test with -fPIC |

Commit Message

H.J. Lu Nov. 30, 2025, 8:10 a.m. UTC
  Compile PR ld/23818 test with -fPIC to fix

testsuite/ld-plugin/pr23818b.c:6:(.text+0x34): relocation R_MIPS_26
against `a local symbol' cannot be used when making a shared object;
recompile with -fPIC
FAIL: Build libpr23818.so

for mips.

PR ld/23818
* testsuite/ld-plugin/lto.exp: Compile PR ld/23818 test with
-fPIC.
  

Patch

From 64495e2d0d3c30a3e4a43c22c8007305c3115132 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sun, 30 Nov 2025 16:02:07 +0800
Subject: [PATCH] lto: Compile PR ld/23818 test with -fPIC

Compile PR ld/23818 test with -fPIC to fix

testsuite/ld-plugin/pr23818b.c:6:(.text+0x34): relocation R_MIPS_26 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
FAIL: Build libpr23818.so

for mips.

	PR ld/23818
	* testsuite/ld-plugin/lto.exp: Compile PR ld/23818 test with
	-fPIC.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 ld/testsuite/ld-plugin/lto.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 9ac3cf6b9f1..84538bc859d 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -399,8 +399,8 @@  set lto_link_elf_tests [list \
    {} {-flto} \
    {pr22220main.cc} {} {} {c++}] \
   [list "Build libpr23818.so" \
-   "-shared -flto -g -Wl,-version-script,pr23818.t" \
-   "-g -flto $lto_fat" \
+   "-shared -fPIC -flto -g -Wl,-version-script,pr23818.t" \
+   "-g -fPIC -flto $lto_fat" \
    {pr23818a.c pr23818b.c} \
    {{"readelf" {-s --wide} "pr23818.d"}} \
    "libpr23818.so"] \
-- 
2.52.0