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 define2,name 13 define aa\name,.arm 14 define at\name,.arm 15 define ab\name,.arm 16 define ta\name,.thumb_func 17 define tt\name,.thumb_func 18 define tb\name,.thumb_func 19 .endm 20 21 .macro test_relocs,name,width 22 bl \name(PLT) 23 b\width \name 24 beq\width \name 25 ldr r4,1f 26 ldr r4,2f 271: 28 .word \name(GOT) 292: 30 .word \name(GOT_PREL) 31 .endm 32 33 .macro test_relocs2,name,type,width 34 test_relocs a\type\name,\width 35 test_relocs t\type\name,\width 36 test_relocs ab\name,\width 37 test_relocs tb\name,\width 38 .endm 39 40 .macro diff,name 41 .word \name 42 .word \name-. 43 .endm 44 45 .macro alldirs,doit,name 46 \doit aa\name 47 \doit at\name 48 \doit ab\name 49 \doit ta\name 50 \doit tt\name 51 \doit tb\name 52 .endm 53 54 define2 f1 55 # f2 provided by ifunc-4.so 56 define2 f3 57 # f4 provided by ifunc-4.so 58 59 alldirs .globl,f3 60 alldirs .hidden,f3 61 62 .globl _start 63 .type _start,%function 64 .arm 65_start: 66 test_relocs foo 67 test_relocs2 f1,a, 68 test_relocs2 f2,a, 69 test_relocs2 f3,a, 70 test_relocs2 f4,a, 71 .size _start,.-_start 72 73 .globl _thumb 74 .type _thumb,%function 75 .thumb_func 76_thumb: 77 test_relocs foo 78 test_relocs2 f1,t,.w 79 test_relocs2 f2,t,.w 80 test_relocs2 f3,t,.w 81 test_relocs2 f4,t,.w 82 .size _thumb,.-_thumb 83 84 .data 85foo: 86 .word 0x11223344 87 alldirs diff,f1 88 alldirs diff,f2 89 alldirs diff,f3 90 alldirs diff,f4 91