aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rng-tools/fix-textrels-on-PIC-x86.patch
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2015-07-20 08:11:47 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2015-07-20 08:11:47 +0000
commitfd05d0a99d425b1751c30e7e6878c76fcc2b9b36 (patch)
tree1cc0fff31f5e4c81d180c91fd50ee6149077a198 /testing/rng-tools/fix-textrels-on-PIC-x86.patch
parent6ea7e80c22ba9311574b16c0d0c241ba6ecd021b (diff)
downloadaports-fd05d0a99d425b1751c30e7e6878c76fcc2b9b36.tar.bz2
aports-fd05d0a99d425b1751c30e7e6878c76fcc2b9b36.tar.xz
testing/rng-tools: patch textrels
Diffstat (limited to 'testing/rng-tools/fix-textrels-on-PIC-x86.patch')
-rw-r--r--testing/rng-tools/fix-textrels-on-PIC-x86.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/rng-tools/fix-textrels-on-PIC-x86.patch b/testing/rng-tools/fix-textrels-on-PIC-x86.patch
new file mode 100644
index 0000000000..88d0a7f905
--- /dev/null
+++ b/testing/rng-tools/fix-textrels-on-PIC-x86.patch
@@ -0,0 +1,50 @@
+--- rng-tools/rdrand_asm.S
++++ rng-tools/rdrand_asm.S
+@@ -49,6 +49,7 @@
+ ret
+ ENDPROC(x86_rdrand_nlong)
+
++#define INIT_PIC()
+ #define SETPTR(var,ptr) leaq var(%rip),ptr
+ #define PTR0 %rdi
+ #define PTR1 %rsi
+@@ -84,7 +85,16 @@
+ ret
+ ENDPROC(x86_rdrand_nlong)
+
++#if defined(__PIC__)
++#undef __i686 /* gcc builtin define gets in our way */
++#define INIT_PIC() \
++ call __i686.get_pc_thunk.bx ; \
++ addl $_GLOBAL_OFFSET_TABLE_, %ebx
++#define SETPTR(var,ptr) leal (var)@GOTOFF(%ebx),ptr
++#else
++#define INIT_PIC()
+ #define SETPTR(var,ptr) movl $(var),ptr
++#endif
+ #define PTR0 %eax
+ #define PTR1 %edx
+ #define PTR2 %ecx
+@@ -101,6 +111,7 @@
+ movl 8(%ebp), %eax
+ movl 12(%ebp), %edx
+ #endif
++ INIT_PIC()
+
+ SETPTR(aes_round_keys, PTR2)
+
+@@ -166,6 +177,17 @@
+ #endif
+ ret
+ ENDPROC(x86_aes_mangle)
++
++#if defined(__i386__) && defined(__PIC__)
++ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
++.globl __i686.get_pc_thunk.bx
++ .hidden __i686.get_pc_thunk.bx
++ .type __i686.get_pc_thunk.bx,@function
++__i686.get_pc_thunk.bx:
++ movl (%esp), %ebx
++ ret
++#endif
++