Description
Originally noted in #136096 (comment) when building libc
, PowerPC can emit the following linker warning:
warning: linker stderr: /usr/lib/gcc-cross/powerpc-linux-gnu/13/../../../../powerpc-linux-gnu/bin/ld: bss-plt forced due to /checkout/target/powerpc-unknown-linux-gnu/debug/deps/const_fn-5906628da0f5d31e.2bjw3mlsf69tu9e94ehzuvs4u.rcgu.o
I also noticed this previously in compiler_builtins
rust-lang/compiler-builtins#667.
https://sourceware.org/binutils/docs/ld/PowerPC-ELF32.html says the following:
--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.
It sounds like secure-plt
is the default but something about our object files forces a fallback to bss-plt
.