Home | History | Annotate | Download | only in ld-arm
      1 @ Tests for group relocations.
      2 @
      3 @ Beware when editing this file: it is carefully crafted so that
      4 @ specific PC- and SB-relative offsets arise.
      5 @
      6 @ Note that the gas tests have already checked that group relocations are
      7 @ handled in the same way for local and external symbols.
      8 
      9 @ We will place .text at 0x8000.
     10 
     11 	.text
     12 	.globl _start
     13 
     14 _start:
     15 	@ ALU, PC-relative
     16 
     17 	@ Instructions start at .text + 0x0
     18 	add	r0, r15, #:pc_g0:(one_group_needed_alu_pc)
     19 
     20 	@ Instructions start at .text + 0x4
     21 	add	r0, r15, #:pc_g0_nc:(two_groups_needed_alu_pc)
     22 	add	r0, r0, #:pc_g1:(two_groups_needed_alu_pc + 4)
     23 
     24 	@ Instructions start at .text + 0xc
     25 	add	r0, r15, #:pc_g0_nc:(three_groups_needed_alu_pc)
     26 	add	r0, r0, #:pc_g1_nc:(three_groups_needed_alu_pc + 4)
     27 	add	r0, r0, #:pc_g2:(three_groups_needed_alu_pc + 8)
     28 
     29 	@ ALU, SB-relative
     30 
     31 	@ Instructions start at .text + 0x18
     32 	add	r0, r0, #:sb_g0:(one_group_needed_alu_sb)
     33 
     34 	@ Instructions start at .text + 0x1c
     35 	add	r0, r0, #:sb_g0_nc:(two_groups_needed_alu_sb)
     36 	add	r0, r0, #:sb_g1:(two_groups_needed_alu_sb)
     37 
     38 	@ Instructions start at .text + 0x24
     39 	add	r0, r0, #:sb_g0_nc:(three_groups_needed_alu_sb)
     40 	add	r0, r0, #:sb_g1_nc:(three_groups_needed_alu_sb)
     41 	add	r0, r0, #:sb_g2:(three_groups_needed_alu_sb)
     42 
     43 	@ LDR, PC-relative
     44 
     45 	@ Instructions start at .text + 0x30
     46 	add	r0, pc, #:pc_g0_nc:(two_groups_needed_ldr_pc)
     47 	ldr	r1, [r0, #:pc_g1:(two_groups_needed_ldr_pc + 4)]
     48 
     49 	@ Instructions start at .text + 0x38
     50 	add	r0, pc, #:pc_g0_nc:(three_groups_needed_ldr_pc)
     51 	add	r0, r0, #:pc_g1_nc:(three_groups_needed_ldr_pc + 4)
     52 	ldr	r1, [r0, #:pc_g2:(three_groups_needed_ldr_pc + 8)]
     53 
     54 	@ LDR, SB-relative
     55 
     56 	@ Instructions start at .text + 0x44
     57 	ldr	r1, [r0, #:sb_g0:(one_group_needed_ldr_sb)]
     58 
     59 	@ Instructions start at .text + 0x48
     60 	add	r0, r0, #:sb_g0_nc:(two_groups_needed_ldr_sb)
     61 	ldr	r1, [r0, #:sb_g1:(two_groups_needed_ldr_sb)]
     62 
     63 	@ Instructions start at .text + 0x50
     64 	add	r0, r0, #:sb_g0_nc:(three_groups_needed_ldr_sb)
     65 	add	r0, r0, #:sb_g1_nc:(three_groups_needed_ldr_sb)
     66 	ldr	r1, [r0, #:sb_g2:(three_groups_needed_ldr_sb)]
     67 
     68 	@ LDRS, PC-relative
     69 
     70 	@ Instructions start at .text + 0x5c
     71 	ldrd	r2, [pc, #:pc_g0:(one_group_needed_ldrs_pc)]
     72 
     73 	@ Instructions start at .text + 0x60
     74 	add	r0, pc, #:pc_g0_nc:(two_groups_needed_ldrs_pc)
     75 	ldrd	r2, [r0, #:pc_g1:(two_groups_needed_ldrs_pc + 4)]
     76 
     77 	@ Instructions start at .text + 0x68
     78 	add	r0, pc, #:pc_g0_nc:(three_groups_needed_ldrs_pc)
     79 	add	r0, r0, #:pc_g1_nc:(three_groups_needed_ldrs_pc + 4)
     80 	ldrd	r2, [r0, #:pc_g2:(three_groups_needed_ldrs_pc + 8)]
     81 
     82 	@ LDRS, SB-relative
     83 
     84 	@ Instructions start at .text + 0x74
     85 	ldrd	r2, [r0, #:sb_g0:(one_group_needed_ldrs_sb)]
     86 
     87 	@ Instructions start at .text + 0x78
     88 	add	r0, r0, #:sb_g0_nc:(two_groups_needed_ldrs_sb)
     89 	ldrd	r2, [r0, #:sb_g1:(two_groups_needed_ldrs_sb)]
     90 
     91 	@ Instructions start at .text + 0x80
     92 	add	r0, r0, #:sb_g0_nc:(three_groups_needed_ldrs_sb)
     93 	add	r0, r0, #:sb_g1_nc:(three_groups_needed_ldrs_sb)
     94 	ldrd	r2, [r0, #:sb_g2:(three_groups_needed_ldrs_sb)]
     95 
     96 	@ LDC, PC-relative
     97 
     98 	@ Instructions start at .text + 0x8c
     99 	ldc	0, c0, [pc, #:pc_g0:(one_group_needed_ldc_pc)]
    100 
    101 	@ Instructions start at .text + 0x90
    102 	add	r0, pc, #:pc_g0_nc:(two_groups_needed_ldc_pc)
    103 	ldc	0, c0, [r0, #:pc_g1:(two_groups_needed_ldc_pc + 4)]
    104 
    105 	@ Instructions start at .text + 0x98
    106 	add	r0, pc, #:pc_g0_nc:(three_groups_needed_ldc_pc)
    107 	add	r0, r0, #:pc_g1_nc:(three_groups_needed_ldc_pc + 4)
    108 	ldc	0, c0, [r0, #:pc_g2:(three_groups_needed_ldc_pc + 8)]
    109 
    110 	@ LDC, SB-relative
    111 
    112 	@ Instructions start at .text + 0xa4
    113 	ldc	0, c0, [r0, #:sb_g0:(one_group_needed_ldc_sb)]
    114 
    115 	@ Instructions start at .text + 0xa8
    116 	add	r0, r0, #:sb_g0_nc:(two_groups_needed_ldc_sb)
    117 	ldc	0, c0, [r0, #:sb_g1:(two_groups_needed_ldc_sb)]
    118 
    119 	@ Instructions start at .text + 0xb0
    120 	add	r0, r0, #:sb_g0_nc:(three_groups_needed_ldc_sb)
    121 	add	r0, r0, #:sb_g1_nc:(three_groups_needed_ldc_sb)
    122 	ldc	0, c0, [r0, #:sb_g2:(three_groups_needed_ldc_sb)]
    123 
    124 @ This point in the file is .text + 0xbc.
    125 
    126 one_group_needed_alu_pc:
    127 one_group_needed_ldrs_pc:
    128 one_group_needed_ldc_pc:
    129 	mov	r0, #0
    130 
    131 @ We will place the section .data at 0x03000000
    132 
    133 	.data
    134 
    135 	.word 0, 0, 0
    136 one_group_needed_alu_sb:
    137 one_group_needed_ldr_sb:
    138 one_group_needed_ldrs_sb:
    139 one_group_needed_ldc_sb:
    140 	.word 1				@ Offset 0xc
    141 	.fill 0xeef0 - 16, 1, 0
    142 two_groups_needed_alu_sb:
    143 two_groups_needed_ldr_sb:
    144 two_groups_needed_ldrs_sb:
    145 two_groups_needed_ldc_sb:
    146 	.word 2				@ Offset 0xeef0
    147 	.fill 0xffeef0 - 0xeef0 - 4, 1, 0
    148 three_groups_needed_alu_sb:
    149 three_groups_needed_ldr_sb:
    150 three_groups_needed_ldrs_sb:
    151 three_groups_needed_ldc_sb:
    152 	.word 3				@ Offset 0xffeef0
    153 
    154 @ We will place the section alpha at 0xeef0.
    155 
    156 	.section alpha, "x"
    157 
    158 two_groups_needed_alu_pc:
    159 two_groups_needed_ldr_pc:
    160 two_groups_needed_ldrs_pc:
    161 two_groups_needed_ldc_pc:
    162 	mov	r0, #0
    163 
    164 @ We will place the section beta at 0xffeef0.
    165 
    166 	.section beta, "x"
    167 
    168 three_groups_needed_alu_pc:
    169 three_groups_needed_ldr_pc:
    170 three_groups_needed_ldrs_pc:
    171 three_groups_needed_ldc_pc:
    172 	mov	r0, #0
    173 
    174