3

The elf format executable contains various segments like code, data, bss, stack etc. If we say that the segment xyz is statically 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?

Ashish
  • 569
  • 3
  • 10
  • 18

3 Answers3

4

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.

iSegFault
  • 947
  • 2
  • 9
  • 18
2

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 *)
antyrat
  • 27,479
  • 9
  • 75
  • 76
1

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.

Redouane Zait
  • 175
  • 3
  • 8