Next: , Previous: -noixemul, Up: Invocation

2.2 -fbaserel

By default, the code generated by ‘GCC’ references data using 32-bit, absolute addressing.

The ‘-fbaserel’ option will make ‘GCC’ generate code that references data with 16 bit offsets relative to the ‘a4’ address register. This makes executables smaller and faster. Unfortunately, the size of the data section cannot exceed 64 KB, so this option cannot be used for large programs, like ‘GCC’ itself.

Note: For a base-relative executable, ‘-fbaserel’ needs to be specified for compiling and linking. Base-relative programs require special startup code and special versions of linker libraries. Since not all linker libraries are available in both plain and base relative versions, the usefulness of this option is limited. It is important to note that when the base-relative library is missing, the linker will attempt to use the plain one. This might result in strange link-time or even run-time errors.

This option is the AmigaOS equivalent of the standard ‘GCC’ option ‘-fpic’, which is not supported by the AmigaOS port. ‘-fpic’ generates code that references data indirectly, through a global offset table. The special addressing modes available on the ‘m68k’ processor family allow for a much more efficient implementation with ‘-fbaserel’.

The negative form of ‘-fbaserel’ is ‘-fno-baserel’, and is on by default.

For more information, please refer to the ‘LibNIX’ documentation.