Verified Commit 9694df8e authored by Camil Staps's avatar Camil Staps 🐧

Add option KeepByteCodeSymbols to keep the symbol table when stripping bytecode

parent 77053aa3
Pipeline #20755 passed with stage
in 55 seconds
......@@ -398,6 +398,9 @@ where
:+: CheckControl
[("Strip bytecode",Nothing,toMark lo.strip_bytecode,noPS (\l->{l & lo.strip_bytecode = not l.lo.strip_bytecode}))]
(Columns 1) [ControlPos (Left,zero)]
:+: 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)]
:+: 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]]
)
......
......@@ -816,7 +816,7 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
# (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)
# (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)
......@@ -1718,15 +1718,17 @@ ByteCodeLink fileinfo project ps
# ps = updateErrorWindow err ps
= (exitcode == 0, ps)
ByteCodeStrip :: !FileInfoCache !Project !*GeneralSt -> *(!Bool, !*GeneralSt)
ByteCodeStrip fileinfo project ps
ByteCodeStrip :: !Bool !FileInfoCache !Project !*GeneralSt -> *(!Bool, !*GeneralSt)
ByteCodeStrip keep_symbols 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
# (exitcode,err,ps) = RunExternalCommand bcstrip [bcpath,"-o",bcpath] startupdir ps
# opts = [bcpath,"-o",bcpath]
opts = if keep_symbols ["-s":opts] opts
# (exitcode,err,ps) = RunExternalCommand bcstrip opts startupdir ps
# err = if (exitcode == 0)
err
(err ++ ["Bytecode stripper failed (exit code: " +++ toString exitcode +++ ")"])
......
......@@ -443,6 +443,7 @@ LinkOptionsTable =
, 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 "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})
}
EditWdOptionsTable :: OptionsTable EditWdOptions
......
......@@ -40,6 +40,7 @@ instance fromString Processor
// , add_carb_resource :: !Bool // Mac-only!
, strip_bytecode :: !Bool // strip ABC bytecode
, keep_bytecode_symbols :: !Bool // only meaningful when strip_bytecode=True
}
DefaultLinkOptions :: LinkOptions
......
......@@ -141,6 +141,7 @@ where
// , add_carb_resource :: !Bool // Mac-only!
, strip_bytecode :: !Bool // strip ABC bytecode
, keep_bytecode_symbols :: !Bool // only meaningful when strip_bytecode=True
}
/*
instance == LinkOptions // do we need to check resource linking flags???
......@@ -171,7 +172,8 @@ DefaultLinkOptions =
, generate_dll = False
, dll_export_list_name = ""
// , add_carb_resource = False // Clean2 ide targets Carbon?!
, strip_bytecode = False
, strip_bytecode = True
, keep_bytecode_symbols = True
}
:: LinkMethod
......
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