I want to find out which compiler/linker options were used to compile the GNU C Standard Library (glibc) when installing Linux. In particular I want to get the same result of the archive libc.a when compiling glibc from source on a different machine (same version of gcc, make, binutils, etc though).
All I could find out was the used gcc version with:
user@ubuntu:/$ /lib/x86_64-linux-gnu/libc.so.6 GNU C Library (Ubuntu GLIBC 2.21-0ubuntu4) stable release version 2.21, ... Compiled by GNU CC version 4.9.2. ...
But when compiling glibc from source with no further options I don't get the same results after running make. The self compiled
libc.a archive is different from the preinstalled one (size and binary wise). So I guess there is some optimization going on. Maybe because of included debug information when compiled from source.
user@ubuntu:~/glibc$ sudo apt-get source libc6 user@ubuntu:~/glibc/glibc-build$ sudo ../glibc-2.21/configure --prefix=/home/user/glibc/glibc-install/ ... sudo make ...
In the debian/rules file and in the output I found, that
-g is used with gcc.
There is an existing question, which I looked at but didn't help me.
I am currently using Ubuntu 15.04, but I need it on other (non debian) systems also. Furthermore it should also work with eglibc on Ubuntu 14.04.
The final goal is to reproduce (compile) every version of glibc used on different systems (I know that's a lot) and make IDA PRO FLIRT signatures out of them. So, in conclusion I need the same binary output at least for
libc.a (that's the file the signatures are made from). Further reading on FLIRT Signatures here.
The Problem with these Signatures is, that every different compiler version and every compiler option can change the output of the Library archive and lead to a different Signature which will only partially work on the analyzed binary.
I'm new to this, so every help is welcome. I hope i didn't forget to mention something important.