xbc --strip option causes GCC error on bytecode
A BASIC interpreter and compiler with graphics.
Brought to you by:
kollo
I have a small *.bas program.
Using:
xbc -virtualm factors.bas -o factors
builds the binary fine, and all works great.
But adding -s (or --strip) option produces:
xbc -s -virtualm factors.bas -o factors
factors.c: In function ‘main’:
factors.c:28:13: error: expected declaration or statement at end of input
/ 04 / X2F;
Now, looking at /examples/compiler/xbc.bas I see in procedure:
PROCEDURE dobytecode (line 155) is this:
...
...
if dostrip
extra$=extra$+"-s "
endif
Removing this allows the build to complete, and also at line 295 the system strip works OK on the binary...
Surely you should only strip binaries anyway, not bytecode/source code?
Nick
If fact, using -s with xbbc causes xb2c to segfault too:
xbbc -s factors.bas -o f2
xb2c f2 -o f2.b
Segmentation fault
Nick
bytecode files can also be stripped, because they have symbols in it.
Ah, ok. But thinking, as user never sees *.b file since gcc builds it, is there any reason to strip it using xbc and only strip the binary?
Nick
A stripped bytecode file cannot be translated to C anymore. So I think I am going to modify xbc.bas such, that if -virtualm and -s are used simultaniously, only the final binary will be stripped.
a modified xbc.bas is in the new source-tar ball (and released.) Can you confirm that it works now as expected?
Yes, all works as expected - thank you!
Nick