Skip to content

Commit

Permalink
add ExclusiveGroup feature to multilib.yaml.
Browse files Browse the repository at this point in the history
This patch adds an ExclusiveGroup: stdlibs flag to all variants.
Being in the same ExclusiveGroup would result in the last matching
variant out of multiple matching variants to be selected.

When no -mfpu=none is specified, the compiler internally adds all other
possible fpu settings when searching for matching variants. So for the
no-fpu variant to win, it has to be added to multilab.yaml after all
other fpu variants. So reorder the add_library_variant calls accordingly.
  • Loading branch information
amilendra committed Sep 28, 2023
1 parent 7b81a43 commit 8e82341
Showing 1 changed file with 33 additions and 20 deletions.
53 changes: 33 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ function(add_library_variant target_arch)
foreach(flag ${multilib_flags_list})
string(APPEND multilib_yaml_content " - ${flag}\n")
endforeach()
string(APPEND multilib_yaml_content " ExclusiveGroup: stdlibs\n")

install(
DIRECTORY "${LLVM_BINARY_DIR}/${directory}/"
Expand Down Expand Up @@ -1083,21 +1084,6 @@ add_library_variant(
RAM_SIZE 2M
STACK_SIZE 4K
)
add_library_variant(
armv7m
SUFFIX soft_nofp
COMPILE_FLAGS "-mfloat-abi=soft -march=armv7m -mfpu=none"
MULTILIB_FLAGS "--target=thumbv7m-none-unknown-eabi -mfpu=none"
QEMU_MACHINE "mps2-an385"
QEMU_CPU "cortex-m3"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x00001000
FLASH_SIZE 0x3ff000
RAM_ADDRESS 0x20000000
RAM_SIZE 2M
STACK_SIZE 4K
)
add_library_variant(
armv7m
SUFFIX soft_fpv4_sp_d16
Expand All @@ -1113,13 +1099,19 @@ add_library_variant(
RAM_SIZE 2M
STACK_SIZE 4K
)
# When no -mfpu=none is specified, the compiler internally adds all other
# possible fpu settings before searching for matching variants. So for the
# no-fpu variant to win, it has to be in multilab.yaml after all other
# fpu variants. The order of variants in multilab.yaml depends on the order
# of the add_library_variant calls. So the add_library_variant that adds
# the soft_nofp for armv7m is placed after all other armv7m variants.
add_library_variant(
armv7em
armv7m
SUFFIX soft_nofp
COMPILE_FLAGS "-mfloat-abi=soft -march=armv7em -mfpu=none"
MULTILIB_FLAGS "--target=thumbv7em-none-unknown-eabi -mfpu=none"
QEMU_MACHINE "mps2-an386"
QEMU_CPU "cortex-m4"
COMPILE_FLAGS "-mfloat-abi=soft -march=armv7m -mfpu=none"
MULTILIB_FLAGS "--target=thumbv7m-none-unknown-eabi -mfpu=none"
QEMU_MACHINE "mps2-an385"
QEMU_CPU "cortex-m3"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x00001000
Expand Down Expand Up @@ -1158,6 +1150,27 @@ add_library_variant(
RAM_SIZE 2M
STACK_SIZE 4K
)
# When no -mfpu=none is specified, the compiler internally adds all other
# possible fpu settings before searching for matching variants. So for the
# no-fpu variant to win, it has to be in multilab.yaml after all other
# fpu variants. The order of variants in multilab.yaml depends on the order
# of the add_library_variant calls. So the add_library_variant that adds
# the soft_nofp for armv7em is placed after all other armv7em variants.
add_library_variant(
armv7em
SUFFIX soft_nofp
COMPILE_FLAGS "-mfloat-abi=soft -march=armv7em -mfpu=none"
MULTILIB_FLAGS "--target=thumbv7em-none-unknown-eabi -mfpu=none"
QEMU_MACHINE "mps2-an386"
QEMU_CPU "cortex-m4"
BOOT_FLASH_ADDRESS 0x00000000
BOOT_FLASH_SIZE 0x1000
FLASH_ADDRESS 0x00001000
FLASH_SIZE 0x3ff000
RAM_ADDRESS 0x20000000
RAM_SIZE 2M
STACK_SIZE 4K
)
add_library_variant(
armv8m.main
SUFFIX soft_nofp
Expand Down

0 comments on commit 8e82341

Please sign in to comment.