1 .arch armv7-a 2 .global _start 3 .syntax unified 4 .text 5 .thumb 6 7 .macro do_calls 8 @ The following four instructions are accepted by gas, but generate 9 @ meaningless code. 10 @bl.w arm0 11 @bl.w arm4 12 @nop 13 @bl.w arm0 14 @bl.w arm4 15 @nop 16 blx.w arm0 17 blx.w arm4 18 nop 19 blx.w arm0 20 blx.w arm4 21 nop 22 bl.w thumb0 23 bl.w thumb2 24 bl.w thumb4 25 bl.w thumb6 26 nop 27 bl.w thumb0 28 bl.w thumb2 29 bl.w thumb4 30 bl.w thumb6 31 nop 32 @ These eight are all accepted by gas, but generate bad code. 33 @blx.w thumb0 34 @blx.w thumb2 35 @blx.w thumb4 36 @blx.w thumb6 37 @nop 38 @blx.w thumb0 39 @blx.w thumb2 40 @blx.w thumb4 41 @blx.w thumb6 42 .endm 43 44 .thumb_func 45 .align 3 46 _start: 47 do_calls 48 49 .arm 50 .align 3 51 arm0: 52 bx lr 53 54 .align 3 55 nop 56 arm4: 57 bx lr 58 59 .thumb 60 .thumb_func 61 .align 3 62 thumb0: 63 bx lr 64 65 .thumb_func 66 .align 3 67 nop 68 thumb2: 69 bx lr 70 71 .thumb_func 72 .align 3 73 nop 74 nop 75 thumb4: 76 bx lr 77 78 .thumb_func 79 .align 3 80 nop 81 nop 82 nop 83 thumb6: 84 bx lr 85 86 backwards: 87 do_calls 88