diff options
Diffstat (limited to 'meta/recipes-support/rng-tools')
-rw-r--r-- | meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch | 104 | ||||
-rw-r--r-- | meta/recipes-support/rng-tools/rng-tools_5.bb | 1 |
2 files changed, 105 insertions, 0 deletions
diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch b/meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch new file mode 100644 index 0000000000..90c9d8c515 --- /dev/null +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch | |||
@@ -0,0 +1,104 @@ | |||
1 | From: Francisco Blas Izquierdo Riera (klondike) <klondike@gentoo.org> | ||
2 | Subject: [PATCH] Fix assemby textrels on rdrand_asm.S on PIC x86 | ||
3 | |||
4 | This patch updates the fixes in the assembly in rdrand_asm.S in | ||
5 | sys-apps/rng-tools-5 so it won't generate textrels on PIC systems. | ||
6 | The main fixes are in the use of leal in SETPTR for such systems, the rest is | ||
7 | the usual PIC support stuff. | ||
8 | |||
9 | This should fix Gentoo bug #469962 and help fix #518210 | ||
10 | |||
11 | This patch is released under the GPLv2 or a higher version license as is the | ||
12 | original file as long as the author and the tester are credited. | ||
13 | |||
14 | Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=469962 | ||
15 | Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=518210 | ||
16 | Upstream-status: Not sent yet | ||
17 | Signed-off-by: Francisco Blas Izquierdo Riera (klondike) <klondike@gentoo.org> | ||
18 | Reported-by: cilly <cilly@cilly.mine.nu> | ||
19 | Reported-by: Manuel RĂ¼ger <mrueg@gentoo.org> | ||
20 | Tested-by: Anthony Basile <blueness@gentoo.org> | ||
21 | |||
22 | Upstream-Status: Pending | ||
23 | |||
24 | Index: rng-tools-5/rdrand_asm.S | ||
25 | =================================================================== | ||
26 | --- rng-tools-5.orig/rdrand_asm.S | ||
27 | +++ rng-tools-5/rdrand_asm.S | ||
28 | @@ -2,6 +2,7 @@ | ||
29 | * Copyright (c) 2011-2014, Intel Corporation | ||
30 | * Authors: Fenghua Yu <fenghua.yu@intel.com>, | ||
31 | * H. Peter Anvin <hpa@linux.intel.com> | ||
32 | + * PIC code by: Francisco Blas Izquierdo Riera (klondike) <klondike@gentoo.org> | ||
33 | * | ||
34 | * This program is free software; you can redistribute it and/or modify it | ||
35 | * under the terms and conditions of the GNU General Public License, | ||
36 | @@ -174,7 +175,19 @@ ENTRY(x86_rdseed_or_rdrand_bytes) | ||
37 | jmp 4b | ||
38 | ENDPROC(x86_rdseed_or_rdrand_bytes) | ||
39 | |||
40 | +#if defined(__PIC__) | ||
41 | +#define INIT_PIC() \ | ||
42 | + pushl %ebx ; \ | ||
43 | + call __x86.get_pc_thunk.bx ; \ | ||
44 | + addl $_GLOBAL_OFFSET_TABLE_, %ebx | ||
45 | +#define END_PIC() \ | ||
46 | + popl %ebx | ||
47 | +#define SETPTR(var,ptr) leal (var)@GOTOFF(%ebx),ptr | ||
48 | +#else | ||
49 | +#define INIT_PIC() | ||
50 | +#define END_PIC() | ||
51 | #define SETPTR(var,ptr) movl $(var),ptr | ||
52 | +#endif | ||
53 | #define PTR0 %eax | ||
54 | #define PTR1 %edx | ||
55 | #define PTR2 %ecx | ||
56 | @@ -190,6 +203,7 @@ ENTRY(x86_aes_mangle) | ||
57 | movl 8(%ebp), %eax | ||
58 | movl 12(%ebp), %edx | ||
59 | push %esi | ||
60 | + INIT_PIC() | ||
61 | #endif | ||
62 | movl $512, CTR3 /* Number of rounds */ | ||
63 | |||
64 | @@ -280,6 +294,7 @@ offset = offset + 16 | ||
65 | movdqa %xmm7, (7*16)(PTR1) | ||
66 | |||
67 | #ifdef __i386__ | ||
68 | + END_PIC() | ||
69 | pop %esi | ||
70 | pop %ebp | ||
71 | #endif | ||
72 | @@ -294,6 +309,7 @@ ENTRY(x86_aes_expand_key) | ||
73 | push %ebp | ||
74 | mov %esp, %ebp | ||
75 | movl 8(%ebp), %eax | ||
76 | + INIT_PIC() | ||
77 | #endif | ||
78 | |||
79 | SETPTR(aes_round_keys, PTR1) | ||
80 | @@ -323,6 +339,7 @@ ENTRY(x86_aes_expand_key) | ||
81 | call 1f | ||
82 | |||
83 | #ifdef __i386__ | ||
84 | + END_PIC() | ||
85 | pop %ebp | ||
86 | #endif | ||
87 | ret | ||
88 | @@ -343,6 +360,16 @@ ENTRY(x86_aes_expand_key) | ||
89 | |||
90 | ENDPROC(x86_aes_expand_key) | ||
91 | |||
92 | +#if defined(__i386__) && defined(__PIC__) | ||
93 | + .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat | ||
94 | + .globl __x86.get_pc_thunk.bx | ||
95 | + .hidden __x86.get_pc_thunk.bx | ||
96 | + .type __x86.get_pc_thunk.bx, @function | ||
97 | +__x86.get_pc_thunk.bx: | ||
98 | + movl (%esp), %ebx | ||
99 | + ret | ||
100 | +#endif | ||
101 | + | ||
102 | .bss | ||
103 | .balign 64 | ||
104 | aes_round_keys: | ||
diff --git a/meta/recipes-support/rng-tools/rng-tools_5.bb b/meta/recipes-support/rng-tools/rng-tools_5.bb index 9329e8ad31..e2acaba91a 100644 --- a/meta/recipes-support/rng-tools/rng-tools_5.bb +++ b/meta/recipes-support/rng-tools/rng-tools_5.bb | |||
@@ -7,6 +7,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/gkernel/${BP}.tar.gz \ | |||
7 | file://0002-Add-argument-to-control-the-libargp-dependency.patch \ | 7 | file://0002-Add-argument-to-control-the-libargp-dependency.patch \ |
8 | file://underquote.patch \ | 8 | file://underquote.patch \ |
9 | file://uclibc-libuargp-configure.patch \ | 9 | file://uclibc-libuargp-configure.patch \ |
10 | file://rng-tools-5-fix-textrels-on-PIC-x86.patch \ | ||
10 | file://init \ | 11 | file://init \ |
11 | file://default" | 12 | file://default" |
12 | 13 | ||