Verified Commit 2b4a9711 authored by Camil Staps's avatar Camil Staps 🙂

Add StripByteCode to link options (see cstaps/abc-interpreter!87)

parent 0e0c2e94
...@@ -68,6 +68,7 @@ getCurrentCgen :: !*GeneralSt -> (!String,!*GeneralSt) ...@@ -68,6 +68,7 @@ getCurrentCgen :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentAbcOpt :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentAbcOpt :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentBCgen :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentBCgen :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentBClink :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentBClink :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentBCstrip :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentDynl :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentDynl :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentVers :: !*GeneralSt -> (!Int,!*GeneralSt) getCurrentVers :: !*GeneralSt -> (!Int,!*GeneralSt)
......
...@@ -193,6 +193,11 @@ getCurrentBClink ps ...@@ -193,6 +193,11 @@ getCurrentBClink ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_bclink,ps) = (ct.target_bclink,ps)
getCurrentBCstrip :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentBCstrip ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_bcstrip,ps)
getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt) getCurrentLink :: !*GeneralSt -> (!String,!*GeneralSt)
getCurrentLink ps getCurrentLink ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
......
...@@ -190,6 +190,7 @@ getCurrentCgen :: !*(PSt *General) -> (!String,!*PSt *General) ...@@ -190,6 +190,7 @@ getCurrentCgen :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentAbcOpt :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentAbcOpt :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBCgen :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentBCgen :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBClink :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentBClink :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBCstrip :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentDynl :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentDynl :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentVers :: !*(PSt *General) -> (!Int,!*PSt *General) getCurrentVers :: !*(PSt *General) -> (!Int,!*PSt *General)
......
...@@ -455,6 +455,11 @@ getCurrentBClink ps ...@@ -455,6 +455,11 @@ getCurrentBClink ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_bclink,ps) = (ct.target_bclink,ps)
getCurrentBCstrip :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentBCstrip ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_bcstrip,ps)
getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General) getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentLink ps getCurrentLink ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps # (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
......
...@@ -820,6 +820,9 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj ...@@ -820,6 +820,9 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
= continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps) = continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps)
# (ok,ps) = if (PR_GetByteCodePath project <> "") (ByteCodeLink fileinfo project ps) (True, ps) # (ok,ps) = if (PR_GetByteCodePath project <> "") (ByteCodeLink fileinfo project ps) (True, ps)
| not ok
= continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps)
# (ok,ps) = if (lo.strip_bytecode && PR_GetByteCodePath project <> "") (ByteCodeStrip fileinfo project ps) (True, ps)
| not ok | not ok
= continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps) = continue False newpaths False fileinfo libsinfo modpaths project intr (abccache, ps)
...@@ -1727,6 +1730,23 @@ ByteCodeLink fileinfo project ps ...@@ -1727,6 +1730,23 @@ ByteCodeLink fileinfo project ps
| fromOk r <> 0 = (False, updateErrorWindow ["bytecode linker failed with non-zero exit code " +++ toString (fromOk r)] ps) | fromOk r <> 0 = (False, updateErrorWindow ["bytecode linker failed with non-zero exit code " +++ toString (fromOk r)] ps)
= (True, ps) = (True, ps)
ByteCodeStrip :: !FileInfoCache !Project !*GeneralSt -> *(!Bool, !*GeneralSt)
ByteCodeStrip fileinfo project ps
# (startupdir,ps) = getStup ps
(bcstrip,ps) = getCurrentBCstrip ps
bcstrip = startupdir +++ DirSeparatorString +++ bcstrip
# bcpath = fulPath startupdir (PR_GetRootDir project) (PR_GetByteCodePath project)
# ps = showInfo (Level2 ("Stripping bytecode for '" +++ RemovePath bcpath +++ "'")) ps
# (h,ps) = acc_world_instead_of_ps (runProcessIO bcstrip [bcpath,"-o",bcpath] Nothing) ps
| isError h = (False, updateErrorWindow ["failed to execute the bytecode stripper: " +++ snd (fromError h)] ps)
# (h,io) = fromOk h
# (r,ps) = acc_world_instead_of_ps (waitForProcess h) ps
| isError r = (False, updateErrorWindow ["failed to wait for the bytecode stripper: " +++ snd (fromError r)] ps)
# ps = processIOToErrorWindow io ps
| fromOk r <> 0 = (False, updateErrorWindow ["bytecode stripper failed with non-zero exit code " +++ toString (fromOk r)] ps)
= (True, ps)
processIOToErrorWindow :: !ProcessIO !*GeneralSt -> *GeneralSt processIOToErrorWindow :: !ProcessIO !*GeneralSt -> *GeneralSt
processIOToErrorWindow io ps processIOToErrorWindow io ps
| IF_WINDOWS64 True False = ps // FIXME: System.Process is broken on 64-bit windows (see Platform#65) | IF_WINDOWS64 True False = ps // FIXME: System.Process is broken on 64-bit windows (see Platform#65)
......
...@@ -17,6 +17,7 @@ EnvsFileName :== "IDEEnvs" ...@@ -17,6 +17,7 @@ EnvsFileName :== "IDEEnvs"
, target_abcopt :: !String // abc optimiser , target_abcopt :: !String // abc optimiser
, target_bcgen :: !String // bytecode generator , target_bcgen :: !String // bytecode generator
, target_bclink :: !String // bytecode linker , target_bclink :: !String // bytecode linker
, target_bcstrip :: !String // bytecode stripper
, target_link :: !String // static/eager linker , target_link :: !String // static/eager linker
, target_dynl :: !String // dynamic linker , target_dynl :: !String // dynamic linker
, target_vers :: !Int // abc version , target_vers :: !Int // abc version
......
...@@ -30,6 +30,7 @@ t_StdEnv ...@@ -30,6 +30,7 @@ t_StdEnv
, target_abcopt :: !String // abc optimiser , target_abcopt :: !String // abc optimiser
, target_bcgen :: !String // bytecode generator , target_bcgen :: !String // bytecode generator
, target_bclink :: !String // bytecode linker , target_bclink :: !String // bytecode linker
, target_bcstrip :: !String // bytecode stripper
, target_link :: !String // static/eager linker , target_link :: !String // static/eager linker
, target_dynl :: !String // dynamic linker , target_dynl :: !String // dynamic linker
, target_vers :: !Int // abc version , target_vers :: !Int // abc version
...@@ -135,6 +136,7 @@ emptyTarget = ...@@ -135,6 +136,7 @@ emptyTarget =
, target_abcopt = "" , target_abcopt = ""
, target_bcgen = "" , target_bcgen = ""
, target_bclink = "" , target_bclink = ""
, target_bcstrip = ""
, target_link = "" , target_link = ""
, target_dynl = "" , target_dynl = ""
, target_vers = 42 , target_vers = 42
...@@ -168,6 +170,7 @@ TargetTable = ...@@ -168,6 +170,7 @@ TargetTable =
, SimpleOption "EnvironmentABCOptimise" (\a->a.target_abcopt) (\v a->{a & target_abcopt=v}) , SimpleOption "EnvironmentABCOptimise" (\a->a.target_abcopt) (\v a->{a & target_abcopt=v})
, SimpleOption "EnvironmentByteCodeGen" (\a->a.target_bcgen) (\v a->{a & target_bcgen=v}) , 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 "EnvironmentByteCodeLink" (\a->a.target_bclink) (\v a->{a & target_bclink=v})
, SimpleOption "EnvironmentByteCodeStrip" (\a->a.target_bcstrip) (\v a->{a & target_bcstrip=v})
, SimpleOption "EnvironmentLinker" (\a->a.target_link) (\v a->{a & target_link=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 "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}) , SimpleOption "EnvironmentVersion" (\a->toString a.target_vers) (\v a->{a & target_vers=toInt v})
...@@ -208,6 +211,7 @@ t_StdEnv20 ...@@ -208,6 +211,7 @@ t_StdEnv20
, target_abcopt = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ABCOptimiser.exe" "abcopt" , target_abcopt = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ABCOptimiser.exe" "abcopt"
, target_bcgen = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ByteCodeGenerator.exe" "bcgen" , 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_bclink = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ByteCodeLinker.exe" "bclink"
, target_bcstrip = compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "ByteCodeStripper.exe" "bcstrip"
, target_link = IF_MACOSX "/usr/bin/gcc" (compiler_and_linker_directory+++DirSeparatorString+++IF_WINDOWS "StaticLinker.exe" "linker") , 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_dynl = "Tools"+++DirSeparatorString+++"Dynamics"+++DirSeparatorString+++"DynamicLinker.exe"
, target_vers = 920 , target_vers = 920
......
...@@ -386,6 +386,7 @@ LinkOptionsTable = ...@@ -386,6 +386,7 @@ LinkOptionsTable =
, SimpleOption "GenerateDLL" (\a->a.generate_dll) (\v a->{a & generate_dll = v}) , SimpleOption "GenerateDLL" (\a->a.generate_dll) (\v a->{a & generate_dll = v})
, SimpleOption "ExportedNames" (\a->a.dll_export_list_name) (\v a->{a & dll_export_list_name = v}) , SimpleOption "ExportedNames" (\a->a.dll_export_list_name) (\v a->{a & dll_export_list_name = v})
// , SimpleOption "AddCarbResource" (\a->a.add_carb_resource) (\v a->{a & add_carb_resource = v}) // , 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})
} }
EditWdOptionsTable :: OptionsTable EditWdOptions EditWdOptionsTable :: OptionsTable EditWdOptions
......
...@@ -38,6 +38,8 @@ instance fromString Processor ...@@ -38,6 +38,8 @@ instance fromString Processor
, dll_export_list_name :: !String , dll_export_list_name :: !String
// , add_carb_resource :: !Bool // Mac-only! // , add_carb_resource :: !Bool // Mac-only!
, strip_bytecode :: !Bool // strip ABC bytecode
} }
DefaultLinkOptions :: LinkOptions DefaultLinkOptions :: LinkOptions
......
...@@ -139,6 +139,8 @@ where ...@@ -139,6 +139,8 @@ where
, dll_export_list_name :: !String , dll_export_list_name :: !String
// , add_carb_resource :: !Bool // Mac-only! // , add_carb_resource :: !Bool // Mac-only!
, strip_bytecode :: !Bool // strip ABC bytecode
} }
/* /*
instance == LinkOptions // do we need to check resource linking flags??? instance == LinkOptions // do we need to check resource linking flags???
...@@ -169,6 +171,7 @@ DefaultLinkOptions = ...@@ -169,6 +171,7 @@ DefaultLinkOptions =
, generate_dll = False , generate_dll = False
, dll_export_list_name = "" , dll_export_list_name = ""
// , add_carb_resource = False // Clean2 ide targets Carbon?! // , add_carb_resource = False // Clean2 ide targets Carbon?!
, strip_bytecode = False
} }
:: LinkMethod :: LinkMethod
...@@ -299,8 +302,8 @@ DefCodeGenOptions :: CodeGenOptions; ...@@ -299,8 +302,8 @@ DefCodeGenOptions :: CodeGenOptions;
DefCodeGenOptions = DefCodeGenOptions =
{ cs = False { cs = False
, ci = True , ci = True
, generate_bytecode = False
, optimise_abc = False , optimise_abc = False
, generate_bytecode = False
} }
// The Application Options: default settings for the application. // The Application Options: default settings for the application.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment