开发者

What is meant by statically relocated or static relocation of a segment

The elf format executable contains various segments like code, data, bss, stack etc. If we say that the segment xyz is st开发者_StackOverflow中文版atically relocated what does that mean?

The elf format binary contains relative addresses for each segment. When we say statically relocated does it mean that the relative addresses are actually the physical addresses?


Static relocation means moving data or coding and assigning absolute locations to them before a program is run. For ex:- Linker is an example of static relocation which moves several modules of the program and combine them into program.


Static relocation refers to address transformations being done before execution of a program begins. A typical hardware instruction cycle looks like this:

loop
    w := M[instr_ctr];          (* fetch instruction *)
    oc := Opcode(w);
    adr := Address(w);
    instr_ctr := instr_ctr + 1;
    case oc of
    1:  reg := reg+M[adr];    (* add *)
    2:  M[adr] := reg;        (* store *)
    3:  instr_ctr := adr;     (* branch *)
    ...
    end
end (* loop *)


in a no memory abstraction situation ( programs access physical memory directly ) it goes like this: program A uses address x program B also uses address x at some point

in order for both programs to run simultaneously some operating systems / early computers such as the IBM 360 modifies program B's addresses on the fly as it loaded it, so that it wont use memory adresses used by program A

When a program was loaded at address 16,384, the constant 16,384 was added to every program address during the load process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜