Doubt about how a linker generates a memory image

M

Mayank Kaushik

Hi everyone,

I am confused about how the linker actually goes about generating a
memory image. Right now im studying how ld works, i have to use it with
an ARM920T.

Suppose i have a program with two sections, one of which has a size of
1kb, and is to be placed at location 0x200000, and another which also
has a size of 1kb and is to be placed at 0x600000. How does the linke
ensure that these sections go to the correct place? Does it do this by
padding the intermediate spaces? But if this were true, then for a 2kb
program, the size of the image would be 0x600000 + 1Kb!

When the image is loaded into the uC`s memory through, say, a serial
connection, the loading program would be dumb and would not know where
to place which part of the image..so how does the data get to the
correct place??

Plz help..

Regards

Mayank
 
C

Chris Williams

Mayank said:
I am confused about how the linker actually goes about generating a
memory image. Right now im studying how ld works, i have to use it with
an ARM920T.

This newsgroup is intended for questions on the C language. A perfectly
legal C application could be running as a script in a C scripting
engine without ever having seen a linker....

I would recommend comp.compilers

Sorry,
Chris
 
M

Mayank Kaushik

Chris said:
A perfectly
legal C application could be running as a script in a C scripting
engine without ever having seen a linker....

I didnt know "C scripting engines" existed! Thanx anyway
 
B

Bansidhar

This question is not intended here. Still I will try to give the
answer.
ld does this through elf format. Elf format has different sections.
Each section has its own phisical address. This information is passed
through elf file (your executable). Thus you need not worry about
padding of intermediate space.
For more information on ELF please refer
http://www.cs.ucdavis.edu/~haungs/paper/node10.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top