This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: when an executable is loaded, it's address will be changed?


Ge Jun wrote:
Ian Lance Taylor wrote:

Ge Jun <gejun@iastate.edu> writes:



An executable's code has already the absolute address(or the relative
address in that section?) in it.  For
example, the "nm" tool can list the address of the labels.

My question is, when the executable is loaded by linux, will the
address be changed?


No, the address of an executable will not be changed.  (The address of
a shared library may--indeed, probably will--be changed when it is
loaded.)

In other words, it is not a requirement that the code in an executable
be position independent.



Thank you very much!! I still have a question. How does the loader work if I have several copies of the program running simutaneously? Their address are the same.

Their *virtual* addresses are the same; not their *physical* addresses


They will be loaded in the same address in the memory(but only one is in there at one time)?

In general, a loader loads a program to a fixed virtual address. You can have multiple programs running at the same virtual addresses, because the loader and operating system have set up the processor's page tables such that the programs occupy different regions of physical memory. As a user, you don't know about the 'real' physical memory that your program is in; you only see the virtual memory.


If possible, could you please also give me a link talking about how does the loader work? I checked by myself but failed to find such a webpage.

Thank you again!!

Jun

I don't know any links; you could try Bach's 'The design of the Unix operating system' for some more details.


Evan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]