1;;; Bug #1825: gas assemble PC-relative indexed addressing modes incorrectly 2;;; http://savannah.gnu.org/bugs/?func=detailbug&bug_id=1825&group_id=2424 3;;; 4 .sect .text 5 .globl _main 6_main: 7 nop 8 ldx L1,pc ; Assemble to 5-bit > 0 offset 9 bra L2 10L1: 11 .dc.w 0xaabb 12L2: 13 subd L1,pc ; Assemble to 5-bit < 0 offset 14L3: 15 .ds.b 14, 0xA7 16 ldab L3,pc ; 5-bit < 0 offset 17 ldab L4,pc ; 5-bit > 0 offset 18 .skip 15 19L4: 20 .skip 128 21 subd L4,pc ; 9-bit < 0 offset 22 addd L5,pc ; 9-bit > 0 offset 23 .skip 128 24L5: 25 .skip 256-3 26 orab L5,pc ; 9 bit < 0 offset (min value) 27 oraa L6,pc ; 9 bit > 0 offset (max value) 28 .skip 255 29L6: 30 .skip 256-2 31 orab L6,pc ; 16 bit < 0 offset 32 anda _main,pc ; 16 bit < 0 offset 33 andb L7,pc 34 .skip 256 35L7: 36 stab external,pc ; External 16-bit PCREL 37 ldd _table,pc 38 addd _table+2,pc 39 subd _table+4,pc 40 addd _table+8,pc 41 addd _table+12,pc 42 addd _table+16,pc 43 rts 44 nop 45_table: 46 .ds.b 16,0 47 leax _table,sp ; 16-bit absolute reloc 48 leay _table,x 49 leax _table,y 50