Skip to content

Commit

Permalink
add X86_64_GOTTPOFF relocation for errno
Browse files Browse the repository at this point in the history
Submitted by: Markus Pfeiffer <markus.pfeiffer@morphism.de> on cvs-ghc
  • Loading branch information
simonmar authored and Ian Lynagh committed Jan 12, 2013
1 parent 1eda0b7 commit 42729f4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions rts/Linker.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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:
{
Expand Down

0 comments on commit 42729f4

Please sign in to comment.