This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 5cc8298444860c6a65bee5370a63e6e6b7ac4122
Author: Marco Casaroli <[email protected]>
AuthorDate: Wed Oct 21 10:56:23 2026 +0200

    arch/arm64: Link without the start files of the compiler with LTO.
    
    With CONFIG_LTO_FULL and GCC, gcc links nuttx.  Toolchain.defs adds
    -nostdlib to LDFLAGS, and the Makefile gives LDFLAGS to ld through
    -Xlinker, so gcc still added its start files (crtbegin.o, ...) and its
    default libraries.  The linker script of qemu-armv8a:knsh discards
    .eh_frame, and the link stopped:
    
      `.eh_frame' referenced in section `.text.frame_dummy' of
      .../crtbegin.o: defined in discarded section `.eh_frame' of
      .../crtbegin.o
    
    Give -nostdlib to gcc too, as arch/arm does.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 arch/arm64/src/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/src/Makefile b/arch/arm64/src/Makefile
index c96178f0ee5..2befd0ccf7f 100644
--- a/arch/arm64/src/Makefile
+++ b/arch/arm64/src/Makefile
@@ -100,6 +100,10 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
     LDENDGROUP   ?= -Wl,--end-group
     LDFLAGS      := $(addprefix -Xlinker ,$(LDFLAGS))
     LDFLAGS      += $(filter-out $(STRIPCFLAGS),$(CFLAGS))
+
+    # The driver must not add its start files and libraries
+
+    LDFLAGS      += -nostdlib
   else
     LDSTARTGROUP ?= --start-group
     LDENDGROUP   ?= --end-group

Reply via email to