diff --git a/BatchBuild/IdeState.dcl b/BatchBuild/IdeState.dcl index 015cc9e61bb2af47932d21b1b611e82a7df1047c..e066098d0c5f033adfb731ce826d0e85ff95dcf9 100644 --- a/BatchBuild/IdeState.dcl +++ b/BatchBuild/IdeState.dcl @@ -67,6 +67,7 @@ getCurrentAbcOpt :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentBCgen :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentBClink :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentBCstrip :: !*GeneralSt -> (!String,!*GeneralSt) +getCurrentBCprelink :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentDynl :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentVers :: !*GeneralSt -> (!Int,!*GeneralSt) diff --git a/BatchBuild/IdeState.icl b/BatchBuild/IdeState.icl index 211f251d27400969b4aa732181b666b1371c37db..fa44bd1cd2509cc4e69d5b5e16364537af0cc303 100644 --- a/BatchBuild/IdeState.icl +++ b/BatchBuild/IdeState.icl @@ -198,6 +198,11 @@ getCurrentBCstrip ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps = (ct.target_bcstrip,ps) +getCurrentBCprelink :: !*GeneralSt -> (!String,!*GeneralSt) +getCurrentBCprelink ps + # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps + = (ct.target_bcprelink,ps) + getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentLink ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps diff --git a/Ide/IdeState.dcl b/Ide/IdeState.dcl index f78669ad3bf7be717ab527ca3011701de9d336dc..a2f7c8023d9fc66deb521e682252d37f9afe60ad 100644 --- a/Ide/IdeState.dcl +++ b/Ide/IdeState.dcl @@ -183,6 +183,7 @@ getCurrentAbcOpt :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentBCgen :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentBClink :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentBCstrip :: !*(PSt *General) -> (!String,!*PSt *General) +getCurrentBCprelink :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentDynl :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentVers :: !*(PSt *General) -> (!Int,!*PSt *General) diff --git a/Ide/IdeState.icl b/Ide/IdeState.icl index b97d4be3e73d3e1ae3546a65619946c11d26df7b..84981d16db876eb2485f7551faeaf20c56696d78 100644 --- a/Ide/IdeState.icl +++ b/Ide/IdeState.icl @@ -460,6 +460,11 @@ getCurrentBCstrip ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps = (ct.target_bcstrip,ps) +getCurrentBCprelink :: !*(PSt *General) -> (!String,!*PSt *General) +getCurrentBCprelink ps + # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps + = (ct.target_bcprelink,ps) + getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentLink ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps diff --git a/Ide/PmDialogues.icl b/Ide/PmDialogues.icl index 3a7e048e6066926d47a407d3aa6d43d3baf4df47..15fb52780697ff31f55c80956cb3c5de6577c804 100644 --- a/Ide/PmDialogues.icl +++ b/Ide/PmDialogues.icl @@ -401,6 +401,9 @@ where :+: CheckControl [("Keep bytecode symbols",Nothing,toMark lo.keep_bytecode_symbols,noPS (\l->{l & lo.keep_bytecode_symbols = not l.lo.keep_bytecode_symbols}))] (Columns 1) [ControlPos (Left,zero)] + :+: CheckControl + [("Prelink bytecode",Nothing,toMark lo.prelink_bytecode,noPS (\l->{l & lo.prelink_bytecode = not l.lo.prelink_bytecode}))] + (Columns 1) [ControlPos (Left,zero)] :+: TextControl ("Generate main bytecode file as: "+++bytecodepath) [ControlId bytecodepathId,ControlPos (Left,zero):if actualProject [] [ControlHide]] :+: ButtonControl "Set bytecode file..." [ControlFunction setbytecodepath,ControlPos (Left,zero):if actualProject [] [ControlHide]] ) diff --git a/Ide/targetui.icl b/Ide/targetui.icl index 13e4b811c60e7cafd1b9d152dae6cb556e0f13fa..9af072d361493480c61b834b50bb19808b4d6722 100644 --- a/Ide/targetui.icl +++ b/Ide/targetui.icl @@ -425,6 +425,7 @@ editTargets getTs setTs ps , bcGenId :: !Id // bytecode generator , bcLinkId :: !Id // bytecode linker , bcStripId :: !Id // bytecode stripper + , bcPrelinkId :: !Id // bytecode prelinker } envDialog ap pp ts ct getTs setTs ps @@ -483,7 +484,7 @@ envDialog ap pp ts ct getTs setTs ps ) // selection update function lbsllId [ControlViewSize {h=siz.Size.h,w=300}] - # ([compId,cgenId,linkId,dynlId,versId,methId,abcOptId,bcGenId,bcLinkId,bcStripId:_],ps) = openIds 10 ps + # ([compId,cgenId,linkId,dynlId,versId,methId,abcOptId,bcGenId,bcLinkId,bcStripId,bcPrelinkId:_],ps) = openIds 11 ps # environmentSettingsIds = { compId = compId , cgenId = cgenId @@ -495,6 +496,7 @@ envDialog ap pp ts ct getTs setTs ps , bcGenId = bcGenId , bcLinkId = bcLinkId , bcStripId = bcStripId + , bcPrelinkId = bcPrelinkId } # (c1id,ps) = openId ps # (c2id,ps) = openId ps @@ -539,7 +541,7 @@ where :+: Pane "Object Modules" (objmpane inifull lbobj c4id r4id) ) (Columns 2) [ControlPos (Left,zero)] -buttons wid okId cancelId getTs setTs ct ts {compId,cgenId,linkId,dynlId,versId,methId,abcOptId,bcGenId,bcLinkId,bcStripId} +buttons wid okId cancelId getTs setTs ct ts {compId,cgenId,linkId,dynlId,versId,methId,abcOptId,bcGenId,bcLinkId,bcStripId,bcPrelinkId} = ButtonControl "Done" [ ControlFunction savefun , ControlId okId, ControlPos (Right,zero) @@ -590,13 +592,13 @@ where = abort "Fatal error in environment dialog: window has disappeared." # wdef = fromJust wdef # [(ok1,comp),(ok2,cgen),(ok3,link),(ok4,dynl),(ok5,vers),(ok6,mnum), - (ok7,abcopt),(ok8,bcgen),(ok9,bclink),(ok10,bcstrip):_] - = getControlTexts [compId,cgenId,linkId,dynlId,versId,methId,abcOptId,bcGenId,bcLinkId,bcStripId] wdef - | not (ok1 && ok2 && ok3 && ok4 && ok5 && ok6 && ok7 && ok8 && ok9 && ok10) + (ok7,abcopt),(ok8,bcgen),(ok9,bclink),(ok10,bcstrip),(ok11,bcprelink):_] + = getControlTexts [compId,cgenId,linkId,dynlId,versId,methId,abcOptId,bcGenId,bcLinkId,bcStripId,bcPrelinkId] wdef + | not (ok1 && ok2 && ok3 && ok4 && ok5 && ok6 && ok7 && ok8 && ok9 && ok10 && ok11) = abort "Fatal error in environment dialog: controls have disappeared." | (isNothing comp) || (isNothing cgen) || (isNothing link) || (isNothing dynl) || (isNothing vers) || (isNothing mnum) - || isNothing abcopt || isNothing bcgen || isNothing bclink || isNothing bcstrip + || isNothing abcopt || isNothing bcgen || isNothing bclink || isNothing bcstrip || isNothing bcprelink = abort "Fatal error in environment dialog: controls are empty." # comp = fromJust comp # cgen = fromJust cgen @@ -608,6 +610,7 @@ where # bcgen = fromJust bcgen # bclink = fromJust bclink # bcstrip = fromJust bcstrip + # bcprelink = fromJust bcprelink # ls = { ls & tg.target_comp = comp @@ -619,6 +622,7 @@ where , tg.target_bcgen = bcgen , tg.target_bclink = bclink , tg.target_bcstrip = bcstrip + , tg.target_bcprelink = bcprelink } # ls = case ls.tg.target_meth of (CompileAsync _) -> {ls & tg.target_meth = CompileAsync (toInt mnum)} @@ -631,7 +635,7 @@ where title = TextControl "Environment Options" [ControlPos (Center,zero)] -toolpane tg {compId,cgenId,linkId,dynlId,versId,methId,abcOptId,bcGenId,bcLinkId,bcStripId} +toolpane tg {compId,cgenId,linkId,dynlId,versId,methId,abcOptId,bcGenId,bcLinkId,bcStripId,bcPrelinkId} = TextControl "Compiler: " [ControlWidth textWidth] :+: EditControl tg.target_comp (PixelWidth 250) 1 [ ControlId compId @@ -672,6 +676,11 @@ toolpane tg {compId,cgenId,linkId,dynlId,versId,methId,abcOptId,bcGenId,bcLinkId [ ControlId bcStripId , ControlActivate (noLS (appPIO (setEditControlSelection bcStripId 1 0))) ] + :+: TextControl "Bytecode Prelinker: " [ControlPos (Left,zero),ControlWidth textWidth] + :+: EditControl tg.target_bcprelink (PixelWidth 250) 1 + [ ControlId bcPrelinkId + , ControlActivate (noLS (appPIO (setEditControlSelection bcPrelinkId 1 0))) + ] :+: TextControl "ABC version: " [ControlPos (Left,zero),ControlWidth textWidth] :+: EditControl (toString tg.target_vers) (PixelWidth 250) 1 [ ControlId versId diff --git a/Pm/PmDriver.icl b/Pm/PmDriver.icl index 2a48948295f9e4108d2d00dda17a968471ccc97f..99f4c55ecba2b112e1ed93ce9793786c87b0c9b3 100644 --- a/Pm/PmDriver.icl +++ b/Pm/PmDriver.icl @@ -817,6 +817,9 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj | not ok = continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps) # (ok,ps) = if (lo.strip_bytecode && PR_GetByteCodePath project <> "") (ByteCodeStrip lo.keep_bytecode_symbols fileinfo project ps) (True, ps) + | not ok + = continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps) + # (ok,ps) = if (lo.prelink_bytecode && PR_GetByteCodePath project <> "") (ByteCodePrelink project ps) (True, ps) | not ok = continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps) @@ -1744,3 +1747,19 @@ ByteCodeStrip keep_symbols fileinfo project ps (err ++ ["Bytecode stripper failed (exit code: " +++ toString exitcode +++ ")"]) # ps = updateErrorWindow err ps = (exitcode == 0, ps) + +ByteCodePrelink :: !Project !*GeneralSt -> *(!Bool, !*GeneralSt) +ByteCodePrelink project ps + # (startupdir,ps) = getStup ps + (bcprelink,ps) = getCurrentBCprelink ps + bcprelink = startupdir +++ DirSeparatorString +++ bcprelink + # bcpath = fulPath startupdir (PR_GetRootDir project) (PR_GetByteCodePath project) + pbcpath = (bcpath % (0,size bcpath-3)) +++ "pbc" + + # ps = showInfo (Level2 ("Prelinking bytecode for '" +++ RemovePath bcpath +++ "'")) ps + # (exitcode,err,ps) = RunExternalCommand bcprelink [bcpath,"-o",pbcpath] startupdir ps + # err = if (exitcode == 0) + err + (err ++ ["Bytecode prelinker failed (exit code: " +++ toString exitcode +++ ")"]) + # ps = updateErrorWindow err ps + = (exitcode == 0, ps) diff --git a/Pm/PmEnvironment.dcl b/Pm/PmEnvironment.dcl index 31761cf2835205b2bc289b55eccef0777f91cf0a..69e8bddadc259063a392941f44af986a88f85c5c 100644 --- a/Pm/PmEnvironment.dcl +++ b/Pm/PmEnvironment.dcl @@ -18,6 +18,7 @@ EnvsFileName :== "IDEEnvs" , target_bcgen :: !String // bytecode generator , target_bclink :: !String // bytecode linker , target_bcstrip :: !String // bytecode stripper + , target_bcprelink :: !String // bytecode prelinker , target_link :: !String // static/eager linker , target_dynl :: !String // dynamic linker , target_vers :: !Int // abc version diff --git a/Pm/PmEnvironment.icl b/Pm/PmEnvironment.icl index 09e634bb7e366085ec06dafd1485bdf17a938b1c..643b57ae0ec5b5d592373cd593d46fa375cdd462 100644 --- a/Pm/PmEnvironment.icl +++ b/Pm/PmEnvironment.icl @@ -31,6 +31,7 @@ t_StdEnv , target_bcgen :: !String // bytecode generator , target_bclink :: !String // bytecode linker , target_bcstrip :: !String // bytecode stripper + , target_bcprelink :: !String // bytecode prelinker , target_link :: !String // static/eager linker , target_dynl :: !String // dynamic linker , target_vers :: !Int // abc version @@ -137,6 +138,7 @@ emptyTarget = , target_bcgen = "" , target_bclink = "" , target_bcstrip = "" + , target_bcprelink = "" , target_link = "" , target_dynl = "" , target_vers = 42 @@ -171,6 +173,7 @@ TargetTable = , SimpleOption "EnvironmentByteCodeGen" (\a->a.target_bcgen) (\v a->{a & target_bcgen=v}) , SimpleOption "EnvironmentByteCodeLink" (\a->a.target_bclink) (\v a->{a & target_bclink=v}) , SimpleOption "EnvironmentByteCodeStrip" (\a->a.target_bcstrip) (\v a->{a & target_bcstrip=v}) + , SimpleOption "EnvironmentByteCodePrelink" (\a->a.target_bcprelink) (\v a->{a & target_bcprelink=v}) , SimpleOption "EnvironmentLinker" (\a->a.target_link) (\v a->{a & target_link=v}) , SimpleOption "EnvironmentDynLink" (\a->a.target_dynl) (\v a->{a & target_dynl=v}) , SimpleOption "EnvironmentVersion" (\a->toString a.target_vers) (\v a->{a & target_vers=toInt v}) @@ -212,6 +215,7 @@ t_StdEnv20 , target_bcgen = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ByteCodeGenerator.exe" "bcgen" , target_bclink = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ByteCodeLinker.exe" "bclink" , target_bcstrip = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ByteCodeStripper.exe" "bcstrip" + , target_bcprelink = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ByteCodePrelinker.exe" "bcprelink" , target_link = IF_MACOSX "/usr/bin/gcc" (compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "StaticLinker.exe" "linker") , target_dynl = "Tools"+++DirSeparatorString+++"Dynamics"+++DirSeparatorString+++"DynamicLinker.exe" , target_vers = 920 diff --git a/Pm/PmFiles.icl b/Pm/PmFiles.icl index fd771efeaf752fc6722d7a165cfce2d3bbf559aa..ad3624e18154afe7f157833a96194a956fa661a5 100644 --- a/Pm/PmFiles.icl +++ b/Pm/PmFiles.icl @@ -444,6 +444,7 @@ LinkOptionsTable = // , SimpleOption "AddCarbResource" (\a->a.add_carb_resource) (\v a->{a & add_carb_resource = v}) , SimpleOption "StripByteCode" (\a->a.strip_bytecode) (\v a->{a & strip_bytecode=v}) , SimpleOption "KeepByteCodeSymbols" (\a->a.keep_bytecode_symbols) (\v a->{a & keep_bytecode_symbols=v}) + , SimpleOption "PrelinkByteCode" (\a->a.prelink_bytecode) (\v a->{a & prelink_bytecode=v}) } EditWdOptionsTable :: OptionsTable EditWdOptions diff --git a/Pm/PmTypes.dcl b/Pm/PmTypes.dcl index 0d476579c1ca2a79fb88f094a680437dbb7621b9..4230ef8b6371d8aab2e68af164efb52abd9fe206 100644 --- a/Pm/PmTypes.dcl +++ b/Pm/PmTypes.dcl @@ -41,6 +41,7 @@ instance fromString Processor , strip_bytecode :: !Bool // strip ABC bytecode , keep_bytecode_symbols :: !Bool // only meaningful when strip_bytecode=True + , prelink_bytecode :: !Bool // prelink bytecode for location-dependent interpretation } DefaultLinkOptions :: LinkOptions diff --git a/Pm/PmTypes.icl b/Pm/PmTypes.icl index 45c62625f04c660b64cbe60842bfa502f15229c3..d4b8520a62f55d0de9056b87cb9651b91dd3a9fd 100644 --- a/Pm/PmTypes.icl +++ b/Pm/PmTypes.icl @@ -142,6 +142,7 @@ where , strip_bytecode :: !Bool // strip ABC bytecode , keep_bytecode_symbols :: !Bool // only meaningful when strip_bytecode=True + , prelink_bytecode :: !Bool // prelink bytecode for location-dependent interpretation } /* instance == LinkOptions // do we need to check resource linking flags??? @@ -174,6 +175,7 @@ DefaultLinkOptions = // , add_carb_resource = False // Clean2 ide targets Carbon?! , strip_bytecode = True , keep_bytecode_symbols = True + , prelink_bytecode = False } :: LinkMethod