Verified Commit f34d6f33 authored by Camil Staps's avatar Camil Staps 🚀

Allow input and output of bcstrip to be identical; use bcstrip in CI tests

parent aa9f91a0
Pipeline #16666 failed with stages
in 5 minutes and 9 seconds
......@@ -24,6 +24,9 @@ bcgen "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.opt.abc" -o "$CLEAN_HOM
# Link bytecode
bclink "Clean System Files/fsieve.obc" "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.obc" i_system.obc -o fsieve.bc
# Strip bytecode (optional)
bcstrip fsive.bc -o fsieve.bc
# Interpret bytecode
interpret fsieve.bc
......@@ -57,6 +60,13 @@ The first OBC file is supposed to be that of the main module.
Usage: `bclink OBC [OBC ...] -o BC`
### bcstrip
Strips bytecode, leaving only the `Start` rule and all code reachable from
there.
Usage: `bcstrip BC -o BC`
### interpret
Interprets bytecode.
......
......@@ -8,6 +8,7 @@ Environments
EnvironmentABCOptimise: lib/exe/abcopt
EnvironmentByteCodeGen: lib/exe/bcgen
EnvironmentByteCodeLink: lib/exe/bclink
EnvironmentByteCodeStrip: lib/exe/bcstrip
EnvironmentCodeGen: lib/exe/cg
EnvironmentLinker: lib/exe/linker:-no-pie
EnvironmentDynLink: lib/exe/linker:-no-pie
......
......@@ -8,6 +8,7 @@ Environments
EnvironmentABCOptimise: Tools\Clean System 64\ABCOptimiser.exe
EnvironmentByteCodeGen: Tools\Clean System 64\ByteCodeGenerator.exe
EnvironmentByteCodeLink: Tools\Clean System 64\ByteCodeLinker.exe
EnvironmentByteCodeStrip: Tools\Clean System 64\ByteCodeStripper.exe
EnvironmentCodeGen: Tools\Clean System 64\CodeGenerator64.exe
EnvironmentLinker: Tools\Clean System 64\StaticLinker.exe
EnvironmentDynLink: Tools\Clean System 64\DynamicLinker.exe
......
......@@ -7,15 +7,12 @@
const char usage[] = "Usage: %s FILE [-o FILE]\n";
int main(int argc, char **argv) {
FILE *output_file=stdout;
char *output_file_name=NULL;
FILE *input_file=NULL;
for (int i=1; i<argc; i++) {
if(!strcmp("-o", argv[i]) && i <= argc-1) {
if((output_file = fopen(argv[i+1], "wb")) == NULL) {
fprintf(stderr, "Error: Could not open output file: %s\n", argv[i+1]);
return -1;
}
output_file_name=argv[i+1];
i++;
} else if (input_file!=NULL) {
fprintf(stderr, usage, argv[0]);
......@@ -45,6 +42,11 @@ int main(int argc, char **argv) {
uint32_t length;
char *stripped_bytecode=finish_strip_bytecode(&length);
FILE *output_file=stdout;
if(output_file_name!=NULL && (output_file=fopen(output_file_name, "wb"))==NULL) {
fprintf(stderr, "Error: Could not open output file: %s\n", output_file_name);
return -1;
}
fwrite(stripped_bytecode, length, 1, output_file);
return 0;
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Path: {Application}*lib*Platform
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Path: {Application}*lib*Platform
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Path: {Application}*lib*Dynamics
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Path: {Application}*lib*Platform
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Path: {Application}*lib*Platform
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
......@@ -43,6 +43,7 @@ Global
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
Precompile:
......
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