Linkage order for compiler-generated code?

Phil Torre ptorre at
Thu Aug 23 01:21:49 UTC 2007

Hi All,

Got a weird problem here.  The environment is rtems-4.6.0 or so, built
with gcc-3.2.3 with the RTEMS patches applied.

We build our powerpc-targeted RTEMS code on either Cygwin or Linux,
as suits the particular developer.  A while back, I made sure that
we could obtain a bit-identical image from the same source, regardless
of build host.  I just went back to revisit that assumption, and found
that it was false.

Details:  Both build hosts are generating exactly the same code, except
for the extra "magic C++ goop" that the compiler throws in for free
(__cxa_begin_catch, __cxa_end_catch, and about 25 other functions).
That "bonus" code has the same instructions, but the functions appear
in different order in the final linked elf file, so all code that
calls any of them ends up with different branch addresses.  All works
fine, of course, but the different addresses cause the ROM code to 
have a different CRC-32 depending on which host it was built on.

Does anyone know what controls the order that the extra functions get
linked in?  (This is more appropriate to the gcc list, but I can't
find anything even relevant there.)

Thanks much for any suggestions...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list