Position-Independent Code - Intel i960 User Manual

Processor compiler
Hide thumbs Also See for i960:
Table of Contents

Advertisement

9
9-2
i960 Processor Compiler User's Guide
For example, suppose object
Normally, the compiler generates an address of the object with an absolute
addressing mode:
lda _x, g0
When you compile your program with position-independent data, the
compiler generates this instruction to take the address of
lda _x(g12), g0
NOTE. If PID is specified, the value in
and stored by user-provided startup code.

Position-independent Code

When the position-independent code option is specified, the compiler
computes effective addresses by biasing them based upon the instruction
pointer (
).
ip
Suppose object
is in the
_x
bias address into a register at the beginning of any function that needs a
direct address in the
.text
similar to this:
lda 0(ip), r3
lda .
, r4
subo
r4, r3, r3
which leaves the bias in
reference to
as:
_x
lda _x (r3), r4
is in the
_x
.data
must be correctly computed
g12
section. The compiler generates a code
.text
section. It does this via a code sequence
. Then the compiler uses
r3
or the
section.
.bss
:
_x
to bias the
r3

Advertisement

Table of Contents
loading

Table of Contents