diff options
author | Tamar Christina <tamar@zhox.com> | 2016-02-02 12:36:52 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-02-02 12:36:53 +0100 |
commit | 01c587c03764de52cd01a3464c1a4a5c5bce7c00 (patch) | |
tree | c592de209b723fca3b1e63a7ab3ba883f1fb2031 /rts | |
parent | c996db5b1802ebeb93420785127f7fd55b7ec0c0 (diff) | |
download | haskell-01c587c03764de52cd01a3464c1a4a5c5bce7c00.tar.gz |
Fix Windows build after D1874
Windows uses wchar_t* for paths. The code committed won't compile for
Windows as the types are incorrect and the types in the branches of the
ternary operator aren't consistent.
Test Plan: ./validate --fast
Reviewers: austin, rwbarton, erikd, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1878
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Linker.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/rts/Linker.c b/rts/Linker.c index c225ab621c..c7c61cf354 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -199,6 +199,21 @@ static pathchar* pathdup(pathchar *path) return ret; } +static pathchar* mkPath(char* path) +{ +#if defined(mingw32_HOST_OS) + size_t required = mbstowcs(NULL, path, 0); + pathchar *ret = stgMallocBytes(sizeof(pathchar) * (required + 1), "mkPath"); + if (mbstowcs(ret, path, required) == (size_t)-1) + { + barf("mkPath failed converting char* to wchar_t*"); + } + + return ret; +#else + return pathdup(path); +#endif +} #if defined(OBJFORMAT_ELF) static int ocVerifyImage_ELF ( ObjectCode* oc ); @@ -425,6 +440,7 @@ static int ghciInsertSymbolTable( pinfo->weak = HS_BOOL_FALSE; return 1; } + pathchar* archiveName = NULL; debugBelch( "GHC runtime linker: fatal error: I found a duplicate definition for symbol\n" " %s\n" @@ -439,10 +455,16 @@ static int ghciInsertSymbolTable( " loaded twice.\n", (char*)key, obj_name, - pinfo->owner == NULL ? "(GHCi built-in symbols)" : - pinfo->owner->archiveMemberName ? pinfo->owner->archiveMemberName + pinfo->owner == NULL ? WSTR("(GHCi built-in symbols)") : + pinfo->owner->archiveMemberName ? archiveName = mkPath(pinfo->owner->archiveMemberName) : pinfo->owner->fileName ); + + if (archiveName) + { + stgFree(archiveName); + archiveName = NULL; + } return 0; } |