diff options
author | Tamar Christina <tamar@zhox.com> | 2018-12-04 00:29:08 +0000 |
---|---|---|
committer | Tamar Christina <tamar@zhox.com> | 2018-12-04 07:15:26 +0000 |
commit | a8b7cef4d45a5003bf7584e06912f0f632116c71 (patch) | |
tree | 545d2e40786f0fc83186fd4d8d8f5fe396d13458 /rts/LinkerInternals.h | |
parent | 924026e0405396a3f559f163e829b88f30cca49e (diff) | |
download | haskell-a8b7cef4d45a5003bf7584e06912f0f632116c71.tar.gz |
linker: store entire link map and use it.
Summary:
This fixes a corner case in which we have seen the symbol multiple times in
different static libraries, but due to a depencency we end up loading the
symbol from a library other than the first one.
Previously the runtime linker would only track symbols from the first
library and did not store the full link map. In this case it was unable
to find the address for the symbols in the second library during delay
loading.
This change stores the address of all symbols seen so a full link map
is generated, such that when we make a different decision later than what
was expected we're able to still correctly load the library.
Test Plan: ./validate, new testcase T15894
Reviewers: angerman, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, carter
GHC Trac Issues: #15894
Differential Revision: https://phabricator.haskell.org/D5353
Diffstat (limited to 'rts/LinkerInternals.h')
-rw-r--r-- | rts/LinkerInternals.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 04d873ca99..e284cd6a56 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -20,6 +20,14 @@ typedef void SymbolAddr; typedef char SymbolName; +/* Hold extended information about a symbol in case we need to resolve it at a + late stage. */ +typedef struct _Symbol +{ + SymbolName *name; + SymbolAddr *addr; +} Symbol_t; + /* Indication of section kinds for loaded objects. Needed by the GC for deciding whether or not a pointer on the stack is a code pointer. @@ -148,7 +156,7 @@ typedef struct _ObjectCode { this object into the global symbol hash table. This is so that we know which parts of the latter mapping to nuke when this object is removed from the system. */ - char** symbols; + Symbol_t *symbols; int n_symbols; /* ptr to mem containing the object file image */ |