[Git][ghc/ghc][wip/js-staging] 2 commits: RTS: link platform.js before the others!

Sylvain Henry (@hsyl20) gitlab at gitlab.haskell.org
Thu Sep 1 10:50:27 UTC 2022



Sylvain Henry pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC


Commits:
536b9109 by Sylvain Henry at 2022-09-01T11:34:50+02:00
RTS: link platform.js before the others!

- - - - -
9885b9cc by Sylvain Henry at 2022-09-01T12:02:50+02:00
Hadrian: treat JS objects similarly to other objects

- - - - -


3 changed files:

- hadrian/src/Rules/Library.hs
- hadrian/src/Rules/Program.hs
- rts/rts.cabal.in


Changes:

=====================================
hadrian/src/Rules/Library.hs
=====================================
@@ -58,9 +58,8 @@ buildStaticLib root archivePath = do
                      archivePath
     let context = libAContext l
     objs <- libraryObjects context
-    resources <- libraryResources context
     removeFile archivePath
-    build $ target context (Ar Pack stage) (objs ++ resources) [archivePath]
+    build $ target context (Ar Pack stage) objs [archivePath]
     synopsis <- pkgSynopsis (package context)
     putSuccess $ renderLibrary
         (quote pkgname ++ " (" ++ show stage ++ ", way " ++ show way ++ ").")
@@ -120,10 +119,11 @@ nonHsObjects context = do
     asmObjs <- mapM (objectPath context) asmSrcs
     cObjs   <- cObjects context
     cxxObjs <- cxxObjects context
+    jsObjs  <- jsObjects context
     cmmSrcs <- interpretInContext context (getContextData cmmSrcs)
     cmmObjs <- mapM (objectPath context) cmmSrcs
     eObjs   <- extraObjects context
-    return $ asmObjs ++ cObjs ++ cxxObjs ++ cmmObjs ++ eObjs
+    return $ asmObjs ++ cObjs ++ cxxObjs ++ cmmObjs ++ jsObjs ++ eObjs
 
 -- | Return all the Cxx object files needed to build the given library context.
 cxxObjects :: Context -> Action [FilePath]
@@ -140,15 +140,9 @@ cObjects context = do
         then objs
         else filter ((`notElem` ["Evac_thr", "Scav_thr"]) . takeBaseName) objs
 
-libraryResources :: Context -> Action [FilePath]
-libraryResources context = do
-    jsFls <- jsFiles context
-    need jsFls
-    return jsFls
-
--- | Return all the JS sources to be included in the library.
-jsFiles :: Context -> Action [FilePath]
-jsFiles context = do
+-- | Return all the JS object files to be included in the library.
+jsObjects :: Context -> Action [FilePath]
+jsObjects context = do
   srcs <- interpretInContext context (getContextData jsSrcs)
   mapM (objectPath context) srcs
 


=====================================
hadrian/src/Rules/Program.hs
=====================================
@@ -120,10 +120,12 @@ buildBinary rs bin context at Context {..} = do
     asmObjs <- mapM (objectPath context) asmSrcs
     cSrcs   <- interpretInContext context (getContextData cSrcs)
     cxxSrcs <- interpretInContext context (getContextData cxxSrcs)
+    jsSrcs  <- interpretInContext context (getContextData jsSrcs)
     cObjs   <- mapM (objectPath context) cSrcs
     cxxObjs <- mapM (objectPath context) cxxSrcs
+    jsObjs  <- mapM (objectPath context) jsSrcs
     hsObjs  <- hsObjects context
-    let binDeps = asmObjs ++ cObjs ++ cxxObjs ++ hsObjs
+    let binDeps = asmObjs ++ cObjs ++ cxxObjs ++ jsObjs ++ hsObjs
     need binDeps
     buildWithResources rs $ target context (Ghc LinkHs stage) binDeps [bin]
     synopsis <- pkgSynopsis package


=====================================
rts/rts.cabal.in
=====================================
@@ -75,30 +75,35 @@ library
       -- dummy file to force the build of a .a lib
       -- FIXME (Luite, 2022-08) do we still need the c-sources file?
       c-sources: version.c
-      js-sources: js/structs.js
-                  js/arith.js
-                  js/compact.js
-                  js/debug.js
-                  js/enum.js
-                  js/environment.js
-                  js/gc.js
-                  js/goog.js
-                  js/hscore.js
-                  js/md5.js
-                  js/mem.js
-                  js/node-exports.js
-                  js/object.js
-                  js/platform.js
-                  js/profiling.js
-                  js/rts.js
-                  js/stableptr.js
-                  js/staticpointer.js
-                  js/stm.js
-                  js/string.js
-                  js/thread.js
-                  js/unicode.js
-                  js/verify.js
-                  js/weak.js
+
+      js-sources:
+        -- "platform" must be linked first because it defines global constants
+        -- (e.g. h$isNode)
+        js/platform.js
+
+        js/structs.js
+        js/arith.js
+        js/compact.js
+        js/debug.js
+        js/enum.js
+        js/environment.js
+        js/gc.js
+        js/goog.js
+        js/hscore.js
+        js/md5.js
+        js/mem.js
+        js/node-exports.js
+        js/object.js
+        js/profiling.js
+        js/rts.js
+        js/stableptr.js
+        js/staticpointer.js
+        js/stm.js
+        js/string.js
+        js/thread.js
+        js/unicode.js
+        js/verify.js
+        js/weak.js
 
       install-includes: HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h
                         ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b24014b836cf1f3cd781a72ba70e268783a99e26...9885b9cc1b2655036777fadb15f01f1be500c472

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b24014b836cf1f3cd781a72ba70e268783a99e26...9885b9cc1b2655036777fadb15f01f1be500c472
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220901/06fed1b0/attachment-0001.html>


More information about the ghc-commits mailing list