[openwrt/openwrt] rules.mk: use -fPIC instead of -fpic on arm64

LEDE Commits lede-commits at lists.infradead.org
Mon Dec 7 15:30:23 EST 2020


stintel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/0eb2fa39f313cac1e1e76c09e6ecf204064697a9

commit 0eb2fa39f313cac1e1e76c09e6ecf204064697a9
Author: Stijn Tintel <stijn at linux-ipv6.be>
AuthorDate: Fri Dec 4 18:32:46 2020 +0200

    rules.mk: use -fPIC instead of -fpic on arm64
    
    Some packages fail to build on arm64 when PKG_ASLR_PIE_ALL=y, due to
    machine-specific size restrictions on the global offset table.
    While the manual instructs to recompile with -fPIC if it fails with
    -fpic, by doing this per package, there is still a risk of random
    breakage due to version bumps or other changes, so let's use -fPIC on
    arm64 by default.
    
    While comparing the sizes of 141 packages built with -fpic vs -fPIC,
    most packages are either equal or smaller in size. Only 9 of the
    compared packages turned out slightly larger.
    
    Signed-off-by: Stijn Tintel <stijn at linux-ipv6.be>
---
 rules.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rules.mk b/rules.mk
index 34222a3a71..f79340b124 100644
--- a/rules.mk
+++ b/rules.mk
@@ -77,7 +77,7 @@ IS_PACKAGE_BUILD := $(if $(filter package/%,$(BUILD_SUBDIR)),1)
 
 OPTIMIZE_FOR_CPU=$(subst i386,i486,$(ARCH))
 
-ifeq ($(ARCH),powerpc)
+ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be powerpc ))
   FPIC:=-fPIC
 else
   FPIC:=-fpic



More information about the lede-commits mailing list