[commit: ghc] ghc-7.6: add X86_64_GOTTPOFF relocation for errno (42729f4)

Ian Lynagh igloo at earth.li
Sat Jan 12 17:00:49 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : ghc-7.6

http://hackage.haskell.org/trac/ghc/changeset/42729f43823193fe727274ae26f29fdfd9e1f169

>---------------------------------------------------------------

commit 42729f43823193fe727274ae26f29fdfd9e1f169
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Mon Aug 20 15:13:45 2012 +0100

    add X86_64_GOTTPOFF relocation for errno
    
    Submitted by: Markus Pfeiffer <markus.pfeiffer at morphism.de> on cvs-ghc

>---------------------------------------------------------------

 rts/Linker.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/rts/Linker.c b/rts/Linker.c
index a2a3b3b..56003fb 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -132,6 +132,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;
 
@@ -5202,6 +5206,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:
       {





More information about the ghc-commits mailing list