Skip to contentSkip to conversation

package/mdadm: do not hardcode -fpie

PATCH In review Fabrice Fontaine 2 participants 2 messages Apr 12, 2024 – May 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/mdadm: do not hardcode -fpie

Set LDLIBS to -ldl to remove -fpie and fix the following build failure raised since bump to version 4.3 in commit 99e9ff08d0705279532ca0cf3de22ea54660cbdc and
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=55a1150c7438afcb7756fccd49713ede20a58e4a:

/home/buildroot/autobuild/instance-3/output-1/host/lib/gcc/or1k-buildroot-linux-gnu/12.3.0/../../../../or1k-buildroot-linux-gnu/bin/ld: mdmon.o: non-pic relocation against symbol

Fixes 99e9ff08d0705279532ca0cf3de22ea54660cbdc

- http://autobuild.buildroot.org/results/827b714deeaf091b368d59791e4306b85a8f7f26

---
 package/mdadm/mdadm.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/mdadm/mdadm.mk +2 -1
index c6178700ef..6de9467092 100644
@@ -20,7 +20,8 @@ MDADM_BUILD_OPTS = \
 	CWFLAGS="" \
 	CXFLAGS="$(MDADM_CXFLAGS)" \
 	CPPFLAGS="$(TARGET_CPPFLAGS) -DBINDIR=\\\"/sbin\\\"" \
-	CHECK_RUN_DIR=0
+	CHECK_RUN_DIR=0 \
+	LDLIBS=-ldl
 
 MDADM_INSTALL_TARGET_OPTS = install-bin
 
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 7 lines · On Fri, 12 Apr 2024 18:40:17 +0200 Fabrice Fontaine…

Set LDLIBS to -ldl to remove -fpie and fix the following build failure raised since bump to version 4.3 in commit 99e9ff08d0705279532ca0cf3de22ea54660cbdc and
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=55a1150c7438afcb7756fccd49713ede20a58e4a:

/home/buildroot/autobuild/instance-3/output-1/host/lib/gcc/or1k-buildroot-linux-gnu/12.3.0/../../../../or1k-buildroot-linux-gnu/bin/ld: mdmon.o: non-pic relocation against symbol

Quoted 7 lines
Fixes 99e9ff08d0705279532ca0cf3de22ea54660cbdc

- http://autobuild.buildroot.org/results/827b714deeaf091b368d59791e4306b85a8f7f26

---
 package/mdadm/mdadm.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied to master, even though I must admit the proposed fix is not ideal. Indeed, it overrides LDLIBS from the package Makefile, which means that if we update mdadm and they change their Makefile with a different LDLIBS value, it will no longer work. Some other options would have been:

- An upstreamable patch that allows to explicitly disable using PIE

- An upstreamable patch that detects if PIE works before using it, a bit like what they're doing with other gcc flag detection:

  FALLTHROUGH := $(shell gcc -Q --help=warnings 2>&1 | grep "implicit-fallthrough" | wc -l)

But well, what you did is good enough, so I've applied as-is. Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot