[commit: ghc] master: Slighly clean up symbol loading error. (f41c27d)
git at git.haskell.org
git at git.haskell.org
Mon Jan 30 19:03:09 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f41c27d3ffdddbb1afe07de1bd25205061194c93/ghc
>---------------------------------------------------------------
commit f41c27d3ffdddbb1afe07de1bd25205061194c93
Author: Tamar Christina <tamar at zhox.com>
Date: Mon Jan 30 11:58:19 2017 -0500
Slighly clean up symbol loading error.
The symbol not found error that is triggered
during lazy-loading was a bit chaotic before.
This reformats it a bit to:
```
ghc-stage2.exe: | E:\...\libLLVMSupport.a: unknown symbol `_ZN4llvm5APIntC1Ejyb'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm5APInt14AssignSlowCaseERKS0_'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm13ConstantRangeC1ENS_5APIntES1_'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm14FoldingSetImplC2Ej'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZN4llvm15LLVMContextImplD1Ev'
ghc-stage2.exe: | E:\...\libLLVMLTO.a: unknown symbol `_ZN4llvm11LLVMContextD1Ev'
ghc-stage2.exe: | E:\...\libLLVMCore.a: unknown symbol `_ZNK4llvm5Value10getContextEv'
ghc-stage2.exe: ^^ Could not load 'LLVMIsMultithreaded', dependency unresolved.
See top entry above.
```
I have also thought about also showing the demangled names, as it may
be useful for the end user.
`libgcc` seems to provide a method for this so we wouldn't need any
extra dependency.
Any thoughts on this or would it not be useful?
Reviewers: austin, erikd, simonmar, bgamari
Reviewed By: bgamari
Subscribers: RyanGlScott, thomie, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D3027
GHC Trac Issues: #13093, #13113
>---------------------------------------------------------------
f41c27d3ffdddbb1afe07de1bd25205061194c93
rts/Linker.c | 7 +++++--
rts/linker/PEi386.c | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/rts/Linker.c b/rts/Linker.c
index 9462bdb..8945a96 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -870,12 +870,11 @@ SymbolAddr* loadSymbol(SymbolName *lbl, RtsSymbolInfo *pinfo) {
/* Symbol can be found during linking, but hasn't been relocated. Do so now.
See Note [runtime-linker-phases] */
- if (oc && oc->status == OBJECT_LOADED) {
+ if (oc && lbl && oc->status == OBJECT_LOADED) {
oc->status = OBJECT_NEEDED;
IF_DEBUG(linker, debugBelch("lookupSymbol: on-demand loading symbol '%s'\n", lbl));
int r = ocTryLoad(oc);
if (!r) {
- errorBelch("Could not on-demand load symbol '%s'\n", lbl);
return NULL;
}
@@ -893,6 +892,10 @@ SymbolAddr* lookupSymbol( SymbolName* lbl )
{
ACQUIRE_LOCK(&linker_mutex);
SymbolAddr* r = lookupSymbol_(lbl);
+ if (!r) {
+ errorBelch("^^ Could not load '%s', dependency unresolved. See top entry above.\n", lbl);
+ fflush(stderr);
+ }
RELEASE_LOCK(&linker_mutex);
return r;
}
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index 824c821..f29bb8b 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -1326,7 +1326,7 @@ ocResolve_PEi386 ( ObjectCode* oc )
S = (size_t) lookupSymbol_( (char*)symbol );
if ((void*)S == NULL) {
- errorBelch("%" PATH_FMT ": unknown symbol `%s'\n", oc->fileName, symbol);
+ errorBelch(" | %" PATH_FMT ": unknown symbol `%s'", oc->fileName, symbol);
return false;
}
}
More information about the ghc-commits
mailing list