Search code examples
cassemblygcccompiler-optimizationgnu-assembler

Does GCC optimize assembly source file?


I can use GCC to convert assembly code files into reallocatable files.

gcc -c source.S -o object.o -O2

Is the optimization option effective? Can I expect GCC to optimize my assembly code?


Solution

  • No.

    GCC passes your assembly source through the preprocessor and then to the assembler. At no time are any optimisations performed.