开发者

Does Solaris cc embed in an executable differing info for different compiles?

开发者 https://www.devze.com 2022-12-10 05:03 出处:网络
G\'day, This has been asked before for VC++ but I am interested in the answer for Solaris. I\'m compiling and linking the following trivial C code:

G'day,

This has been asked before for VC++ but I am interested in the answer for Solaris.

I'm compiling and linking the following trivial C code:

#include <stdio.h>

int main() {
    printf("Hello world!\n");
    return 0;
}

using the command:

cc -o hello1 hello.c

and doing this a couple of times to get executables hello2 and hello3. This is being done on the same machine with the same compiler and in the same directory just at different times.

The sizes of the executables are the same but diff reports the binaries as differing and cmp -l goes crazy with a long list of differing locations.

Anyone know what cc is embedding in the executables to make them differ? Timestamps?

Edit: Stripping the executables as Chris suggested below makes diff report the two executa开发者_开发问答bles as identical.

cheers,


If you use "od -c" on the two binaries, and then use a side-by-side diff program, you can get an idea what the differences are. In the past when I have investigated the Sun compilers, it's usually a date string. You can also try stripping the executable to see if that removes the ELF section that has the difference in it.


If you take the exact same source code and compile it twice with Sun's compiler you will not get two exact-binary-duplicate files. There will be minor differences. As far as I know, it mostly just comes down to date/time issues.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号