diff mbox series

[1/3] elf: Disable ifuncmain{1,5,5pic,5pie} when using LLD

Message ID 20211026200346.3371750-2-adhemerval.zanella@linaro.org
State Committed
Commit 66a273d16a63d1ed74a8d14a210a04c6a0f5dd45
Headers show
Series Improve lld support and current status | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Adhemerval Zanella Oct. 26, 2021, 8:03 p.m. UTC
These tests takes the address of a protected symbol (foo_protected)
and lld does not support copy relocations on protected data symbols.

Checked on x86_64-linux-gnu.
---
 elf/Makefile | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Comments

Fāng-ruì Sòng Oct. 29, 2021, 7:49 p.m. UTC | #1
On 2021-10-26, Adhemerval Zanella wrote:
>These tests takes the address of a protected symbol (foo_protected)
>and lld does not support copy relocations on protected data symbols.
>
>Checked on x86_64-linux-gnu.

You may use some information from my previous reply
https://sourceware.org/pipermail/libc-alpha/2021-October/132292.html
to make a better commit message.

ifuncmain1.c and ifuncmain5.c take the address of the function `foo_protected`.
If compiled with -fno-pic, the produced relocation is R_X86_64_PC32.
Nowadays most GCC releases are configured with enable-default-pie and
therefore ifuncmain5.c is compiled with the implicit -fpie.
So I did not catch this issue.


Reviewed-by: Fangrui Song <maskray@google.com>
diff mbox series

Patch

diff --git a/elf/Makefile b/elf/Makefile
index bdcf4cb885..477207a297 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -427,11 +427,14 @@  ifeq (yes,$(build-shared))
 tests += tst-ifunc-fault-lazy tst-ifunc-fault-bindnow
 # Note: sysdeps/x86_64/ifuncmain8.c uses ifuncmain8.
 tests-internal += \
-	 ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
+	 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
 	 ifuncmain1staticpic \
 	 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
-	 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
+	 ifuncmain5staticpic \
 	 ifuncmain7 ifuncmain7pic
+ifeq (no,$(with-lld))
+tests-internal += ifuncmain1 ifuncmain5 ifuncmain5pic
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-internal += ifuncmain9 ifuncmain9pic
 endif
@@ -441,17 +444,23 @@  extra-test-objs += $(ifunc-test-modules:=.o)
 test-internal-extras += $(ifunc-test-modules)
 ifeq (yes,$(have-fpie))
 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
-		  ifuncmain5pie ifuncmain6pie ifuncmain7pie
+		  ifuncmain6pie ifuncmain7pie
 ifeq (yes,$(have-gcc-ifunc))
 ifunc-pie-tests += ifuncmain9pie
 endif
+ifeq (no,$(with-lld))
+ifunc-pie-tests += ifuncmain5pie
+endif
 ifeq (yes,$(have-textrel_ifunc))
 ifunc-pie-tests += tst-ifunc-textrel
 endif
 tests-internal += $(ifunc-pie-tests)
 tests-pie += $(ifunc-pie-tests)
 endif
-modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
+modules-names += ifuncmod1 ifuncmod3 ifuncmod6
+ifeq (no,$(with-lld))
+modules-names += ifuncmod5
+endif
 endif
 endif