[commit: ghc] master: Linker.c: add dso_handle to the symbol table (645eadb)

git at git.haskell.org git at git.haskell.org
Fri Oct 25 14:22:44 UTC 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/645eadb99493129a53021e31c43d3526eb59a496/ghc

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

commit 645eadb99493129a53021e31c43d3526eb59a496
Author: Takano Akio <aljee at hyper.cx>
Date:   Sun Jan 6 17:51:19 2013 +0900

    Linker.c: add dso_handle to the symbol table
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


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

645eadb99493129a53021e31c43d3526eb59a496
 rts/Linker.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/rts/Linker.c b/rts/Linker.c
index b918c8f..c52b0f9 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1594,6 +1594,13 @@ initLinker( void )
 #   if defined(OBJFORMAT_MACHO) && defined(powerpc_HOST_ARCH)
     machoInitSymbolsWithoutUnderscore();
 #   endif
+    /* GCC defines a special symbol __dso_handle which is resolved to NULL if
+       referenced from a statically linked module. We need to mimic this, but
+       we cannot use NULL because we use it to mean nonexistent symbols. So we
+       use an arbitrary (hopefully unique) address here.
+    */
+    ghciInsertSymbolTable(WSTR("(GHCi special symbols)"),
+        symhash, "__dso_handle", (void *)0x12345687, HS_BOOL_FALSE, NULL);
 
 #   if defined(OBJFORMAT_ELF) || defined(OBJFORMAT_MACHO)
 #   if defined(RTLD_DEFAULT)



More information about the ghc-commits mailing list