[clang] 26718d9 - [Driver][ARM] Warn about -mabi= for assembler input with -fno-integrated-as
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 10 10:02:32 PDT 2023
Author: Fangrui Song
Date: 2023-07-10T10:02:27-07:00
New Revision: 26718d931feea5b72fafa2e91a15ee5080db4c22
URL: https://github.com/llvm/llvm-project/commit/26718d931feea5b72fafa2e91a15ee5080db4c22
DIFF: https://github.com/llvm/llvm-project/commit/26718d931feea5b72fafa2e91a15ee5080db4c22.diff
LOG: [Driver][ARM] Warn about -mabi= for assembler input with -fno-integrated-as
Similar to D153691, but for `-x assembler -fno-integrated-as`.
Close https://github.com/ClangBuiltLinux/linux/issues/1878
Reviewed By: michaelplatings
Differential Revision: https://reviews.llvm.org/D154736
Added:
Modified:
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/arm-abi.c
clang/test/Driver/linux-as.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 7d4d8e054b0a20..4c08c61eb07213 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -849,6 +849,11 @@ void tools::gnutools::Assembler::ConstructJob(Compilation &C,
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:
diff --git a/clang/test/Driver/arm-abi.c b/clang/test/Driver/arm-abi.c
index 38076f092c8e6f..7bf5977992f65a 100644
--- a/clang/test/Driver/arm-abi.c
+++ b/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={{.*}}'
diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c
index 7a4d3657dc5de2..fb6de85ba105b0 100644
--- a/clang/test/Driver/linux-as.c
+++ b/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 \
More information about the cfe-commits
mailing list