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]

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


Hi Everyone,

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?

I ask this becasue in my program there is a jump instructions. Instead of jumping to a label, it jumps to the absolute address of the
label(The address is got from the executable's binary file, with help
of nm for example). Can I just jump to the absolute address like the
following? If the address of the label will be changed when it is
loaded into memory, I have to modify the code to jump to relative
address instead.


... #%eax hold the 32-bit absolute address of the label
jmp %eax

To test it, I run several copies of this executables simutaneously. To
my surpise, all of them give out right output and terminate correctly.
Does this mean the absolute address won't be changed?


Thank you very much for your help!!!

Jun




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