Next: , Previous: -resident32, Up: Invocation


2.6 -msmall-code

By default, the code generated by the compiler references functions using 32-bit, absolute addressing.

Code generated by ‘GCC’ with the ‘-msmall-code’ option references symbols in the code section with 16 bit offsets, relative to the ‘PC’ (program counter). This makes executables smaller and faster. Unfortunately, the size of the code section is generally limited to 32 KB, so this option can only be used for relatively small programs.

Note: Actually, the compiler always generates 32-bit code references. If the assembler can calculate the offset between the referencing instruction and the referenced symbol (in other words, if the referenced symbol is in the same source file), it replaces the 32-bit reference with the ‘PC’-relative one. External references are left intact, unless ‘-msmall-code’ is used, in which case the assembler generates ‘PC’-relative references, and the exact offsets are calculated by the linker.

This option has no negative form.

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