Re: gcc binary output differs whether it is built from *.o or *.a

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

 



I've been doing a LOT of work lately trying to understand why I don't
always get 100% identical output from identical source, so I'm somewhat
of an expert in this area.

> I assume that it does not come from the ar packaging, because
> checksums on ar archives are never the same.

The reason ar archive checksums are different is because there is a timestamp stored of the archive members (something the new and long overdue
-D option will address).  However, your problem is still with how you are
calling "ar".  If you put the members in the same order as you would list
them on the compile line, you will get an identical output:

  gcc -o foo main.o 1.o 2.o

vs

  ar q bar.a 1.o 2.o
  gcc -o foo main.o bar.a

The use of "-g" won't affect this.

  Michael

[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