I have the following program:
# include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello World!\n");
return 0;
}
I compiled it (dynamically linked) and used ldd
on a.out
. I saw:
linux-vdso.so.1
libc.so.6
ld-linux-x86-64.so.2
- The first is a virtual shared object provided by the kernel.
- The second is a C standard library.
- The third is a dynamic linker.
I am not sure how the first and third are affected by static linking, and I wonder if the whole standard library is used, even if I only include one header from it.
If I statically link this program, will the resulting binary
- contain
linux-vdso.so.1
, even though it is provided by the kernel? - contain the entire C standard library, even though I only included
<stdio.h>
? - contain
ld-linux-x86-64.so.2
, even though it is used to run dynamically linked programs?