|
1 | 1 | # REQUIRES: hexagon
|
2 | 2 | # RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
|
3 | 3 | # RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %S/Inputs/hexagon.s -o %t1.o
|
4 |
| -# RUN: ld.lld %t.o %t1.o -o %t |
| 4 | +# RUN: ld.lld %t.o %t1.o -o %t --Ttext=0x200b4 --section-start=b_1000000=0x1000000 \ |
| 5 | +# RUN: --section-start=b_1000400=0x1000400 --section-start=b_1004000=0x1004000 \ |
| 6 | +# RUN: --section-start=b_1010000=0x1010000 --section-start=b_1800000=0x1800000 |
5 | 7 | # RUN: llvm-objdump --no-print-imm-hex -d %t | FileCheck %s
|
6 | 8 |
|
7 | 9 | # Note: 131584 == 0x20200
|
@@ -221,3 +223,40 @@ r0 = memw(r1+##_start)
|
221 | 223 |
|
222 | 224 | memw(r0+##_start) = r1
|
223 | 225 | # CHECK: memw(r0+##131644) = r1
|
| 226 | + |
| 227 | + |
| 228 | +## Tests for maximum branch ranges reachable without trampolines. |
| 229 | + |
| 230 | +.section b_1000000, "ax" |
| 231 | +## The nop makes sure the first jump is within range. |
| 232 | +nop |
| 233 | +{ r0 = #0; jump #b_1000400 } // R_HEX_B9_PCREL |
| 234 | +if (r0==#0) jump:t #b_1004000 // R_HEX_B13_PCREL |
| 235 | +if (p0) jump #b_1010000 // R_HEX_B15_PCREL |
| 236 | +jump #b_1800000 // R_HEX_B22_PCREL |
| 237 | + |
| 238 | +.section b_1000400, "ax" |
| 239 | +nop |
| 240 | + |
| 241 | +.section b_1004000, "ax" |
| 242 | +nop |
| 243 | + |
| 244 | +.section b_1010000, "ax" |
| 245 | +nop |
| 246 | + |
| 247 | +.section b_1800000, "ax" |
| 248 | +nop |
| 249 | + |
| 250 | +## Make sure we got the right relocations. |
| 251 | +# RUN: llvm-readelf -r %t.o | FileCheck %s --check-prefix=REL |
| 252 | +# REL: R_HEX_B9_PCREL 00000000 b_1000400 |
| 253 | +# REL: R_HEX_B13_PCREL 00000000 b_1004000 |
| 254 | +# REL: R_HEX_B15_PCREL 00000000 b_1010000 |
| 255 | +# REL: R_HEX_B22_PCREL 00000000 b_1800000 |
| 256 | + |
| 257 | +# CHECK: 01000000 <b_1000000>: |
| 258 | +# CHECK-NEXT: 1000000: {{.*}} { nop } |
| 259 | +# CHECK-NEXT: 1000004: {{.*}} { r0 = #0 ; jump 0x1000400 } |
| 260 | +# CHECK-NEXT: 1000008: {{.*}} { if (r0==#0) jump:t 0x1004000 } |
| 261 | +# CHECK-NEXT: 100000c: {{.*}} { if (p0) jump:nt 0x1010000 } |
| 262 | +# CHECK-NEXT: 1000010: {{.*}} { jump 0x1800000 } |
0 commit comments