]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.arch/s390-17-perf-09-module-plt.patch
Imported linux-2.6.27.39 suse/xen patches.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / s390-17-perf-09-module-plt.patch
1 From: Gerald Schaefer <geraldsc@de.ibm.com>
2 Subject: [S390] module function call optimization
3 References: bnc#532063,LTC#55526
4
5 commit 504665a91498f43d220b7d0942281067283a35f7
6 Author: Martin Schwidefsky <schwidefsky@de.ibm.com>
7 Date: Thu Mar 26 15:24:36 2009 +0100
8
9 [S390] module function call optimization
10
11 Avoid the detour over the PLT if the branch target of a function call
12 in a module is in the range of the bras (16-bit) or brasl (32-bit)
13 instruction. The PLT is still generated but it is unused.
14
15 Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
16
17 Acked-by: John Jolly <jjolly@suse.de>
18
19 diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
20 index 59b4e79..eed4a00 100644
21 --- a/arch/s390/kernel/module.c
22 +++ b/arch/s390/kernel/module.c
23 @@ -310,15 +310,20 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
24 info->plt_initialized = 1;
25 }
26 if (r_type == R_390_PLTOFF16 ||
27 - r_type == R_390_PLTOFF32
28 - || r_type == R_390_PLTOFF64
29 - )
30 + r_type == R_390_PLTOFF32 ||
31 + r_type == R_390_PLTOFF64)
32 val = me->arch.plt_offset - me->arch.got_offset +
33 info->plt_offset + rela->r_addend;
34 - else
35 - val = (Elf_Addr) me->module_core +
36 - me->arch.plt_offset + info->plt_offset +
37 - rela->r_addend - loc;
38 + else {
39 + if (!((r_type == R_390_PLT16DBL &&
40 + val - loc + 0xffffUL < 0x1ffffeUL) ||
41 + (r_type == R_390_PLT32DBL &&
42 + val - loc + 0xffffffffULL < 0x1fffffffeULL)))
43 + val = (Elf_Addr) me->module_core +
44 + me->arch.plt_offset +
45 + info->plt_offset;
46 + val += rela->r_addend - loc;
47 + }
48 if (r_type == R_390_PLT16DBL)
49 *(unsigned short *) loc = val >> 1;
50 else if (r_type == R_390_PLTOFF16)