changeset 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 ce45e1dd4b09
children 299f2d85d27d
files common.h libpostproc/mangle.h
diffstat 2 files changed, 20 insertions(+), 2 deletions(-) [+]
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 */
--- a/libpostproc/mangle.h	Tue Dec 14 20:17:23 2004 +0000
+++ b/libpostproc/mangle.h	Sat Dec 18 03:07:15 2004 +0000
@@ -8,12 +8,21 @@
 #define __MANGLE_H
 
 /* Feel free to add more to the list, eg. a.out IMO */
+/* Use rip-relative addressing if compiling PIC code on x86-64. */
 #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__OS2__) || \
    (defined(__OpenBSD__) && !defined(__ELF__))
+#if defined(ARCH_X86_64) && defined(PIC)
+#define MANGLE(a) "_" #a"(%%rip)"
+#else
 #define MANGLE(a) "_" #a
+#endif
+#else
+#if defined(ARCH_X86_64) && defined(PIC)
+#define MANGLE(a) #a"(%%rip)"
 #else
 #define MANGLE(a) #a
 #endif
+#endif
 
 #endif /* !__MANGLE_H */