live_dont_exist
January 16th, 2015, 14:14
Hi All,
I've been trying to write some code to detect the libraries inside statically linked binaries. I've made some nice progress (will share when done). But here is where I am stuck. There's a very simple program that I wrote for test purposes and statically linked with libc.
After lots of studying in IDA, I can see some libc code in the binary but there also appear to be other functions (sub_<NUMBER>
that are NOT libc. So the question is, what are these functions? Does gcc add them in by default? Is it the way IDA disassembles things? And whaetver that stuff is... where can I find it on the OS? Like libc I found in libc.a some directory. SImilarly, are those additional functions also due to some libraries? Where are these?
Here is the code for test.c that generates lots of functions in IDA.
Any pointers are appreciated. Thanks.
I've been trying to write some code to detect the libraries inside statically linked binaries. I've made some nice progress (will share when done). But here is where I am stuck. There's a very simple program that I wrote for test purposes and statically linked with libc.
Code:
gcc -static -lc -o test test.c
After lots of studying in IDA, I can see some libc code in the binary but there also appear to be other functions (sub_<NUMBER>

Here is the code for test.c that generates lots of functions in IDA.
Code:
/* http://iamtgc.com/selectively-statically-compile-and-link-nix-binaries/ */
#include <stdio.h>
#include <math.h>
void calc(){
float d= cos(90);
printf("cosine of 90 is %f", d);
}
int main() {
calc();
}
Any pointers are appreciated. Thanks.