This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: More info: Binary built on different platforms with exact same tools different?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]