summaryrefslogtreecommitdiff
path: root/rts/Linker.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-08-20 15:13:45 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-08-21 09:59:05 +0100
commit106f0434144199276add8860c146c542cc67513b (patch)
treea25d37d7eea187ba585a5a69a3992ea748df3f27 /rts/Linker.c
parentcec899d9fb668d4adccf731a63902e5be49f0660 (diff)
downloadhaskell-106f0434144199276add8860c146c542cc67513b.tar.gz
add X86_64_GOTTPOFF relocation for errno
Submitted by: Markus Pfeiffer <markus.pfeiffer@morphism.de> on cvs-ghc
Diffstat (limited to 'rts/Linker.c')
-rw-r--r--rts/Linker.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 75b9c7c09d..6d86e2b1a7 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -133,6 +133,10 @@
#define ALWAYS_PIC
#endif
+#if defined(dragonfly_HOST_OS)
+#include <sys/tls.h>
+#endif
+
/* Hash table mapping symbol names to Symbol */
static /*Str*/HashTable *symhash;
@@ -5207,6 +5211,27 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC,
*(Elf64_Word *)P = (Elf64_Word)off;
break;
}
+#if defined(dragonfly_HOST_OS)
+ case R_X86_64_GOTTPOFF:
+ {
+#if defined(ALWAYS_PIC)
+ barf("R_X86_64_GOTTPOFF relocation, but ALWAYS_PIC.");
+#else
+ /* determine the offset of S to the current thread's tls
+ area
+ XXX: Move this to the beginning of function */
+ struct tls_info ti;
+ get_tls_area(0, &ti, sizeof(ti));
+ /* make entry in GOT that contains said offset */
+ StgInt64 gotEntry = (StgInt64) &makeSymbolExtra(oc, ELF_R_SYM(info),
+ (S - (Elf64_Addr)(ti.base)))->addr;
+ *(Elf64_Word *)P = gotEntry + A - P;
+#endif
+ break;
+ }
+#endif
+
+
case R_X86_64_PLT32:
{