diff --git a/ghc/driver/Main.hs b/ghc/driver/Main.hs
index 630dd99ca34ef722481716b632d0b0a502ce3ecc..b40d18b59d0a3bab8a0073defb9c1dd06a57d655 100644
--- a/ghc/driver/Main.hs
+++ b/ghc/driver/Main.hs
@@ -684,7 +684,9 @@ getPackageLibraries = do
   ps' <- getPackageDetails ps
   tag <- readIORef build_tag
   let suffix = if null tag then "" else '_':tag
-  return (concat (map libraries ps'))
+  return (concat (
+	map (\p -> map (++suffix) (hs_libraries p) ++ extra_libraries p) ps'
+     ))
 
 getPackageExtraGhcOpts :: IO [String]
 getPackageExtraGhcOpts = do
@@ -802,18 +804,21 @@ way_details =
   [ (WayProf, Way  "p" "Profiling"  
 	[ "-fscc-profiling"
 	, "-DPROFILING"
-	, "-optc-DPROFILING" ]),
+	, "-optc-DPROFILING"
+	, "-fvia-C" ]),
 
     (WayTicky, Way  "t" "Ticky-ticky Profiling"  
 	[ "-fticky-ticky"
 	, "-DTICKY_TICKY"
-	, "-optc-DTICKY_TICKY" ]),
+	, "-optc-DTICKY_TICKY"
+	, "-fvia-C" ]),
 
     (WayUnreg, Way  "u" "Unregisterised" 
 	[ "-optc-DNO_REGS"
 	, "-optc-DUSE_MINIINTERPRETER"
 	, "-fno-asm-mangling"
-	, "-funregisterised" ]),
+	, "-funregisterised"
+	, "-fvia-C" ]),
 
     (WayDll, Way  "dll" "DLLized"
         [ ]),
@@ -823,20 +828,23 @@ way_details =
 	, "-fparallel"
 	, "-D__PARALLEL_HASKELL__"
 	, "-optc-DPAR"
-	, "-package concurrent" ]),
+	, "-package concurrent"
+	, "-fvia-C" ]),
 
     (WayGran, Way  "mg" "Gransim" 
 	[ "-fstack-check"
 	, "-fgransim"
 	, "-D__GRANSIM__"
 	, "-optc-DGRAN"
-	, "-package concurrent" ]),
+	, "-package concurrent"
+	, "-fvia-C" ]),
 
-    (WaySMP, Way  "s" "SMP"  
+    (WaySMP, Way  "s" "SMP"
 	[ "-fsmp"
 	, "-optc-pthread"
 	, "-optl-pthread"
-	, "-optc-DSMP" ]),
+	, "-optc-DSMP"
+	, "-fvia-C" ]),
 
     (WayUser_a,  Way  "a"  "User way 'a'"  ["$WAY_a_REAL_OPTS"]),	
     (WayUser_b,  Way  "b"  "User way 'b'"  ["$WAY_b_REAL_OPTS"]),	
@@ -1655,7 +1663,7 @@ do_link o_files unknown_srcs = do
     let lib_path_opts = map ("-L"++) lib_paths
 
     pkg_libs <- getPackageLibraries
-    let pkg_lib_opts = map ("-l"++) pkg_libs
+    let pkg_lib_opts = map (\lib -> "-l"++lib) pkg_libs
 
     libs <- readIORef cmdline_libraries
     let lib_opts = map ("-l"++) (reverse libs)
diff --git a/ghc/driver/Package.hs b/ghc/driver/Package.hs
index 778d7be13c60fad7edf95f256dc464865505d40f..2a80e0828c4cc9d9b17d4790bb077be1c6d6d5da 100644
--- a/ghc/driver/Package.hs
+++ b/ghc/driver/Package.hs
@@ -3,15 +3,16 @@ module Package where
 import Pretty
 
 data Package = Package {
-		import_dirs    :: [String],
-      		library_dirs   :: [String],
-      		libraries      :: [String],
-      		include_dirs   :: [String],
-		c_includes     :: [String],
-      		package_deps   :: [String],
-      		extra_ghc_opts :: [String],
-      		extra_cc_opts  :: [String],
-      		extra_ld_opts  :: [String]
+		import_dirs     :: [String],
+      		library_dirs    :: [String],
+      		hs_libraries    :: [String],
+      		extra_libraries :: [String],
+      		include_dirs    :: [String],
+		c_includes      :: [String],
+      		package_deps    :: [String],
+      		extra_ghc_opts  :: [String],
+      		extra_cc_opts   :: [String],
+      		extra_ld_opts   :: [String]
      		}
   deriving (Read, Show)
 
@@ -30,15 +31,16 @@ dumpPkgGuts :: Package -> Doc
 dumpPkgGuts pkg =
    text "Package" $$ nest 3 (braces (
       sep (punctuate comma [
-         dumpField "import_dirs"    (import_dirs    pkg),
-         dumpField "library_dirs"   (library_dirs   pkg),
-         dumpField "libraries"      (libraries      pkg),
-         dumpField "include_dirs"   (include_dirs   pkg),
-         dumpField "c_includes"     (c_includes     pkg),
-         dumpField "package_deps"   (package_deps   pkg),
-         dumpField "extra_ghc_opts" (extra_ghc_opts pkg),
-         dumpField "extra_cc_opts"  (extra_cc_opts  pkg),
-         dumpField "extra_ld_opts"  (extra_ld_opts  pkg)
+         dumpField "import_dirs"     (import_dirs     pkg),
+         dumpField "library_dirs"    (library_dirs    pkg),
+         dumpField "hs_libraries"    (hs_libraries    pkg),
+         dumpField "extra_libraries" (extra_libraries pkg),
+         dumpField "include_dirs"    (include_dirs    pkg),
+         dumpField "c_includes"      (c_includes      pkg),
+         dumpField "package_deps"    (package_deps    pkg),
+         dumpField "extra_ghc_opts"  (extra_ghc_opts  pkg),
+         dumpField "extra_cc_opts"   (extra_cc_opts   pkg),
+         dumpField "extra_ld_opts"   (extra_ld_opts   pkg)
       ])))
 
 dumpField :: String -> [String] -> Doc
diff --git a/ghc/driver/PackageSrc.hs b/ghc/driver/PackageSrc.hs
index 2c8726e4446eaeb504db9cc827f54ef357c58f00..c8a1840504a3d9857f76ca330f6d270cc6df878b 100644
--- a/ghc/driver/PackageSrc.hs
+++ b/ghc/driver/PackageSrc.hs
@@ -25,7 +25,8 @@ package_details installing =
                             else if installing
                                     then [ clibdir ]
                                     else [ ghc_src_dir cGHC_RUNTIME_DIR ++ "/gmp" ],
-        libraries      = [ "gmp" ],
+  	hs_libraries   = [],
+        extra_libraries = [ "gmp" ],
         include_dirs   = [],
         c_includes     = [],
         package_deps   = [],
@@ -41,7 +42,8 @@ package_details installing =
         library_dirs   = if installing
                             then [ clibdir ]
                             else [ ghc_src_dir cGHC_RUNTIME_DIR ],
-        libraries      = [ "HSrts" ],
+        hs_libraries      = [ "HSrts" ],
+	extra_libraries   = [],
         include_dirs   = if installing
                             then [ clibdir ++ "/includes" ]
                             else [ ghc_src_dir cGHC_INCLUDE_DIR ],
@@ -86,7 +88,7 @@ package_details installing =
         }
       ),
 
-      ( "std",  -- The Prelude & Standard Libraries
+      ( "std",  -- The Prelude & Standard Hs_libraries
         Package {
         import_dirs    = if installing
                             then [ clibdir ++ "/imports/std" ]
@@ -95,7 +97,8 @@ package_details installing =
                             then [ clibdir ]
                             else [ ghc_src_dir cGHC_LIB_DIR ++ "/std"
                                  , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
-        libraries      = [ "HSstd", "HSstd_cbits" ],
+        hs_libraries      = [ "HSstd" ],
+	extra_libraries   = [ "HSstd_cbits" ],
         include_dirs   = if installing
                             then []
                             else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
@@ -117,7 +120,8 @@ package_details installing =
                              then [ clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang"
                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
-         libraries      = [ "HSlang", "HSlang_cbits" ],
+         hs_libraries      = [ "HSlang" ],
+	 extra_libraries   = [ "HSlang_cbits" ],
          include_dirs   = if installing
                              then []
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
@@ -137,7 +141,8 @@ package_details installing =
          library_dirs   = if installing
                              then [ clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
-         libraries      = [ "HSconcurrent" ],
+         hs_libraries      = [ "HSconcurrent" ],
+	 extra_libraries   = [],
          include_dirs   = if installing
                              then []
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent/cbits" ],
@@ -161,7 +166,8 @@ package_details installing =
          library_dirs   = if installing
                              then [clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data" ],
-         libraries      = [ "HSdata" ],
+         hs_libraries      = [ "HSdata" ],
+	 extra_libraries   = [],
          include_dirs   = if installing
                              then []
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data/cbits" ],
@@ -182,7 +188,8 @@ package_details installing =
                              then [ clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net"
                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
-         libraries      = [ "HSnet", "HSnet_cbits" ],
+         hs_libraries      = [ "HSnet" ],
+	 extra_libraries   = [ "HSnet_cbits" ],
          include_dirs   = if installing
                              then []
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
@@ -205,7 +212,8 @@ package_details installing =
                              then [ clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix"
                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
-         libraries      = [ "HSposix", "HSposix_cbits" ],
+         hs_libraries      = [ "HSposix" ],
+	 extra_libraries   = [ "HSposix_cbits" ],
          include_dirs   = if installing
                              then []
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
@@ -229,7 +237,8 @@ package_details installing =
                              then [ clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text"
                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
-         libraries      = [ "HStext", "HStext_cbits" ],
+         hs_libraries      = [ "HStext" ],
+	 extra_libraries   = [ "HStext_cbits" ],
          include_dirs   = if installing
                              then []
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
@@ -251,7 +260,8 @@ package_details installing =
                              then [ clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util"
                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
-         libraries      = [ "HSutil", "HSutil_cbits" ],
+         hs_libraries      = [ "HSutil" ],
+	 extra_libraries   = [ "HSutil_cbits" ],
          include_dirs   = if installing
                              then []
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
@@ -273,7 +283,8 @@ package_details installing =
          library_dirs   = if installing
                              then [ clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ],
-         libraries      = [ "HShssource" ],
+         hs_libraries      = [ "HShssource" ],
+	 extra_libraries   = [],
          include_dirs   = [],
          c_includes     = [],
          package_deps   = [ "text" ],
@@ -291,7 +302,8 @@ package_details installing =
          library_dirs   = if installing
                              then [ clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32/src" ],
-         libraries      = [ "HSwin32" ],
+         hs_libraries      = [ "HSwin32" ],
+	 extra_libraries   = [],
          include_dirs   = [],
          c_includes     = [],           -- ???
          package_deps   = [ "lang" ],
@@ -309,7 +321,8 @@ package_details installing =
          library_dirs   = if installing
                              then [ clibdir ]
                              else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
-         libraries      = [ "HScom" ],
+         hs_libraries      = [ "HScom" ],
+	 extra_libraries   = [],
          include_dirs   = [],
          c_includes     = [],           -- ???
          package_deps   = [ "lang" ],