aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorDrew Hess <dhess@ilm.com>2004-12-18 03:07:15 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-12-18 03:07:15 +0000
commita2c3bf82a79342bf43943cda5f2661f6433d8081 (patch)
tree2aa79dcf06f8baf63e6f03462196770bc9ac7970 /libavcodec
parentcaacd4deeafacdebf14515672cea9cb21c73f8a9 (diff)
downloadffmpeg-a2c3bf82a79342bf43943cda5f2661f6433d8081.tar.gz
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
Originally committed as revision 3757 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/common.h13
-rw-r--r--libavcodec/libpostproc/mangle.h9
2 files changed, 20 insertions, 2 deletions
diff --git a/libavcodec/common.h b/libavcodec/common.h
index fba2306396..619719a6f3 100644
--- a/libavcodec/common.h
+++ b/libavcodec/common.h
@@ -224,11 +224,20 @@ static inline float floorf(float f) {
# 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 */
diff --git a/libavcodec/libpostproc/mangle.h b/libavcodec/libpostproc/mangle.h
index f3894cc332..aa09cd6bf7 100644
--- a/libavcodec/libpostproc/mangle.h
+++ b/libavcodec/libpostproc/mangle.h
@@ -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 */