Commit 504665a9 authored by Martin Schwidefsky's avatar Martin Schwidefsky

[S390] module function call optimization

Avoid the detour over the PLT if the branch target of a function call
in a module is in the range of the bras (16-bit) or brasl (32-bit)
instruction. The PLT is still generated but it is unused.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent e13ed9b2
...@@ -310,15 +310,20 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, ...@@ -310,15 +310,20 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
info->plt_initialized = 1; info->plt_initialized = 1;
} }
if (r_type == R_390_PLTOFF16 || if (r_type == R_390_PLTOFF16 ||
r_type == R_390_PLTOFF32 r_type == R_390_PLTOFF32 ||
|| r_type == R_390_PLTOFF64 r_type == R_390_PLTOFF64)
)
val = me->arch.plt_offset - me->arch.got_offset + val = me->arch.plt_offset - me->arch.got_offset +
info->plt_offset + rela->r_addend; info->plt_offset + rela->r_addend;
else else {
val = (Elf_Addr) me->module_core + if (!((r_type == R_390_PLT16DBL &&
me->arch.plt_offset + info->plt_offset + val - loc + 0xffffUL < 0x1ffffeUL) ||
rela->r_addend - loc; (r_type == R_390_PLT32DBL &&
val - loc + 0xffffffffULL < 0x1fffffffeULL)))
val = (Elf_Addr) me->module_core +
me->arch.plt_offset +
info->plt_offset;
val += rela->r_addend - loc;
}
if (r_type == R_390_PLT16DBL) if (r_type == R_390_PLT16DBL)
*(unsigned short *) loc = val >> 1; *(unsigned short *) loc = val >> 1;
else if (r_type == R_390_PLTOFF16) else if (r_type == R_390_PLTOFF16)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment