More info: Binary built on different platforms with exact same tools different?
Kaz Kylheku
kaz@zeugmasystems.com
Tue Dec 18 06:25:00 GMT 2007
From: "Rick Mann" <rmann@latencyzero.com>
> On Dec 17, 2007, at 4:59 PM, NightStrike wrote:
>
>> Why would binaries on different platforms be identical?
>
> The toolchain on each host platform is built with identical steps, from
> the same source distro, targetting an embedded Xscale processor.
>
> The source code does not use any OS APIs, just some things in newlib
> (built as part of the toolchain).
So you might think.
However, it's easy for code to become polluted by stuff from the build
machine.
I knows this from experience, having developed a cross-compiled Linux
distribution from scratch.
In one case I had a failure because some /usr/include header got included,
and as a result, inline asm's routines for x86 were being mixed into MIPS
code.
Make sure your GCC is properly sysrooted so it's not picking up local header
files, etc.
> The resulting binary should, in theory, be identical, regardless of the
> host platform.
And of course the input to the compiler after all header file inclusion and
preprocessing should also be the same.
Here is something to try: compile your code with -E in both environments to
capture the raw preprocessor output. You don't want any differences there,
that's for sure.
More information about the Gcc-help
mailing list