Skip to content

Commit b1af192

Browse files
Tavish Narukanashif
authored andcommitted
cmake: set big-endian flags to TOOLCHAIN_*_FLAGS
Set -big-endian to both compiler and linker flags if CONFIG_BIG_ENDIAN is set. Signed-off-by: Tavish Naruka <[email protected]>
1 parent b5ee4c0 commit b1af192

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

arch/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,9 @@ config BIG_ENDIAN
186186
Little-endian architecture is the default and should leave this option
187187
unselected. This option is selected by arch/$ARCH/Kconfig,
188188
soc/**/Kconfig, or boards/**/Kconfig and the user should generally avoid
189-
modifying it. The option is used to select linker script OUTPUT_FORMAT
190-
and command line option for gen_isr_tables.py.
189+
modifying it. The option is used to select linker script OUTPUT_FORMAT,
190+
the toolchain flags (TOOLCHAIN_C_FLAGS, TOOLCHAIN_LD_FLAGS), and command
191+
line option for gen_isr_tables.py.
191192

192193
config LITTLE_ENDIAN
193194
# Hidden Kconfig option representing the default little-endian architecture

cmake/compiler/gcc/target_arm.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ endif()
1010

1111
list(APPEND ARM_C_FLAGS -mabi=aapcs)
1212

13+
if(CONFIG_BIG_ENDIAN)
14+
list(APPEND TOOLCHAIN_C_FLAGS -mbig-endian)
15+
list(APPEND TOOLCHAIN_LD_FLAGS -mbig-endian)
16+
endif()
17+
1318
if(CONFIG_FPU)
1419
list(APPEND ARM_C_FLAGS -mfpu=${GCC_M_FPU})
1520

0 commit comments

Comments
 (0)