x86_64: hide --whole-archive behind Kconfig option

Hide --whole-archive behind Kconfig option for x86.
This option is not needed and breaks ELF modules build.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
p-szafonimateusz 2024-06-27 12:21:29 +02:00 committed by Xiang Xiao
parent 7e342b3422
commit 09146beee9
3 changed files with 9 additions and 1 deletions

View File

@ -113,7 +113,7 @@ nuttx$(EXEEXT): board/libboard$(LIBEXT) $(ARCHSCRIPT)
@echo "LD: nuttx$(EXEEXT)"
$(Q) $(LD) $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
-o $(NUTTX) $(EXTRA_OBJS) \
$(LDSTARTGROUP) $(EXTRA_LIBS) --whole-archive --no-relax $(LDLIBS) $(LDENDGROUP)
$(LDSTARTGROUP) $(EXTRA_LIBS) --no-relax $(LDLIBS) $(LDENDGROUP)
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) $(NM) $(NUTTX) | \
grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \

View File

@ -116,6 +116,10 @@ if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS)
add_compile_options(-ffunction-sections -fdata-sections)
endif()
if(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE)
add_link_options(-Wl,--whole-archive)
endif()
if(CONFIG_ARCH_INTEL64_HAVE_RDRAND)
add_compile_options(-mrdrnd)
endif()

View File

@ -43,6 +43,10 @@ ifeq ($(CONFIG_HOST_MACOS),y)
CROSSDEV = x86_64-elf-
endif
ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
LDFLAGS += --whole-archive
endif
CC = $(CROSSDEV)gcc
CPP = $(CROSSDEV)gcc -E -x c
LD = $(CROSSDEV)ld