You copied the Doc URL to your clipboard.

-frwpi, -fno-rwpi

Enables or disables the generation of Read-Write Position-Independent (RWPI) code.


When generating RWPI code, the compiler:

  • Addresses the writable data using offsets from the static base register sb. This means that:
    • The base address of the RW data region can be fixed at runtime.
    • Data can have multiple instances.
    • Data can be, but does not have to be, position-independent.
  • Sets the PI attribute on read/write output sections.


  • This option is independent from -fropi, meaning that these two options can be used individually or together.
  • When using -frwpi, -frwpi-lowering and -fropi-lowering are automatically enabled.


The following restrictions apply:

  • This option is not supported in AArch64 state.
  • This option is not compatible with -fpic, -fpie, or -fbare-metal-pie options.


The default is -fno-rwpi.