> I understand that gcc -On happens before generating assembly code (.s), is > it correct?
Yes. > But some optimization, such as inlining, may require cross > compilation-unit (i.e, cross file) information. It seems that these > kind of optization is better to be handled at link time (thus, cross > compilation units info is available). Yes, you're right; and this is a current subject of discussion for the way forward for GCC. If you check the gcc@ mailing list archives since December or so, you can see the discussion about "LTO" (link time optimisation). Ben