Skip to content

Commit 202115a

Browse files
MaskRayChenyang-L
authored andcommitted
[Driver][ARM] Warn about -mabi= for assembler input
Previously, Clang Driver reported a warning when assembler input was assembled with the -mabi= option. D152856 added TargetSpecific to -mabi= option and reported an error for such a case. This change restores the previous behavior by reporting a warning. GCC translates -mabi={apcs-gnu,atpcs} to gas -meabi=gnu and other -mabi= values to -meabi=5. We don't support setting e_flags to any value other than EF_ARM_EABI_VER5. Close ClangBuiltLinux/linux#1878 Reviewed By: michaelplatings Differential Revision: https://reviews.llvm.org/D153691
1 parent 1371563 commit 202115a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

clang/lib/Driver/ToolChains/Arch/ARM.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,12 @@ llvm::ARM::FPUKind arm::getARMTargetFeatures(const Driver &D,
524524
}
525525
}
526526
}
527+
528+
// The integrated assembler doesn't implement e_flags setting behavior for
529+
// -meabi=gnu (gcc -mabi={apcs-gnu,atpcs} passes -meabi=gnu to gas). For
530+
// compatibility we accept but warn.
531+
if (Arg *A = Args.getLastArgNoClaim(options::OPT_mabi_EQ))
532+
A->ignoreTargetSpecific();
527533
}
528534

529535
if (getReadTPMode(D, Args, Triple, ForAS) == ReadTPMode::TPIDRURW)

clang/test/Driver/arm-abi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@
6161
// CHECK-APCS-GNU: "-target-abi" "apcs-gnu"
6262
// CHECK-AAPCS: "-target-abi" "aapcs"
6363
// CHECK-AAPCS-LINUX: "-target-abi" "aapcs-linux"
64+
65+
// RUN: %clang --target=arm---gnueabi -mabi=aapcs -x assembler %s -### -o /dev/null 2>&1 \
66+
// RUN: | FileCheck --check-prefix=CHECK-ASM %s
67+
68+
/// The combination -x assember & -mabi is not implemented, but for GCC compatibility we accept with a warning.
69+
// CHECK-ASM: warning: argument unused during compilation: '-mabi={{.*}}'

0 commit comments

Comments
 (0)