Search code examples
gccgnu-assembler

Why GCC can't pass options to `gas` assembler with `-Wa,-adhln=a.lst`?


When I want to generate the list file of a.c with the name a.lst, I execute the command:
gcc -v -S -Wa,-adhln=a.lst a.c
and some of the output is as following:

gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2) 
COLLECT_GCC_OPTIONS='-v' '-S' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1 -quiet -v -imultiarch x86_64-linux-gnu a.c -quiet -dumpbase a.c -mtune=generic -march=x86-64 -auxbase a -version -o a.s -fstack-protector-strong -Wformat -Wformat-security

So, according to the output, I can't find the options of assembler -adhln=a.lst is being passed, and there is no a.lst file generated. My gcc version is gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413, as version is GNU assembler (GNU Binutils for Ubuntu) 2.26. What's wrong with me?


Solution

  • The -Wa option passes flags to the assembler.

    Your command uses -S which means "do not run the assembler".