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## shared needs -z notext because of the R_HEX_IE_16/32_X(R_GOT) static
6## relocations
7# RUN: ld.lld -z notext -shared %t.o -o %t.so
8# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t | FileCheck %s
9# RUN:  llvm-readobj -x .got %t | FileCheck -check-prefix=GOT %s
10# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.so | \
11# RUN: FileCheck -check-prefix=SHARED %s
12# RUN: llvm-readobj -r  %t.so | FileCheck -check-prefix=RELA %s
13
14	.globl	_start
15	.type	_start, @function
16_start:
17
18# RELOC:      0x0 R_HEX_IE_32_6_X a 0x0
19# RELOC-NEXT: 0x4 R_HEX_IE_16_X a 0x0
20# CHECK:      {   immext(#0x30180)
21# CHECK-NEXT:     r2 = memw(##0x301a4) }
22                  r2 = memw(##a@IE)
23
24# RELOC-NEXT: 0x8 R_HEX_IE_LO16 a 0x0
25# CHECK: {       r2.l = #0x1a4 }
26                 r2.l = #a@IE
27# RELOC-NEXT: 0xC R_HEX_IE_HI16 a 0x0
28# CHECK: {       r2.h = #0x3 }
29                 r2.h = #a@IE
30
31
32# GOT: Hex dump of section '.got':
33# GOT-NEXT: 0x000301a4 f0ffffff f4ffffff f8ffffff fcffffff
34                 r2 = memw(##a@IE)
35                 r2 = memw(##b@IE)
36                 r2 = memw(##c@IE)
37                 r2 = memw(##d@IE)
38
39# RELOC:      0x30 R_HEX_IE_GOT_32_6_X a 0x0
40# RELOC-NEXT: 0x34 R_HEX_IE_GOT_16_X a 0x0
41# SHARED:      { immext(#0xfffeffc0)
42# SHARED-NEXT:   r2 = memw(##0xfffefff0) }
43                 r2 = memw(##a@IEGOT)
44
45# RELOC-NEXT: 0x38 R_HEX_IE_GOT_LO16 a 0x0
46# SHARED: {     r2.l = #0xfff0 }
47                r2.l = #a@IEGOT
48# RELOC-NEXT: 0x3C R_HEX_IE_GOT_HI16 a 0x0
49# SHARED: {     r2.h = #0xfffe }
50                r2.h = #a@IEGOT
51
52# RELOC:      0x44 R_HEX_IE_GOT_11_X a 0x0
53# SHARED:    {  immext(#0xfffeffc0)
54# SHARED-NEXT:  r0 = !cmp.eq(r1,##-0x10010) }
55                r0=!cmp.eq(r1,##a@iegot)
56
57# RELA:       0x203C4 R_HEX_TPREL_32 a 0x0
58# RELA-NEXT:  0x203C8 R_HEX_TPREL_32 b 0x0
59# RELA-NEXT:  0x203CC R_HEX_TPREL_32 c 0x0
60# RELA-NEXT:  0x203D0 R_HEX_TPREL_32 d 0x0
61                r2 = memw(##b@IEGOT)
62                r2 = memw(##c@IEGOT)
63                r2 = memw(##d@IEGOT)
64
65
66.section        .tdata,"awT",@progbits
67.globl  a
68a:
69.word 1
70.globl  b
71b:
72.word 2
73.globl  c
74c:
75.word 3
76.globl  d
77d:
78.word 4
79