Skip to content

Commit 27ee08e

Browse files
committed
[ATfE] v8-M library naming and selection issues for strict alignment builds. (#250)
We don’t have a -mno-unaligned-access specific variant for the v8M libraries. For v8-M with strict aligned access, it’s more appropriate to use the v7-M variants, as they include a version with strict alignment support. It was a deliberate decision to provide strict-alignment variants only for a subset of architectures. To support this, both -mno-unaligned-access and -munaligned-access options must be passed into the multilib selection logic. This aligns with the approach in llvm/llvm-project#134099, which also considers the target architecture when determining the alignment access policy. Since Armv6-M does not support unaligned accesses, test changes are needed to reflect the updated behaviour when the target architecture is taken into account. This patch fixes below issues. 1. The naming of the v8-M libraries should explicitly include ‘unaligned’ to reflect their behaviour. 2. When using -mno-unaligned-access, the multilib system should instead select the v7-M variant. 3. Armv6m test changes are needed to reflect the updated behaviour when the target architecture is taken into account. (cherry picked from commit 8c3bbfc)
1 parent 764d6b8 commit 27ee08e

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

arm-software/embedded/arm-multilib/json/multilib.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -441,24 +441,24 @@
441441
"flags": "--target=thumbebv7m-unknown-none-eabi -mfpu=none -fno-exceptions -fno-rtti"
442442
},
443443
{
444-
"variant": "armv8m.main_soft_nofp_exn_rtti",
445-
"json": "armv8m.main_soft_nofp_exn_rtti.json",
446-
"flags": "--target=thumbv8m.main-unknown-none-eabi -mfpu=none"
444+
"variant": "armv8m.main_soft_nofp_exn_rtti_unaligned",
445+
"json": "armv8m.main_soft_nofp_exn_rtti_unaligned.json",
446+
"flags": "--target=thumbv8m.main-unknown-none-eabi -mfpu=none -munaligned-access"
447447
},
448448
{
449-
"variant": "armv8m.main_soft_nofp",
450-
"json": "armv8m.main_soft_nofp.json",
451-
"flags": "--target=thumbv8m.main-unknown-none-eabi -mfpu=none -fno-exceptions -fno-rtti"
449+
"variant": "armv8m.main_soft_nofp_unaligned",
450+
"json": "armv8m.main_soft_nofp_unaligned.json",
451+
"flags": "--target=thumbv8m.main-unknown-none-eabi -mfpu=none -fno-exceptions -fno-rtti -munaligned-access"
452452
},
453453
{
454-
"variant": "armv8m.main_hard_fp_exn_rtti",
455-
"json": "armv8m.main_hard_fp_exn_rtti.json",
456-
"flags": "--target=thumbv8m.main-unknown-none-eabihf -mfpu=fpv5-sp-d16"
454+
"variant": "armv8m.main_hard_fp_exn_rtti_unaligned",
455+
"json": "armv8m.main_hard_fp_exn_rtti_unaligned.json",
456+
"flags": "--target=thumbv8m.main-unknown-none-eabihf -mfpu=fpv5-sp-d16 -munaligned-access"
457457
},
458458
{
459-
"variant": "armv8m.main_hard_fp",
460-
"json": "armv8m.main_hard_fp.json",
461-
"flags": "--target=thumbv8m.main-unknown-none-eabihf -mfpu=fpv5-sp-d16 -fno-exceptions -fno-rtti"
459+
"variant": "armv8m.main_hard_fp_unaligned",
460+
"json": "armv8m.main_hard_fp_unaligned.json",
461+
"flags": "--target=thumbv8m.main-unknown-none-eabihf -mfpu=fpv5-sp-d16 -fno-exceptions -fno-rtti -munaligned-access"
462462
},
463463
{
464464
"variant": "armv8.1m.main_soft_nofp_nomve_exn_rtti",

arm-software/embedded/test/multilib/armv6m.test

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
# RUN: %clang -print-multi-directory --target=armv6m-none-eabi -mfpu=none | FileCheck %s --check-prefix=CHECK-NOFP-EXN-RTTI-UNALIGNED
2-
# CHECK-NOFP-EXN-RTTI-UNALIGNED: arm-none-eabi/armv6m_soft_nofp_exn_rtti_unaligned{{$}}
3-
# CHECK-NOFP-EXN-RTTI-UNALIGNED-EMPTY:
4-
1+
# RUN: %clang -print-multi-directory --target=armv6m-none-eabi -mfpu=none | FileCheck %s --check-prefix=CHECK-NOFP-EXN-RTTI
52
# RUN: %clang -print-multi-directory --target=armv6m-none-eabi -mfpu=none -mno-unaligned-access | FileCheck %s --check-prefix=CHECK-NOFP-EXN-RTTI
63
# CHECK-NOFP-EXN-RTTI: arm-none-eabi/armv6m_soft_nofp_exn_rtti{{$}}
74
# CHECK-NOFP-EXN-RTTI-EMPTY:
85

9-
# RUN: %clang -print-multi-directory --target=armv6m-none-eabi -mfpu=none -fno-exceptions -fno-rtti | FileCheck %s --check-prefix=CHECK-NOFP-UNALIGNED
10-
# CHECK-NOFP-UNALIGNED: arm-none-eabi/armv6m_soft_nofp_unaligned{{$}}
11-
# CHECK-NOFP-UNALIGNED-EMPTY:
12-
6+
# RUN: %clang -print-multi-directory --target=armv6m-none-eabi -mfpu=none -fno-exceptions -fno-rtti | FileCheck %s --check-prefix=CHECK-NOFP
137
# RUN: %clang -print-multi-directory --target=armv6m-none-eabi -mfpu=none -fno-exceptions -fno-rtti -mno-unaligned-access | FileCheck %s --check-prefix=CHECK-NOFP
148
# CHECK-NOFP: arm-none-eabi/armv6m_soft_nofp{{$}}
159
# CHECK-NOFP-EMPTY:
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
# RUN: %clang -print-multi-directory --target=armv8m.main-none-eabi -mfpu=none | FileCheck %s
2-
# CHECK: arm-none-eabi/armv8m.main_soft_nofp_exn_rtti{{$}}
2+
# CHECK: arm-none-eabi/armv8m.main_soft_nofp_exn_rtti_unaligned{{$}}
33
# CHECK-EMPTY:
44

55
# RUN: %clang -print-multi-directory --target=armv8m.main-none-eabihf -mfpu=fpv5-sp-d16 | FileCheck --check-prefix=HARD %s
6-
# HARD: arm-none-eabi/armv8m.main_hard_fp_exn_rtti{{$}}
6+
# HARD: arm-none-eabi/armv8m.main_hard_fp_exn_rtti_unaligned{{$}}
77
# HARD-EMPTY:
88

99
# Fallback to armv7m
10+
# RUN: %clang -print-multi-directory --target=armv8m.main-none-eabi -mfpu=none -mno-unaligned-access | FileCheck --check-prefix=NOFP %s
11+
# NOFP: arm-none-eabi/armv7m_soft_nofp_exn_rtti{{$}}
12+
# NOFP-EMPTY:
13+
1014
# RUN: %clang -print-multi-directory --target=armv8m.main-none-eabi -mfpu=fpv5-sp-d16 | FileCheck --check-prefix=SOFTFP %s
1115
# SOFTFP: arm-none-eabi/armv7m_soft_fpv4_sp_d16_exn_rtti_unaligned{{$}}
1216
# SOFTFP-EMPTY:
17+
18+
# RUN: %clang -print-multi-directory --target=armv8m.main-none-eabihf -mfpu=fpv5-sp-d16 -mno-unaligned-access | FileCheck --check-prefix=HARDFP %s
19+
# HARDFP: arm-none-eabi/armv7m_hard_fpv4_sp_d16_exn_rtti{{$}}
20+
# HARDFP-EMPTY:

0 commit comments

Comments
 (0)