[PATCH] firmware: Detect whether the toolchain supports pie and automatically disable the FW_PIC option
Xiang W
wxjstz at 126.com
Sat Jul 10 11:21:46 PDT 2021
Signed-off-by: Xiang W <wxjstz at 126.com>
---
firmware/objects.mk | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/firmware/objects.mk b/firmware/objects.mk
index ce91c2f..96a8d7d 100644
--- a/firmware/objects.mk
+++ b/firmware/objects.mk
@@ -17,6 +17,10 @@ ifndef FW_PIC
FW_PIC := y
endif
+ifeq ($(FW_PIC),y)
+FW_PIC := $(shell $(CC) -nostdlib -fPIE -Wl,-pie /dev/null -o /dev/null 2>/dev/null && echo y || echo n)
+endif
+
ifeq ($(FW_PIC),y)
firmware-genflags-y += -DFW_PIC
firmware-asflags-y += -fpic
--
2.30.2
More information about the opensbi
mailing list