mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
net: Support no-lto option for the network build.
Add CONFIG_NET_NO_LTO to allow compiling the network stack with -fno-lto. This is useful for avoiding LTO-related issues in the network layer. Signed-off-by: daichuan <daichuan@xiaomi.com>
This commit is contained in:
@@ -27,4 +27,8 @@ if(CONFIG_NET)
|
|||||||
|
|
||||||
target_sources(net PRIVATE net_initialize.c)
|
target_sources(net PRIVATE net_initialize.c)
|
||||||
target_include_directories(net PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
target_include_directories(net PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
|
||||||
|
if(CONFIG_NET_NO_LTO)
|
||||||
|
add_compile_options(-fno-lto)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
+15
@@ -457,4 +457,19 @@ endmenu # Network Topologies
|
|||||||
|
|
||||||
source "net/route/Kconfig"
|
source "net/route/Kconfig"
|
||||||
|
|
||||||
|
config NET_NO_LTO
|
||||||
|
bool "Support no-lto option for the network Makefile"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
This option disables Link Time Optimization (LTO) specifically for the
|
||||||
|
network subsystem.
|
||||||
|
|
||||||
|
LTO can sometimes introduce build issues, excessive compilation time,
|
||||||
|
or difficult-to-debug runtime behaviors in complex network stacks
|
||||||
|
depending on the compiler version and architecture.
|
||||||
|
|
||||||
|
Enable this option if you encounter LTO-related issues in the network
|
||||||
|
stack or need to debug network code without the aggressive optimizations
|
||||||
|
introduced by LTO, while keeping LTO enabled for the rest of the system.
|
||||||
|
|
||||||
endif # NET
|
endif # NET
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT))
|
|||||||
SRCS = $(ASRCS) $(CSRCS)
|
SRCS = $(ASRCS) $(CSRCS)
|
||||||
OBJS = $(AOBJS) $(COBJS)
|
OBJS = $(AOBJS) $(COBJS)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_NET_NO_LTO),y)
|
||||||
|
CFLAGS += -fno-lto
|
||||||
|
endif
|
||||||
|
|
||||||
BIN = libnet$(LIBEXT)
|
BIN = libnet$(LIBEXT)
|
||||||
|
|
||||||
all: $(BIN)
|
all: $(BIN)
|
||||||
|
|||||||
Reference in New Issue
Block a user