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: gcc binary output differs whether it is built from *.o or *.a


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]