diff options
author | Ulrich Weigand <Ulrich.Weigand@de.ibm.com> | 2013-12-04 06:52:40 -0600 |
---|---|---|
committer | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2013-12-04 07:41:38 -0600 |
commit | 122b66defdb9e4ded3ccc5c2b290f0520c6fa3cd (patch) | |
tree | ab5ac210d7a416d9b0bb5bef9338d89793f9bb5c /elf | |
parent | 696caf1d002ff059ddd20fd5eaccd76229c14850 (diff) | |
download | glibc-122b66defdb9e4ded3ccc5c2b290f0520c6fa3cd.zip glibc-122b66defdb9e4ded3ccc5c2b290f0520c6fa3cd.tar.gz glibc-122b66defdb9e4ded3ccc5c2b290f0520c6fa3cd.tar.bz2 |
PowerPC64 ELFv2 ABI 3/6: PLT local entry point optimization
This is a follow-on to the previous patch to support the ELFv2 ABI in the
dynamic loader, split off into its own patch since it is just an optional
optimization.
In the ELFv2 ABI, most functions define both a global and a local entry
point; the local entry requires r2 to be already set up by the caller
to point to the callee's TOC; while the global entry does not require
the caller to know about the callee's TOC, but it needs to set up r12
to the callee's entry point address.
Now, when setting up a PLT slot, the dynamic linker will usually need
to enter the target function's global entry point. However, if the
linker can prove that the target function is in the same DSO as the
PLT slot itself, and the whole DSO only uses a single TOC (which the
linker will let ld.so know via a DT_PPC64_OPT entry), then it is
possible to actually enter the local entry point address into the
PLT slot, for a slight improvement in performance.
Note that this uncovered a problem on the first call via _dl_runtime_resolve,
because that routine neglected to restore the caller's TOC before calling
the target function for the first time, since it assumed that function
would always reload its own TOC anyway ...
Diffstat (limited to 'elf')
-rw-r--r-- | elf/elf.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -2282,8 +2282,19 @@ typedef Elf32_Addr Elf32_Conflict; #define DT_PPC64_GLINK (DT_LOPROC + 0) #define DT_PPC64_OPD (DT_LOPROC + 1) #define DT_PPC64_OPDSZ (DT_LOPROC + 2) +#define DT_PPC64_OPT (DT_LOPROC + 3) #define DT_PPC64_NUM 3 +/* PowerPC64 specific values for the DT_PPC64_OPT Dyn entry. */ +#define PPC64_OPT_TLS 1 +#define PPC64_OPT_MULTI_TOC 2 + +/* PowerPC64 specific values for the Elf64_Sym st_other field. */ +#define STO_PPC64_LOCAL_BIT 5 +#define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT) +#define PPC64_LOCAL_ENTRY_OFFSET(other) \ + (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2) + /* ARM specific declarations */ |