File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,6 +114,10 @@ ifeq ($(USE_CLANG),1)
114114 else
115115 OBJCOPY_IMAGE_FLAGS+ =$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_APP )
116116 endif
117+ # Clang doesn't emit empty .data/.bss sections in object files (GCC does).
118+ # GNU ld mishandles AT() for output sections with no matching input sections,
119+ # setting LMA=VMA instead of the specified flash address.
120+ APP_OBJS+ =clang_sections.o
117121endif
118122
119123ifeq ($(DEBUG_UART ) ,1)
Original file line number Diff line number Diff line change 1+ /* Workaround for GNU ld mishandling AT() on output sections when no input
2+ * object contributes a matching section. Clang does not emit empty .data/.bss
3+ * sections in object files (GCC does), so GNU ld fails to assign the correct
4+ * LMA for the .data output section, producing a huge sparse binary.
5+ * Including this object ensures .data and .bss exist as inputs.
6+ */
7+ .section .data
8+ .section .bss
You can’t perform that action at this time.
0 commit comments