Re: Same source generates different object code for gcc 4.1.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sudhakar govindavajhala <sudhakarg79spam@xxxxxxxxx> writes:

> I am wondering why code generated by the same gcc 4.1.2 compiler on
> the same source and the same machine generates different codes at
> different times.  I find this behavior very odd.  Could someone please
> add me some perspective on this?

In gcc 4.1 doing a #include of <iostream.h> causes your object file to
include a global constructor.  That global constructor would normally be
given a name associated with the first global symbol in your object
file.  Since your object file does not have any global symbols, the
constructor is given a randomly chosen name in the hopes of avoiding
collisions (the name also includes the name of the file you are
compiling).  You can see this if you run "readelf -s --wide" on your
object files.  That randomly chosen name will be different each time the
compiler is run (unless of course you use the -frandom-seed option).

This works differently in current mainline and the objects files are now
consistently identical.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux