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?
No.
GCC passes your assembly source through the preprocessor and then to the assembler. At no time are any optimisations performed.