llvm-mos / llvm-mos-sdk

SDK for developing with the llvm-mos compiler
https://www.llvm-mos.org
Other
266 stars 53 forks source link

Assembling invalid 6502 op-code without error message. #235

Closed iss000 closed 10 months ago

iss000 commented 10 months ago

While fixing a bug in cpm65 I found an issue with llvm-mos-sdk. Here is the sample code:

;  Run test:
;  --------
; ; /opt/bin/mos-cpm65-clang -Os -g -c -o test.o test.S
; ; /opt/bin/llvm-objdump -S test.o
;
; Result:
; ------
; ; test.o: file format elf32-mos
; ; Disassembly of section .text:
; ; 00000000 <test>:
; ; ;       stx test, y
; ;        0: 9b            <unknown>
; ;        1: 00            brk
; ;        2: 00            brk
; ; ;       rts
; ;        3: 60            rts

test:
      stx test, y
      rts

Compilation passes without error, while if constant is given:

test:
      stx 0x1000, y
      rts

there is a proper error message:

test.S:19:7: error: instruction requires a CPU feature not currently enabled
      stx 0x1000, y
      ^

FYI, v.4.x silently compiles the code as stx zp,y :).

asiekierka commented 10 months ago

Duplicate of https://github.com/llvm-mos/llvm-mos/issues/354

iss000 commented 10 months ago

OK, it took me 1 whole day investigation :+1: . Closing and waiting #354 to be resolved.