1 .syntax unified 2 .arch armv6t2 3 4 .macro define,name,type 5 .type \name,%gnu_indirect_function 6 \type 7\name: 8 mov pc,lr 9 .size \name,.-\name 10 .endm 11 12 .macro test_relocs,name,width 13 bl\width \name 14 b\width \name 15 beq\width \name 16 ldr r4,1f 17 ldr r4,2f 18 ldr r4,3f 19 ldr r4,4f 20 ldr r5,5f 21 movw r4,#:lower16:\name 22 movt r4,#:upper16:\name 231: 24 .word \name 252: 26 .word \name-. 273: 28 .word \name(GOTOFF) 294: 30 .word \name(GOT) 315: 32 .word \name(GOT_PREL) 33 .endm 34 35 define f1,.arm 36 define f2,.thumb_func 37 define f3,.arm 38 define f4,.thumb_func 39 40 .globl f5 41 .globl f6 42 .globl f7 43 .globl f8 44 45 define f5,.arm 46 define f6,.thumb_func 47 define f7,.arm 48 define f8,.thumb_func 49 50 .globl _start 51 .type _start,%function 52 .arm 53_start: 54 test_relocs foo 55 test_relocs f1, 56 test_relocs f2, 57 test_relocs f5, 58 test_relocs f6, 59 .size _start,.-_start 60 61 .globl _thumb 62 .type _thumb,%function 63 .thumb_func 64_thumb: 65 test_relocs foo 66 test_relocs f3,.w 67 test_relocs f4,.w 68 test_relocs f7,.w 69 test_relocs f8,.w 70 .size _thumb,.-_thumb 71 72 .data 73foo: 74 .word 0x11223344 75