Discussion:
Question on ppc64 and --relax
Douglas B Rupp
2018-11-12 10:56:50 UTC
Permalink
Greetings,

I understand that ppc64 makes function calls through function
descriptors, but afaict these function descriptors are all output at the
beginning of the .text section so the range of a function call (without
resorting to -mlongcall) isn't substantially better than that found on
ppc32.

ppc32 has --relax which mostly alleviates the need for -mlongcall, which
we try to avoid due to the huge amount of code bloat it causes.

It seems that there might be a use for --relax on ppc64 as well, for the
same reason?

Or possibly I'm missing something here. Please throw me a hint when
convenient.

--Douglas Rupp
AdaCore
Alan Modra
2018-11-12 11:16:15 UTC
Permalink
Post by Douglas B Rupp
Greetings,
I understand that ppc64 makes function calls through function descriptors,
but afaict these function descriptors are all output at the beginning of the
.text section so the range of a function call (without resorting to
-mlongcall) isn't substantially better than that found on ppc32.
powerpc64 ELFv1 uses function descriptors, placed in the .opd section
which is near other relro sections. These are used when making calls
via the PLT and when taking the address of a function. They aren't
used when making a direct call.

powerpc64le ELFv2 doesn't use function descriptors.

GNU ld will add stubs between direct calls that don't reach, for both
ELFv1 and ELFv2. So will gold. This works provided you don't make
object file text sections too large (33M is the limit) either with
huge source files (where -ffunction-sections may help) or by mashing
together files with ld -r (in which case don't be so silly).
--
Alan Modra
Australia Development Lab, IBM
Loading...