Closed skeetor closed 4 years ago
I changed the code back to use beq toBinary
and built everything:
m68k-amigaos-objdump -dr bin/IntegerMathCPP | less
...
0000023a uWordToString:
23a: 2248 movea.l a0,a1
23c: d3c1 adda.l d1,a1
23e: 7200 moveq #0,d1
240: 3200 move.w d0,d1
242: 2001 move.l d1,d0
244: 6700 01da beq.w 420 toBinary
248: b47c 0010 cmp.w #16,d2
24c: 6606 bne.s 254 uWordToString+0x1a
24e: 4ef9 0000 040e jmp 40e toHex
250: RELOC32 .text
254: b47c 0002 cmp.w #2,d2
258: 6700 01c6 beq.w 420 toBinary
25c: 6d64 blt.s 2c2 uWordToString+0x88
25e: b47c 0008 cmp.w #8,d2
262: 6606 bne.s 26a uWordToString+0x30
264: 4ef9 0000 0414 jmp 414 toOct
and I see no error.
This is my linker line: m68k-amigaos-g++ --save-temps -Wall -pedantic -mcrt=nix13 -fno-exceptions -fno-rtti -O2 -mregparm -O3 -DNDEBUG CMakeFiles/IntegerMathCPP.dir/main.cpp.o -o ../bin/IntegerMathCPP.exe -Wl,--out-implib,../bin/libIntegerMathCPP.dll.a -L/opt/amiga/utils/lib -lAmigaUtils -lAmigaGCCUtils
I attached the binary, which crashes due to that:
uWordToString::
move.l a0,a1
add.l d1,a1 ; End of buffer
moveq #0,d1
move.w d0,d1
move.l d1,d0
; Reported as out of bounds, as it should be
;beq.s toBinary
; Not reported if out of bounds.
beq toBinary
;bne.s .CheckBase
;jmp toBinary
.CheckBase:
cmp.w #16,d2
bne.s .NotBase16
jmp toHex
so either your linker is different or your assembled word_to_string.s
.
When I link the ASM project, vlink is used, and in this case the resulting instruction is correct. I can update my gcc installation and see if there is a difference.
Finally I upgraded my gcc to the latest git and it seems to work now. Close.
A similar issue was already fixed with https://github.com/bebbo/binutils-gdb/issues/10 but now I found another issue using word sized operands. I posted the details in http://eab.abime.net/showthread.php?p=1375468#post1375468