[PATCH 1/1] build: make sure asm gets built with -DPIC

Philip Prindeville philipp at redfish-solutions.com
Fri Mar 19 22:58:32 GMT 2021


From: Philip Prindeville <philipp at redfish-solutions.com>

Fixes issue #14921, whereby inline ASM wasn't getting built as PIC;
look at gmp-6.2.1/mpn/x86/pentium/popcount.asm for example:

ifdef(`PIC',`
...

for a routine that exists in both PIC and non-PIC versions.

Make sure that wherever $(FPIC) gets passed as a variable expansion
that it gets quoted where necessary (such as setting environment
variables in shell commands).

Signed-off-by: Philip Prindeville <philipp at redfish-solutions.com>
---
 package/libs/libnfnetlink/Makefile | 4 ++--
 rules.mk                           | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/libs/libnfnetlink/Makefile b/package/libs/libnfnetlink/Makefile
index 7d65d6385784e3d418f714386efe505b905c3b3e..bc64ff111d1f37e64463d519736d013679ccebf0 100644
--- a/package/libs/libnfnetlink/Makefile
+++ b/package/libs/libnfnetlink/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libnfnetlink
 PKG_VERSION:=1.0.1
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
@@ -45,7 +45,7 @@ CONFIGURE_ARGS += \
 	--enable-shared
 
 CONFIGURE_VARS += \
-	lt_prog_compiler_pic=$(FPIC)
+	lt_prog_compiler_pic="$(FPIC)"
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include/libnfnetlink
diff --git a/rules.mk b/rules.mk
index 8dee9e8489ac81ee524ca096e38355cea9730368..cb165f954892578f7c11e872d1ff921c96df90da 100644
--- a/rules.mk
+++ b/rules.mk
@@ -76,12 +76,12 @@ IS_PACKAGE_BUILD := $(if $(filter package/%,$(BUILD_SUBDIR)),1)
 OPTIMIZE_FOR_CPU=$(subst i386,i486,$(ARCH))
 
 ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be powerpc ))
-  FPIC:=-fPIC
+  FPIC:=-DPIC -fPIC
 else
-  FPIC:=-fpic
+  FPIC:=-DPIC -fpic
 endif
 
-HOST_FPIC:=-fPIC
+HOST_FPIC:=-DPIC -fPIC
 
 ARCH_SUFFIX:=$(call qstrip,$(CONFIG_CPU_TYPE))
 GCC_ARCH:=
-- 
2.25.1




More information about the openwrt-devel mailing list