[En-Nut-Discussion] GCC optimizations

Coleman Brumley cbrumley at polarsoft.biz
Mon Mar 16 21:35:44 CET 2009


> 
> Coleman Brumley wrote:
> > Would the gcc built for Linux work any differently?
> 
> Two gcc builds for Linux will provide two different results, unless
> they use
> 
> 1. The same GCC version
> 2. The same binutils version
> 3. The same runtime library version (typically newlib)
> 4. The same patches
> 
> Item 4 is a critical one. Several times I built a toolchain from source
> packages, but didn't apply all the required patches. It still worked
> find for me, but may have failed with other code, other compile options
> or other linker options.
> 
> If all four items are the same, there _should_ be no difference between
> toolchains built under Windows, Linux or OS X. In very rare cases the
> different APIs provided by the OS may have an impact on the target
> binary. But that should be considered a bug, or, more trendy, an issue.
> 

Thanks for your replied Harald.  These types of issues are why I try to not
build my compiler from source, but opt to use pre-built binaries for
cross-compiling, if at all possible.  

I'm definitely seeing 2 different results when testing the image compiled
using optimization (-Os) and not using optimization (-O0 (-oh zero)).  The
question I'd have to dig into is whether or not it's my code or Nut/OS.
The data aborts I'm seeing occur in the Nut code, though.  Usually in
NutThreadSwitch or NutThreadKill.  








More information about the En-Nut-Discussion mailing list