[PATCH] D96285: [clang][Arm] Fix handling of -Wa,-implicit-it=

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 13:21:40 PST 2021


nickdesaulniers added inline comments.


================
Comment at: clang/test/Driver/arm-target-as-mimplicit-it.s:26
+/// assembler flag appearing last (latter wins).
+// RUN: %clang -target arm-linux-gnueabi -### -mimplicit-it=never -Wa,-mimplicit-it=always %S/Inputs/wildcard1.c 2>&1 | FileCheck %s --check-prefix=NEVER_ALWAYS
+// RUN: %clang -target arm-linux-gnueabi -### -mimplicit-it=always -Wa,-mimplicit-it=never %S/Inputs/wildcard1.c 2>&1 | FileCheck %s --check-prefix=ALWAYS_NEVER
----------------
DavidSpickett wrote:
> I'm confused why this generates two `-arm-implicit-it`.
> 
> I'd expect that:
> A c file only uses the compiler's argument
> An assembler file uses the compiler and assembler argument, with the assembler argument last
> 
> Are we calling CollectArgsForIntegratedAssembler even for a C file?
I don't think this is an issue.

> I'm confused why this generates two -arm-implicit-it.

If you check the implementation of `CollectArgsForIntegratedAssembler`, it will call my added helper (`AddARMImplicitITArgs`) for `-mimplicit-it=`, then check for `-Wa,-implicit-it=`.  If both are present, then both will be generated for the assembler, with the latter taking preference.

> Are we calling CollectArgsForIntegratedAssembler even for a C file?

Yes.  Unless `-no-integrated-as` or `-S` was used, we need to be able to modify how assembler is handled both in generating it from C code, but also for inline assembly that may be in a C source.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96285/new/

https://reviews.llvm.org/D96285



More information about the cfe-commits mailing list