}
// -mkernel implies -mstrict-align; don't add the redundant option.
if (!KernelOrKext) {
- if (Args.hasArg(options::OPT_mno_unaligned_access)) {
- CmdArgs.push_back("-backend-option");
- CmdArgs.push_back("-arm-strict-align");
- } else if (Args.hasArg(options::OPT_munaligned_access)) {
- CmdArgs.push_back("-backend-option");
- CmdArgs.push_back("-arm-no-strict-align");
+ if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
+ options::OPT_munaligned_access)) {
+ if (A->getOption().matches(options::OPT_mno_unaligned_access)) {
+ CmdArgs.push_back("-backend-option");
+ CmdArgs.push_back("-arm-strict-align");
+ } else {
+ CmdArgs.push_back("-backend-option");
+ CmdArgs.push_back("-arm-no-strict-align");
+ }
}
}
// RUN: %clang -target arm-none-gnueeabi -munaligned-access -### %s 2> %t
// RUN: FileCheck --check-prefix=CHECK-UNALIGNED < %t %s
+// RUN: %clang -target arm-none-gnueeabi -mstrict-align -munaligned-access -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-UNALIGNED < %t %s
+
+// RUN: %clang -target arm-none-gnueeabi -mno-unaligned-access -munaligned-access -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-UNALIGNED < %t %s
+
// CHECK-UNALIGNED: "-backend-option" "-arm-no-strict-align"
+
// RUN: %clang -target arm-none-gnueeabi -mno-unaligned-access -### %s 2> %t
// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s
+// RUN: %clang -target arm-none-gnueeabi -mstrict-align -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s
+
+// RUN: %clang -target arm-none-gnueabi -munaligned-access -mno-unaligned-access -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s
+
+// RUN: %clang -target arm-none-gnueabi -munaligned-access -mstrict-align -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s
+
// CHECK-ALIGNED: "-backend-option" "-arm-strict-align"