From 6ded427651aba8c89f899e7346c9db82880cd8a3 Mon Sep 17 00:00:00 2001 From: Clemens Fruhwirth Date: Thu, 28 Jun 2007 10:58:31 +0000 Subject: [PATCH] Change package name mangling when linking against DSOs --- compiler/main/Packages.lhs | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs index 078b84c..2283026 100644 --- a/compiler/main/Packages.lhs +++ b/compiler/main/Packages.lhs @@ -588,26 +588,17 @@ getPackageLinkOpts dflags pkgs = do let tag = buildTag dflags rts_tag = rtsBuildTag dflags let - imp = if opt_Static then "" else "_dyn" - libs p = map ((++imp) . addSuffix) (hsLibraries p) - ++ hACK_dyn (extraLibraries p) + mkDynName | opt_Static = id + | otherwise = (++ ("-ghc" ++ cProjectVersion)) + libs p = map (mkDynName . addSuffix) (hsLibraries p) + ++ extraLibraries p all_opts p = map ("-l" ++) (libs p) ++ ldOptions p - suffix = if null tag then "" else '_':tag - rts_suffix = if null rts_tag then "" else '_':rts_tag + addSuffix rts@"HSrts" = rts ++ (expandTag rts_tag) + addSuffix other_lib = other_lib ++ (expandTag tag) - addSuffix rts@"HSrts" = rts ++ rts_suffix - addSuffix other_lib = other_lib ++ suffix - - -- This is a hack that's even more horrible (and hopefully more temporary) - -- than the one below [referring to previous splittage of HSbase into chunks - -- to work around GNU ld bug]. HSbase_cbits and friends require the _dyn suffix - -- for dynamic linking, but not _p or other 'way' suffix. So we just add - -- _dyn to extraLibraries if they already have a _cbits suffix. - - hACK_dyn = map hack - where hack lib | not opt_Static && "_cbits" `isSuffixOf` lib = lib ++ "_dyn" - | otherwise = lib + expandTag t | null t = "" + | otherwise = '_':t return (concat (map all_opts ps)) -- 1.7.10.4