1# REQUIRES: hexagon
2# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
3# RUN: llvm-readobj -r %t.o | FileCheck -check-prefix=RELOC %s
4# RUN: ld.lld %t.o -o %t
5# RUN: ld.lld -shared %t.o -o %t.so
6# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t | FileCheck %s
7# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.so | FileCheck %s
8# RUN: llvm-readobj -x .got %t | FileCheck -check-prefix=GOT %s
9# RUN: llvm-readobj -x .got %t.so | FileCheck -check-prefix=GOT-SHARED %s
10# RUN: llvm-readobj -x .tdata %t | FileCheck -check-prefix=TDATA %s
11# RUN: llvm-readobj -x .tdata %t.so | FileCheck -check-prefix=TDATA %s
12# RUN: llvm-readobj -r %t | FileCheck -check-prefix=RELA %s
13# RUN: llvm-readobj -r %t.so | FileCheck -check-prefix=RELA-SHARED %s
14
15.globl _start
16.type _start, @function
17
18_start:
19# RELOC:      0x0 R_HEX_GD_GOT_32_6_X a 0x0
20# RELOC-NEXT: 0x4 R_HEX_GD_GOT_16_X a 0x0
21# CHECK:      {   immext(#0xfffeffc0)
22# CHECK-NEXT:     r0 = add(r1,##-0x10008) }
23                  r0 = add(r1, ##a@GDGOT)
24
25# RELOC:      0x8 R_HEX_GD_GOT_32_6_X a 0x0
26# RELOC-NEXT: 0xC R_HEX_GD_GOT_11_X a 0x0
27# CHECK-NEXT: {   immext(#0xfffeffc0)
28# CHECK-NEXT:     r0 = memw(r1+##-0x10008) }
29                  r0 = memw(r1+##a@GDGOT)
30
31# GOT: Hex dump of section '.got':
32# GOT-NEXT: 0x{{[0-9a-f]+}} 01000000 00000000
33
34# GOT-SHARED: Hex dump of section '.got':
35# GOT-SHARED-NEXT: 0x{{[0-9a-f]+}} 00000000 00000000
36
37# TDATA: Hex dump of section '.tdata':
38# TDATA-NEXT: 01000000
39
40# RELA: Relocations [
41# RELA-NEXT: ]
42
43# RELA-SHARED:      .rela.dyn {
44# RELA-SHARED-NEXT:   0x2024C R_HEX_DTPMOD_32 a 0x0
45# RELA-SHARED-NEXT:   0x20250 R_HEX_DTPREL_32 a 0x0
46# RELA-SHARED-NEXT: }
47
48.section        .tdata,"awT",@progbits
49.globl  a
50a:
51.word 1
52