I am using gcc 3.2.3-r1. If I compile my kernel with -Os instead of -O2, XFS recovery breaks (no matter how severe the file system damage). The issue is consistently reproducable. XFS recovery never works. The XFS development team has assured me that I should be able to compile their code with -Os. I have not tested this with gcc 3.3.1.
Generally, one should not touch kernel compiliations commands. -O2 has been certified to work perfectly with the kernel. -Os uses -O2, but eliminates certaion options that increase code size, so it is possble this is disabling a segment of code in XFS Recovery that relies on an option specified by -O2 but not -Os. -Os also enables specific optimizations that reduce code size. Unless you're compiling for an embedded environment, I'd advise leaving the -O2 parameter intact to the kernel, and instead reccommend stripping the kernel of any .comment and .note sections via the strip command as follows: strip -R .comment -R .note <uncompressed kernel image>
Resolving as INVALID as there really isn't anything that can be done with this bug. It is likely a generic gcc bug or kernel issue that may or may not be related to Gentoo, but there is not enough information to determine the case. As per Comment #1, it is recommended to try stripping the kernel if you are concerned about code-size. The one kernel I have tried building with -Os didn't even boot.
I'd just like to point out that Gentoo used the -Os flag in its kernels as late as 2.4.19. It was part of the "gentoo" diff included in the patchset.