[OpenWrt-Devel] [PATCH 4/4] package: fix "LTO" option resulted in building error

Nylon Chen nylon7 at andestech.com
Tue Jun 11 06:32:48 EDT 2019


When a building package has -flto option leads to building error

We must use the gcc-ar wrapper instead of ar to invoke ar with the right
plugin arguments for handling the LTO objects when -flto is specified.

Signed-off-by: Che-Wei Chuang <cnoize at andestech.com>
Signed-off-by: Nylon Chen <nylon7 at andestech.com>
---
 rules.mk | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/rules.mk b/rules.mk
index 80cb3d63f4..8d1c2b7cd2 100644
--- a/rules.mk
+++ b/rules.mk
@@ -256,9 +256,15 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
   TARGET_RANLIB:=$(TARGET_CROSS)gcc-ranlib
   TARGET_NM:=$(TARGET_CROSS)gcc-nm
 else
-  TARGET_AR:=$(TARGET_CROSS)ar
-  TARGET_RANLIB:=$(TARGET_CROSS)ranlib
-  TARGET_NM:=$(TARGET_CROSS)nm
+  ifeq ($(ARCH),nds32)
+    TARGET_AR:=$(TARGET_CROSS)gcc-ar
+    TARGET_RANLIB:=$(TARGET_CROSS)gcc-ranlib
+    TARGET_NM:=$(TARGET_CROSS)gcc-nm
+  else
+    TARGET_AR:=$(TARGET_CROSS)ar
+    TARGET_RANLIB:=$(TARGET_CROSS)ranlib
+    TARGET_NM:=$(TARGET_CROSS)nm
+  endif
 endif
 
 BUILD_KEY=$(TOPDIR)/key-build
-- 
2.17.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list