On Fri, Jan 12, 2018 at 5:39 PM, Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx> wrote: >> or why the aes_generic implementation needs this on >> powerpc when built with 'gcc -Os'. FWIW, the -Os change was needed >> to work around a possible kernel stack overflow that can happen with >> gcc-7.2, see https://patchwork.kernel.org/patch/10143607/ and >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356 > > The _x versions are smaller but slower; that's why they are used with -Os. > Apparently nothing else was built with -Os (and the other needed flags) > before. Ah, that explains it, the definition is in arch/powerpc/lib/crtsavres.S, but inside of #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE. We could theoretically work around it by turning that into "#if defined(CONFIG_CC_OPTIMIZE_FOR_SIZE) || defined(CONFIG_CRYPTO_AES)", but that seems rather ugly. My earlier patch already tried to be more specific, turning very specific optimizations off rather than moving from -O2 to -Os, but that turned out to lead to significantly worse performance, where -Os improved performance slightly. Is there a way to ask powerpc compilers to use mostly -Os but not the specific thing that makes it link to _restgpr_31_x? Arnd