summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch')
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch114
1 files changed, 0 insertions, 114 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
deleted file mode 100644
index 614adab27f..0000000000
--- a/meta/recipes-support/rng-tools/rng-tools/rng-tools-5-fix-textrels-on-PIC-x86.patch
+++ /dev/null
@@ -1,114 +0,0 @@
1From d8b1bb8edd99b2898720b4f10d292a67d532db48 Mon Sep 17 00:00:00 2001
2From: "Francisco Blas Izquierdo Riera (klondike)" <klondike@gentoo.org>
3Date: Mon, 22 Oct 2018 15:29:36 +0800
4Subject: [PATCH 4/4] Fix assemby textrels on rdrand_asm.S on PIC x86
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9This patch updates the fixes in the assembly in rdrand_asm.S in
10sys-apps/rng-tools-5 so it won't generate textrels on PIC systems.
11The main fixes are in the use of leal in SETPTR for such systems, the rest is
12the usual PIC support stuff.
13
14This should fix Gentoo bug #469962 and help fix #518210
15
16This patch is released under the GPLv2 or a higher version license as is the
17original file as long as the author and the tester are credited.
18
19Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=469962
20Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=518210
21Signed-off-by: Francisco Blas Izquierdo Riera (klondike) <klondike@gentoo.org>
22Reported-by: cilly <cilly@cilly.mine.nu>
23Reported-by: Manuel RĂ¼ger <mrueg@gentoo.org>
24Tested-by: Anthony Basile <blueness@gentoo.org>
25
26Upstream-Status: Pending
27---
28 rdrand_asm.S | 27 +++++++++++++++++++++++++++
29 1 file changed, 27 insertions(+)
30
31diff --git a/rdrand_asm.S b/rdrand_asm.S
32index b5d260a..7811cf2 100644
33--- a/rdrand_asm.S
34+++ b/rdrand_asm.S
35@@ -2,6 +2,7 @@
36 * Copyright (c) 2011-2014, Intel Corporation
37 * Authors: Fenghua Yu <fenghua.yu@intel.com>,
38 * H. Peter Anvin <hpa@linux.intel.com>
39+ * PIC code by: Francisco Blas Izquierdo Riera (klondike) <klondike@gentoo.org>
40 *
41 * This program is free software; you can redistribute it and/or modify it
42 * under the terms and conditions of the GNU General Public License,
43@@ -172,7 +173,19 @@ ENTRY(x86_rdseed_or_rdrand_bytes)
44 jmp 4b
45 ENDPROC(x86_rdseed_or_rdrand_bytes)
46
47+#if defined(__PIC__)
48+#define INIT_PIC() \
49+ pushl %ebx ; \
50+ call __x86.get_pc_thunk.bx ; \
51+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
52+#define END_PIC() \
53+ popl %ebx
54+#define SETPTR(var,ptr) leal (var)@GOTOFF(%ebx),ptr
55+#else
56+#define INIT_PIC()
57+#define END_PIC()
58 #define SETPTR(var,ptr) movl $(var),ptr
59+#endif
60 #define PTR0 %eax
61 #define PTR1 %edx
62 #define PTR2 %ecx
63@@ -188,6 +201,7 @@ ENTRY(x86_aes_mangle)
64 movl 8(%ebp), %eax
65 movl 12(%ebp), %edx
66 push %esi
67+ INIT_PIC()
68 #endif
69 movl $512, CTR3 /* Number of rounds */
70
71@@ -278,6 +292,7 @@ offset = offset + 16
72 movdqa %xmm7, (7*16)(PTR1)
73
74 #ifdef __i386__
75+ END_PIC()
76 pop %esi
77 pop %ebp
78 #endif
79@@ -292,6 +307,7 @@ ENTRY(x86_aes_expand_key)
80 push %ebp
81 mov %esp, %ebp
82 movl 8(%ebp), %eax
83+ INIT_PIC()
84 #endif
85
86 SETPTR(aes_round_keys, PTR1)
87@@ -321,6 +337,7 @@ ENTRY(x86_aes_expand_key)
88 call 1f
89
90 #ifdef __i386__
91+ END_PIC()
92 pop %ebp
93 #endif
94 ret
95@@ -341,6 +358,16 @@ ENTRY(x86_aes_expand_key)
96
97 ENDPROC(x86_aes_expand_key)
98
99+#if defined(__i386__) && defined(__PIC__)
100+ .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
101+ .globl __x86.get_pc_thunk.bx
102+ .hidden __x86.get_pc_thunk.bx
103+ .type __x86.get_pc_thunk.bx, @function
104+__x86.get_pc_thunk.bx:
105+ movl (%esp), %ebx
106+ ret
107+#endif
108+
109 .bss
110 .balign 64
111 aes_round_keys:
112--
1132.7.4
114