Optimizations for purgatory
msm at freescale.com
Thu Sep 9 17:25:53 EDT 2010
I've been compiling kexec-tools natively for ppc32 and everything has been working fine. However, I recently had to start cross compiling on an x86_64 box and I ran into an issue with the code generation in purgatory. I can eliminate the my issue by stepping down to (or up?) to -O2 -fno-reorder-blocks. Somehow -freorder-blocks is causing a problem even though according to the gcc documentation -Os disables this flag . If I had to make a guess, I would think that purgatory elf relocatable generated with my compiler is not being properly updated by kexec-tools before being passed to the kernel.
So my question is two-fold...
1) Is there any reason we don't just use -O0 instead of -0s? This would provide a consistent set of compiler optimization flags across all versions of gcc and we don't have to worry about a flag being added or removed across versions. Or perhaps explicitly list all desired flags?
2) Has anyone else experienced issue with purgatory code not being generated correctly? Specifically looking at a disassebly it looks like -freorder-blocks is changed how functions return. On ppc for example it appears that the functions are not returning using the link register and instead are just branching.
 - http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Optimize-Options.html#Optimize-Options
More information about the kexec