Technically, in terms of file content, what is the difference between the output of gcc -fPIC -shared src.c
and gcc -fPIC src.c
?
Assume that int main(int, char**)
is defined in src.c
so that both compilations succeed. But executing the a.out
generated by gcc -shared src.c
, as expected, gave the following error:
-bash: ./a_shared.out: cannot execute binary file
Even if there is a main
function it it.
Also, how can I inspect the difference in the output files using tools like otool
or objdump
?
Thanks a lot.