Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 176240

Summary: When "cross-compiling" to sparc64, CFLAGS="-O2 -pipe" is not sane at all
Product: Gentoo Linux Reporter: Ferris McCormick (RETIRED) <fmccor>
Component: [OLD] Core systemAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED LATER    
Severity: normal CC: sparc
Priority: High    
Version: 2006.1   
Hardware: Sparc64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 59506    

Description Ferris McCormick (RETIRED) gentoo-dev 2007-04-27 12:57:27 UTC
When building kgcc64 (the kernel compiler) on sparc, toolchain.eclass decides that it is doing a cross-compile because (I suppose) the sparc64 userland is always 32 bits, but kgcc64 must build 64-bit kernel code.  It then sets CFLAGS="-O2 -pipe" with the comment:
# Set this to something sane for both native and target

However, when building for target=sparc64, CFLAGS="-O2 -pipe" is probably never sane, and results in just about the worst performance possible for the resulting program.  If the user gives you "-mcpu=ultrasparc", "-mcpu=ultrasparc3", or "-mcpu=v8" you probably must use that unless the application is known not to build for that -mcpu= flag (and this is should have been handled by the ebuild for the package itself.)

Please see Bug 59506 for a discussion of why you shouldn't filter out -mcpu= flags.
Comment 1 SpanKY gentoo-dev 2007-05-03 05:39:16 UTC
you skipped the important comments in the eclass:
    # CFLAGS:
    #   This conflicts when creating a crosscompiler, so set to a sane
    #     default in this case:
    #   used in ./configure and elsewhere for the native compiler
    #   used by gcc when creating libiberty.a
    #   used by xgcc when creating libstdc++ (and probably others)!
    #     this behavior should be removed...