[PATCH] D154736: [Driver][ARM] Warn about -mabi= for assembler input with -fno-integrated-as

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 7 11:40:44 PDT 2023


MaskRay created this revision.
MaskRay added reviewers: michaelplatings, peter.smith, simon_tatham, nathanchance, nickdesaulniers.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Similar to D153691 <https://reviews.llvm.org/D153691>, but for `-x assembler -fno-integrated-as`.

Close https://github.com/ClangBuiltLinux/linux/issues/1878


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154736

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/test/Driver/arm-abi.c
  clang/test/Driver/linux-as.c


Index: clang/test/Driver/linux-as.c
===================================================================
--- clang/test/Driver/linux-as.c
+++ clang/test/Driver/linux-as.c
@@ -15,10 +15,11 @@
 // RUN:   | FileCheck -check-prefix=CHECK-ARM-MFPU %s
 // CHECK-ARM-MFPU: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-mfpu=neon"
 //
-// RUN: %clang -target arm-linux -march=armv7-a -### \
+// RUN: %clang --target=arm-linux -march=armv7-a -mabi=aapcs-linux -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-ARM-MARCH %s
 // CHECK-ARM-MARCH: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-march=armv7-a"
+// CHECK-ARM-MARCH-NOT: "-mabi=
 //
 // RUN: %clang -target armeb-linux -mlittle-endian -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
Index: clang/test/Driver/arm-abi.c
===================================================================
--- clang/test/Driver/arm-abi.c
+++ clang/test/Driver/arm-abi.c
@@ -64,6 +64,8 @@
 
 // RUN: %clang --target=arm---gnueabi -mabi=aapcs -x assembler %s -### -o /dev/null 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-ASM %s
+// RUN: %clang --target=arm---gnueabi -mabi=aapcs -x assembler %s -### -o /dev/null -fno-integrated-as 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-ASM %s
 
 /// The combination -x assember & -mabi is not implemented, but for GCC compatibility we accept with a warning.
 // CHECK-ASM: warning: argument unused during compilation: '-mabi={{.*}}'
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -849,6 +849,11 @@
     normalizeCPUNamesForAssembler(Args, CmdArgs);
 
     Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
+    // The integrated assembler doesn't implement e_flags setting behavior for
+    // -meabi=gnu (gcc -mabi={apcs-gnu,atpcs} passes -meabi=gnu to gas). For
+    // compatibility we accept but warn.
+    if (Arg *A = Args.getLastArgNoClaim(options::OPT_mabi_EQ))
+      A->ignoreTargetSpecific();
     break;
   }
   case llvm::Triple::aarch64:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154736.538218.patch
Type: text/x-patch
Size: 2155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230707/26f3f92e/attachment.bin>


More information about the cfe-commits mailing list