cast5-amd64: use 64-bit relocation with large PIC memory model
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Sat, 13 May 2017 15:35:30 +0000 (18:35 +0300)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Thu, 18 May 2017 17:09:45 +0000 (20:09 +0300)
* cipher/cast5-amd64.S [__code_model_large__]
(GET_EXTERN_POINTER): New.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
cipher/cast5-amd64.S

index 608fb64..c04015a 100644 (file)
 #if defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS) || !defined(__PIC__)
 #  define GET_EXTERN_POINTER(name, reg) movabsq $name, reg
 #else
-#  define GET_EXTERN_POINTER(name, reg) movq name@GOTPCREL(%rip), reg
+#  ifdef __code_model_large__
+#    define GET_EXTERN_POINTER(name, reg) \
+              pushq %r15; \
+              pushq %r14; \
+           1: leaq 1b(%rip), reg; \
+              movabsq $_GLOBAL_OFFSET_TABLE_-1b, %r14; \
+              movabsq $name@GOT, %r15; \
+              addq %r14, reg; \
+              popq %r14; \
+              movq (reg, %r15), reg; \
+              popq %r15;
+#  else
+#    define GET_EXTERN_POINTER(name, reg) movq name@GOTPCREL(%rip), reg
+#  endif
 #endif
 
 #ifdef HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS