This question is in continuation of How does compiler lay out code in memory, which is posted at stack-overflow.
I have few questions with respect to
ld (GNU) utility available in Linux.
Whenever a program is run in the shell, say
./a.out, the shell uses
ld to load the program represented by
How does the shell know it has to use
a.out. Does it scan the
a.outto check if it is in the ELF format and if so, uses
ld? It certainly can't use the file name extension, since there is no rule to name executable's in a certain format.
ldutility load programs represented in any other executable formats other than ELF?
Suppose I come up with my own executable format, say "xyz" and I write my own loader
abcwhich handles such executables. Then, is there any shell command to configure: "use loader
abcto load program compiled in a particular executable format "xyz"?