PowerPC ELF32 - Untitled
Description: Untitled

Next: PowerPC64 ELF64, Previous: MSP430, Up: Machine Dependent

### 4.9 `ld` and PowerPC 32-bit ELF Support

Branches on PowerPC processors are limited to a signed 26-bit displacement, which may result in `ld` giving ‘`relocation truncated to fit`’ errors with very large programs. ‘`--relax`’ enables the generation of trampolines that can access the entire 32-bit address space. These trampolines are inserted at section boundaries, so may not themselves be reachable if an input section exceeds 33M in size. You may combine ‘`-r`’ and ‘`--relax`’ to add trampolines in a partial link. In that case both branches to undefined symbols and inter-section branches are also considered potentially out of range, and trampolines inserted.

`--bss-plt`
  Current PowerPC GCC accepts a ‘`-msecure-plt`’ option that generates code capable of using a newer PLT and GOT layout that has the security advantage of no executable section ever needing to be writable and no writable section ever being executable. PowerPC `ld` will generate this layout, including stubs to access the PLT, if all input files (including startup and static libraries) were compiled with ‘`-msecure-plt`’. ‘`--bss-plt`’ forces the old BSS PLT (and GOT layout) which can give slightly better performance.

`--secure-plt`
  `ld` will use the new PLT and GOT layout if it is linking new ‘`-fpic`’ or ‘`-fPIC`’ code, but does not do so automatically when linking non-PIC code. This option requests the new PLT and GOT layout. A warning will be given if some object file requires the old style BSS PLT.

`--sdata-got`
  The new secure PLT and GOT are placed differently relative to other sections compared to older BSS PLT and GOT placement. The location of `.plt` must change because the new secure PLT is an initialized section while the old PLT is uninitialized. The reason for the `.got` change is more subtle: The new placement allows `.got` to be read-only in applications linked with ‘`-z relro -z now`’. However, this placement means that `.sdata` cannot always be used in shared libraries, because the PowerPC ABI accesses `.sdata` in shared libraries from the GOT pointer. ‘`--sdata-got`’ forces the old GOT placement. PowerPC GCC doesn't use `.sdata` in shared libraries, so this option is really only useful for other compilers that may do so.

`--emit-stub-syms`
  This option causes `ld` to label linker stubs with a local symbol that encodes the stub type and destination.

`--no-tls-optimize`
  PowerPC `ld` normally performs some optimization of code sequences used to access Thread-Local Storage. Use this option to disable the optimization.