# HG changeset patch # User michael # Date 1103339235 0 # Node ID 336a239ad9a4ef92f937fd7e6f9103fb185608c4 # Parent ce45e1dd4b094ac4fcb63ac89b035d2e275c71f4 fixes for PIC code on x86-64 patch by (Drew Hess ) diff -r ce45e1dd4b09 -r 336a239ad9a4 common.h --- 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 */ diff -r ce45e1dd4b09 -r 336a239ad9a4 libpostproc/mangle.h --- 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 */