How to pass march flag to GCC Assembler arch64-linux-gnu-as

I am trying to cross compile an assembly file using clang but with “-fno-integrated-as” so that clang does not use its own assembler.

Clangs calls the command: /usr/bin/aarch64-linux-gnu-as -o Myfile.o Myfile.s but it fails because of missing -march=armv8-a+crypto which is required to build build my source file Myfile.s

I am passing “-march=armv8-a+crypto” to clang command but how do i promote the same flag to assembler arch64-linux-gnu-as through clang?

You could certainly argue Clang should be forwarding that argument
automatically (assuming you did specify it to Clang itself) as part of
supporting -fno-integrated-as. Not that I think we really encourage
-fno-integrated-as; what problems are you having with the internal
one?

Until someone fixes that issue though, you can use
"-Wa,-march=armv8-a+crypto" to give an argument to the assembler
manually.

Tim.

I am trying to build chromium and at this moment, They see some issues with internal one so recommended to use the flag -fno-integrated-as.
Here is my exact build command (with -v and --save-temps):

$ clang -Igen -I…/…/include -target aarch64-linux-gnu -march=armv8-a+crypto -fno-integrated-as --sysroot=./debian_jessie_arm64-sysroot -O2 -c MyFile.S -o MyFile.o -v --save-temps

clang version 3.8.0 (trunk 247874)
Target: aarch64–linux-gnu
Thread model: posix
Found candidate GCC installation: ./src/build/linux/debian_jessie_arm64-sysroot/usr/lib/gcc/aarch64-linux-gnu/4.8
Selected GCC installation: ./src/build/linux/debian_jessie_arm64-sysroot/usr/lib/gcc/aarch64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64
“clang” -cc1 -triple aarch64–linux-gnu -E -disable-free -main-file-name MyFile.S -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -no-integrated-as -mconstructor-aliases -fuse-init-array -target-cpu generic -target-feature +neon -target-feature +crypto -target-abi aapcs -v -dwarf-column-info -coverage-file MyFile.o -resource-dir …/lib/clang/3.8.0 -I gen -I …/…/include -isysroot ./debian_jessie_arm64-sysroot -internal-isystem ./debian_jessie_arm64-sysroot/usr/local/include -internal-isystem …/lib/clang/3.8.0/include -internal-externc-isystem ./debian_jessie_arm64-sysroot/usr/include/aarch64-linux-gnu -internal-externc-isystem ./debian_jessie_arm64-sysroot/include -internal-externc-isystem ./debian_jessie_arm64-sysroot/usr/include -O2 -fno-dwarf-directory-asm -fdebug-compilation-dir ./out/Release -ferror-limit 19 -fmessage-length 205 -fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o MyFile.s -x assembler-with-cpp …/…/third_party/boringssl/linux-aarch64/crypto/modes/MyFile.S
clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default target x86_64-unknown-linux-gnu

#include “…” search starts here:
#include <…> search starts here:
gen
…/…/third_party/boringssl/src/include
…/lib/clang/3.8.0/include
./debian_jessie_arm64-sysroot/usr/include/aarch64-linux-gnu
./debian_jessie_arm64-sysroot/usr/include
End of search list.
“/usr/bin/aarch64-linux-gnu-as” -I gen -I …/include -o MyFile.o MyFile.s

…/…/third_party/boringssl/linux-aarch64/crypto/modes/ghashv8-armx64.S:31: Error: selected processor does not support `pmull v0.1q,v20.1d,v20.1d’

Manually running /usr/bin/aarch64-linux-gnu-as -march=armv8-a+crypto -I gen -I …/include -o MyFile.o MyFile.s works fine without any errors

-Sri

I am trying to build chromium and at this moment, They see some issues with
internal one so recommended to use the flag -fno-integrated-as.

Hi Sri,

We were clearing all the bugs from the integrated assembler
(20422 – [Meta] Chromium building with -integrated-as on ARM), so if you could try it,
I'd love to hear how much we have progressed since the last time Hans
tried, for both ARM and AArch64.

Manually running /usr/bin/aarch64-linux-gnu-as -march=armv8-a+crypto -I gen
-I ../include -o MyFile.o MyFile.s works fine without any errors

Have you tried -Wa that Tim suggested? It should work just fine.

I agree Clang should pass down the architecture flags to the
assembler, but we're assuming the external assembler will accept all
variations Clang does, which may not be true.

cheers,
--renato

Thanks alot Renato and Tim.
Yes i tried and it worked fine. I am just trying to figure out minimizing my clags.

Thanks again.