1// An example of thunk generation that takes the maximum number of permitted 2// passes to converge. We start with a set of branches of which all but one are 3// in range. Any thunk added to extend the range of a branch is inserted in 4// between the branches and the targets which knocks some more branches out 5// of range. At the end of 9 passes of createThunks() every branch has a 6// range extension thunk, allowing the final pass to check that no more thunks 7// are required. 8// 9// As the size of the .text section changes 9 times, the symbol sym which 10// depends on the size of .text will be updated 9 times. This test checks that 11// any iteration limit to updating symbols does not limit thunk convergence. 12// up to its pass limit without 13 14 .thumb 15 .section .text.00, "ax", %progbits 16 .globl _start 17 .thumb_func 18_start: b.w f2 19 b.w f2 20 b.w f3 21 b.w f3 22 b.w f4 23 b.w f4 24 b.w f5 25 b.w f5 26 b.w f6 27 b.w f6 28 b.w f7 29 b.w f7 30 b.w f8 31 b.w f8 32 b.w f9 33 b.w f9 34 b.w f10 35 b.w f10 36 37 .section .text.01, "ax", %progbits 38 .space 14 * 1024 * 1024 39// Thunks are inserted here, initially only 1 branch is out of range and needs 40// a thunk. However the added thunk is 4-bytes in size which makes another 41// branch out of range, which adds another thunk ... 42 .section .text.02, "ax", %progbits 43 .space (2 * 1024 * 1024) - 68 44 .thumb_func 45f2: bx lr 46 nop 47 .thumb_func 48f3: bx lr 49 nop 50 .thumb_func 51f4: bx lr 52 nop 53 .thumb_func 54f5: bx lr 55 nop 56 .thumb_func 57f6: bx lr 58 nop 59 .thumb_func 60f7: bx lr 61 nop 62 .thumb_func 63f8: bx lr 64 nop 65 .thumb_func 66f9: bx lr 67 nop 68 .thumb_func 69f10: bx lr 70 nop 71