[PATCH] build: enable thumb compile flag for 32bit architecture.

quic_shoudil at quicinc.com quic_shoudil at quicinc.com
Tue Jan 2 18:11:44 PST 2024


From: shoudil <quic_shoudil at quicinc.com>

Enable thumb flag to reduce package size, which help optimize the size
of system image as well.

Signed-off-by: shoudil <quic_shoudil at quicinc.com>
---
 include/hardening.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/hardening.mk b/include/hardening.mk
index 6acd862f5c..8c59643866 100644
--- a/include/hardening.mk
+++ b/include/hardening.mk
@@ -9,6 +9,10 @@ PKG_SSP ?= 1
 PKG_FORTIFY_SOURCE ?= 1
 PKG_RELRO ?= 1
 
+ifeq ($(ARCH),arm)
+    TARGET_CFLAGS += -mthumb
+endif
+
 ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
   ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY)),1)
     TARGET_CFLAGS += -Wformat -Werror=format-security
-- 
2.25.1




More information about the openwrt-devel mailing list