Menu

#11 xbc --strip option causes GCC error on bytecode

v1.0 (example)
closed-fixed
None
5
2014-03-19
2014-03-19
Nick Warne
No

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

Discussion

  • Nick Warne

    Nick Warne - 2014-03-19

    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

     
  • Markus Hoffmann

    Markus Hoffmann - 2014-03-19
    • status: unread --> open-accepted
    • assigned_to: Markus Hoffmann
     
  • Markus Hoffmann

    Markus Hoffmann - 2014-03-19

    bytecode files can also be stripped, because they have symbols in it.

     
  • Nick Warne

    Nick Warne - 2014-03-19

    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

     
  • Markus Hoffmann

    Markus Hoffmann - 2014-03-19

    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.

     
  • Markus Hoffmann

    Markus Hoffmann - 2014-03-19

    a modified xbc.bas is in the new source-tar ball (and released.) Can you confirm that it works now as expected?

     
  • Nick Warne

    Nick Warne - 2014-03-19

    Yes, all works as expected - thank you!

    Nick

     
  • Markus Hoffmann

    Markus Hoffmann - 2014-03-19
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.

Auth0 Logo