We have recently installed RHEL 5.4 on some existing 6.2 OS and migrated our code from RH 6.2 to RHEL 5.4. We are facing a difficulty that given a binary (on both OS they have same name) how can we distinguish that which gcc and OS it was build as there are some minor differences in between binary respectively made.
you can check the dependancy libraries which can distinguish the binaries
ldd binary_file
If their versions match that of the current version of the libs.
apparently you can check out the external libs they are using another way too.
nm -o binary_file | grep '\bU\b'
The binary file alone cannot give you the information about which version of gcc was used to build it.
If there is a difference b/w the kernel version they are using then you can check the binaries that are made for 2.4 or 2.6 . I suppose redhat-6.2 uses 2.4 while rhel uses 2.6.18.
example :
file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, not stripped
So it lists 2.6 on mine
So in order to distinguish you can rename all lthe binaries depending on the kernel version to later distinguish them
#!/bin/bash
for fil in $DIR/*;do if file $fil | grep -q '2.6' ;then echo "2.6-${fil}";else echo "2.4-${fil}";fi;done
Apparently you can rename the files with the kernel version to find out which OS it was built.