Saturday, November 21, 2009

I found a bug in the compiler. There is an overflow problem in the displacement calculation for jmp instructions. I found a case where I have a "jmp -310" which is not caught by the linker. This case compiles to 1064 -> "jmp 200".

6484: 10 64 jmp 200 # jmp print_final
Destination: 0000634e :

So this should be jmp -0x136 (-310) which is too big...
-0x136/2 = -0x9B = -155 =0xFF65

This seems to be fixed by making changs to binutils/bfc/elf32-tms99900.c. I'm now using "complain_overflow_signed" for these relocations.

No comments:

Post a Comment