Keil™, An ARM® Company

RealView Compiler User's Guide

Position independence qualifiers

2.5.2. Position independence qualifiers

These ‑‑apcs qualifiers control position independence. They also affect the creation of reentrant and thread‑safe code.

For more information see:

Restrictions on position independent code and data

There are restrictions when you compile code with /ropi or /rwpi. The main restrictions are:

  • The use of ‑‑apcs /ropi is not supported when compiling C++. You can compile only the C subset of C++ with /ropi.

  • Some constructs that are legal C do not work when compiled for ‑‑apcs=/ropi or ‑‑apcs=/rwpi, for example:

    int i;               // rw
    int *p1 = &i;        // this static initialization does not work
                         // with ‑‑apcs=/rwpi ‑‑no_lower_rwpi
    
    extern const int ci; // ro
    const int *p2 = &ci; // this static initialization does not work
                         // with ‑‑apcs=/ropi
    

    However, to enable these static initializations to work, use the ‑‑lower_rwpi and ‑‑lower_ropi options.

    To compile this code, type:

    armcc ‑‑apcs=/rwpi/ropi ‑‑lower_ropi
    

    You do not have to specify ‑‑lower_rwpi, because this is the default.

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0375A