Skip to content

Commit 26fdfb5

Browse files
statham-armMarkMurrayARM
authored andcommitted
[ATfE] Fail with an error message when -frwpi is used. (arm#428)
ATfE doesn't currently provide any library variants built for RWPI. And if you link RWPI with non-RWPI code, nothing good will happen – they have incompatible ABIs. So we ought to give an error message rather than silently choose an incompatible library. Using llvm/llvm-project#149132 which allowed multilib selection to be aware of the relocation model at all, this commit does the simplest possible thing: adds a catch-all error message that will trigger on _any_ use of `-frwpi`, and report that there's no suitable library variant. (Another possibility would have been to add `-fno-rwpi` to the validity criteria for each existing library, but that seemed less likely to give a good error message. It would allow RWPI variants to be present for some cases but not all, but at the moment, we don't need that.) Since the error message works the same everywhere, I've just added one test. (cherry picked from commit 43cc67f)
1 parent 66c2338 commit 26fdfb5

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

arm-software/embedded/arm-multilib/multilib.yaml.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ Groups:
4242
Variants:
4343
@multilib_yaml_content@
4444

45+
# Append an error case to the Variants list, matching anything that
46+
# enables the RWPI option. We don't build any library variants using
47+
# the RWPI style of access to writable static data, so if a user
48+
# compiles with -frwpi, we don't have any compatible library.
49+
- Error: Arm Toolchain for Embedded does not provide RWPI library variants
50+
Flags:
51+
- -frwpi
52+
Group: stdlibs
53+
4554
Mappings:
4655

4756
# Map higher architecture versions to subsets of them, so that a
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# RUN: %clang -print-multi-directory --target=arm-none-eabi -march=armv7a 2>%t | FileCheck --check-prefix=NORWPI --allow-empty %s
2+
# NORWPI: arm-none-eabi/armv7a_soft_vfpv3_d16_exn_rtti_unaligned{{$}}
3+
4+
# RUN: not %clang -print-multi-directory --target=arm-none-eabi -march=armv7a -frwpi 2>%t | FileCheck --check-prefix=RWPI --allow-empty %s
5+
# RUN: FileCheck --check-prefix=RWPI_ERR %s < %t
6+
# RWPI-NOT: arm-none-eabi
7+
# RWPI_ERR: clang: error: multilib configuration error: Arm Toolchain for Embedded does not provide RWPI library variants
8+

0 commit comments

Comments
 (0)