How to specify the compiler used to compile the assembly

I can specify the linker by giving the flags “-cc gcc11”.
But how do i specify the specific assembly compiler used. It defaults for me to gcc.

ocamlopt -cc gcc11 -verbose echo.ml produces ,

  • gcc -c -o ‘echo.o’ ‘/tmp/camlasmf0a219.s’
  • gcc -c -o ‘/tmp/camlstartup329c5f.o’ ‘/tmp/camlstartup2c9d68.s’
  • gcc11 -o ‘a.out’ ‘-L/usr/home/x/.opam/4.13.1+options/lib/ocaml’ ‘/tmp/camlstartup329c5f.o’ ‘/usr/home/x/.opam/4.13.1+options/lib/ocaml/std_exit.o’ ‘echo.o’ ‘/usr/home/x/.opam/4.13.1+options/lib/ocaml/stdlib.a’ ‘/usr/home/x/.opam/4.13.1+options/lib/ocaml/libasmrun.a’ -lm

You can specify the assembler (and the C compiler as well) at ./configure time by setting the AS and CC variables. See ./configure --help for the details.

Cheers,
Nicolas

1 Like

On my pc i currently have :

gcc-11_4 Meta-port for the default version of the GNU Compiler Collection
gcc10-10.3.0 GNU Compiler Collection 10
gcc11-11.2.0 GNU Compiler Collection 11
gcc6-aux-20180516_2,1 Version of GCC 6 with full Ada support
gcc8-8.5.0_1 GNU Compiler Collection 8
gcc9-9.4.0 GNU Compiler Collection 9
llvm-13 Meta-port for the default version of the LLVM Toolchain
llvm10-10.0.1_8 LLVM and Clang
llvm11-11.0.1_3 LLVM and Clang
llvm12-12.0.1_6 LLVM and Clang
llvm13-13.0.0_2 LLVM and Clang
llvm70-7.0.1_6 LLVM and Clang
llvm80-8.0.1_5 LLVM and Clang
llvm90-9.0.1_3 LLVM and Clang

so there is choice.