Terraspace / UASM

UASM - Macro Assembler
http://www.terraspace.co.uk/uasm.html
Other
221 stars 49 forks source link

The "Error A2169: General Failure" on -elf generation #192

Closed EXL closed 3 months ago

EXL commented 1 year ago

Test case:

./uasm -zcw -zze -zt0 -zv0 -coff findPattern.asm              # <= RESULT OK
./uasm -zcw -zze -zt0 -zv0 -coff findAllPatterns.asm          # <= RESULT OK
./uasm -zcw -zze -zt0 -zv0 -elf findPattern.asm               # <= RESULT OK
./uasm -zcw -zze -zt0 -zv0 -elf findAllPatterns.asm           # <= RESULT ERROR
findAllPatterns.asm : Error A2169: General Failure

./jwasm -zcw -zze -zt0 -zv0 -coff findPattern.asm             # <= RESULT OK
./jwasm -zcw -zze -zt0 -zv0 -coff findAllPatterns.asm         # <= RESULT OK
./jwasm -zcw -zze -zt0 -zv0 -elf findPattern.asm              # <= RESULT OK
./jwasm -zcw -zze -zt0 -zv0 -elf findAllPatterns.asm          # <= RESULT ERROR
Warning A4109: Invalid command-line option: -zv0
Segmentation fault (core dumped)

Program received signal SIGSEGV, Segmentation fault.
__GI__IO_default_xsputn (n=<optimized out>, data=<optimized out>, f=<optimized out>) at ./libio/genops.c:394
394 ./libio/genops.c: No such file or directory.
(gdb) bt
#0  __GI__IO_default_xsputn (n=<optimized out>, data=<optimized out>, f=<optimized out>) at ./libio/genops.c:394
#1  __GI__IO_default_xsputn (f=f@entry=0x5555556088b0, data=<optimized out>, n=n@entry=4) at ./libio/genops.c:370
#2  0x00007ffff7c8b71b in _IO_new_file_xsputn (n=4, data=<optimized out>, f=<optimized out>) at ./libio/fileops.c:1264
#3  _IO_new_file_xsputn (f=0x5555556088b0, data=<optimized out>, n=4) at ./libio/fileops.c:1196
#4  0x00007ffff7c7ffd7 in __GI__IO_fwrite (buf=0x0, size=1, count=4, fp=0x5555556088b0) at ./libio/libioP.h:947
#5  0x000055555557e50f in elf_write_data ()
#6  0x000055555557eac8 in elf_write_module ()
#7  0x000055555555ffb1 in WriteModule ()
#8  0x0000555555561f80 in AssembleModule ()
#9  0x00005555555a3b5c in main ()

Sample: findPatterns.zip

john-terraspace commented 3 months ago

The problem with that file is that the data section has one variable, declared with ? instead of an actual value. Either supply a constant value or move it to a .data? section.