Skip to content

Commit 55e8f95

Browse files
committed
Concentrate flags for clang in arch.mk
1 parent 81fc857 commit 55e8f95

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ endif
201201

202202
ifeq ($(USE_CLANG),1)
203203
ifeq ($(ARCH),ARM)
204-
OBJCOPY_BIN_FLAGS+=-j .text -j .ramcode -j .keystore -j .edidx -j .gnu.sgstubs
204+
OBJCOPY_BIN_FLAGS+=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_BOOT)
205205
endif
206206
endif
207207
ifeq ($(TARGET),ti_hercules)

arch.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,12 @@ ifeq ($(USE_CLANG),1)
13011301
CFLAGS+=-Wno-unknown-attributes -Wno-error=unknown-attributes
13021302
CFLAGS+=-fno-unwind-tables -fno-asynchronous-unwind-tables
13031303
LSCRIPT_FLAGS+=-T $(abspath $(WOLFBOOT_ROOT)/hal/clang-discard.ld)
1304+
# Keep Clang-specific raw-image section selection in one place. Both the
1305+
# bootloader and test-app need flash-backed sections only, but the bootloader
1306+
# has a few extra output sections that must be preserved.
1307+
CLANG_ARM_OBJCOPY_FLASH_FLAGS_BASE:=-j .text -j .edidx
1308+
CLANG_ARM_OBJCOPY_FLASH_FLAGS_BOOT:=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_BASE) -j .ramcode -j .keystore -j .gnu.sgstubs
1309+
CLANG_ARM_OBJCOPY_FLASH_FLAGS_APP:=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_BASE)
13041310
endif
13051311

13061312
ifeq ($(USE_GCC),1)

test-app/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ ifeq ($(USE_CLANG),1)
108108
# Clang-built ARM ELFs can keep RAM sections as loadable segments, and raw
109109
# objcopy output then expands the flash-to-RAM gap into a huge sparse image.
110110
# The app image only needs the flash-backed output sections.
111-
OBJCOPY_IMAGE_FLAGS+=-j .text -j .edidx
111+
OBJCOPY_IMAGE_FLAGS+=$(CLANG_ARM_OBJCOPY_FLASH_FLAGS_APP)
112112
endif
113113

114114
ifeq ($(DEBUG_UART),1)

0 commit comments

Comments
 (0)