Skip to content

Commit 26718d9

Browse files
committed
[Driver][ARM] Warn about -mabi= for assembler input with -fno-integrated-as
Similar to D153691, but for `-x assembler -fno-integrated-as`. Close ClangBuiltLinux/linux#1878 Reviewed By: michaelplatings Differential Revision: https://reviews.llvm.org/D154736
1 parent fc5d8fc commit 26718d9

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,11 @@ void tools::gnutools::Assembler::ConstructJob(Compilation &C,
849849
normalizeCPUNamesForAssembler(Args, CmdArgs);
850850

851851
Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
852+
// The integrated assembler doesn't implement e_flags setting behavior for
853+
// -meabi=gnu (gcc -mabi={apcs-gnu,atpcs} passes -meabi=gnu to gas). For
854+
// compatibility we accept but warn.
855+
if (Arg *A = Args.getLastArgNoClaim(options::OPT_mabi_EQ))
856+
A->ignoreTargetSpecific();
852857
break;
853858
}
854859
case llvm::Triple::aarch64:

clang/test/Driver/arm-abi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464

6565
// RUN: %clang --target=arm---gnueabi -mabi=aapcs -x assembler %s -### -o /dev/null 2>&1 \
6666
// RUN: | FileCheck --check-prefix=CHECK-ASM %s
67+
// RUN: %clang --target=arm---gnueabi -mabi=aapcs -x assembler %s -### -o /dev/null -fno-integrated-as 2>&1 \
68+
// RUN: | FileCheck --check-prefix=CHECK-ASM %s
6769

6870
/// The combination -x assember & -mabi is not implemented, but for GCC compatibility we accept with a warning.
6971
// CHECK-ASM: warning: argument unused during compilation: '-mabi={{.*}}'

clang/test/Driver/linux-as.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
// RUN: | FileCheck -check-prefix=CHECK-ARM-MFPU %s
1616
// CHECK-ARM-MFPU: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-mfpu=neon"
1717
//
18-
// RUN: %clang -target arm-linux -march=armv7-a -### \
18+
// RUN: %clang --target=arm-linux -march=armv7-a -mabi=aapcs-linux -### \
1919
// RUN: -no-integrated-as -c %s 2>&1 \
2020
// RUN: | FileCheck -check-prefix=CHECK-ARM-MARCH %s
2121
// CHECK-ARM-MARCH: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-march=armv7-a"
22+
// CHECK-ARM-MARCH-NOT: "-mabi=
2223
//
2324
// RUN: %clang -target armeb-linux -mlittle-endian -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \
2425
// RUN: -no-integrated-as -c %s 2>&1 \

0 commit comments

Comments
 (0)