diff common.h @ 2391:336a239ad9a4 libavcodec

fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
author michael
date Sat, 18 Dec 2004 03:07:15 +0000
parents 26560d4fdb1f
children 582e635cfa08
line wrap: on
line diff
--- a/common.h	Tue Dec 14 20:17:23 2004 +0000
+++ b/common.h	Sat Dec 18 03:07:15 2004 +0000
@@ -224,11 +224,20 @@
 
 #    include "bswap.h"
 
+// Use rip-relative addressing if compiling PIC code on x86-64.
 #    if defined(__MINGW32__) || defined(__CYGWIN__) || \
         defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__))
-#        define MANGLE(a) "_" #a
+#        if defined(ARCH_X86_64) && defined(PIC)
+#            define MANGLE(a) "_" #a"(%%rip)"
+#        else
+#            define MANGLE(a) "_" #a
+#        endif
 #    else
-#        define MANGLE(a) #a
+#        if defined(ARCH_X86_64) && defined(PIC)
+#            define MANGLE(a) #a"(%%rip)"
+#        else
+#            define MANGLE(a) #a
+#        endif
 #    endif
 
 /* debug stuff */