Skip to content

Commit

Permalink
[Driver][ARM] Warn about -mabi= for assembler input with -fno-integra…
Browse files Browse the repository at this point in the history
…ted-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
  • Loading branch information
MaskRay committed Jul 10, 2023
1 parent fc5d8fc commit 26718d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions clang/lib/Driver/ToolChains/Gnu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Driver/arm-abi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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={{.*}}'
3 changes: 2 additions & 1 deletion clang/test/Driver/linux-as.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 26718d9

Please sign in to comment.