• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
2# RUN: llvm-readobj -r %t.o | FileCheck %s --check-prefixes=CHECK,COMMON
3# RUN: llvm-mc -filetype=obj -triple=x86_64 -relax-relocations=false %s -o %t1.o
4# RUN: llvm-readobj -r %t1.o | FileCheck %s --check-prefixes=NORELAX,COMMON
5
6# COMMON:     Relocations [
7# COMMON-NEXT:  Section ({{.*}}) .rela.text {
8# CHECK-NEXT:     R_X86_64_GOTPCRELX mov
9# CHECK-NEXT:     R_X86_64_GOTPCRELX test
10# CHECK-NEXT:     R_X86_64_GOTPCRELX adc
11# CHECK-NEXT:     R_X86_64_GOTPCRELX add
12# CHECK-NEXT:     R_X86_64_GOTPCRELX and
13# CHECK-NEXT:     R_X86_64_GOTPCRELX cmp
14# CHECK-NEXT:     R_X86_64_GOTPCRELX or
15# CHECK-NEXT:     R_X86_64_GOTPCRELX sbb
16# CHECK-NEXT:     R_X86_64_GOTPCRELX sub
17# CHECK-NEXT:     R_X86_64_GOTPCRELX xor
18# CHECK-NEXT:     R_X86_64_GOTPCRELX call
19# CHECK-NEXT:     R_X86_64_GOTPCRELX jmp
20# CHECK-NEXT:   }
21
22# NORELAX-NEXT:     R_X86_64_GOTPCREL mov
23# NORELAX-NEXT:     R_X86_64_GOTPCREL test
24# NORELAX-NEXT:     R_X86_64_GOTPCREL adc
25# NORELAX-NEXT:     R_X86_64_GOTPCREL add
26# NORELAX-NEXT:     R_X86_64_GOTPCREL and
27# NORELAX-NEXT:     R_X86_64_GOTPCREL cmp
28# NORELAX-NEXT:     R_X86_64_GOTPCREL or
29# NORELAX-NEXT:     R_X86_64_GOTPCREL sbb
30# NORELAX-NEXT:     R_X86_64_GOTPCREL sub
31# NORELAX-NEXT:     R_X86_64_GOTPCREL xor
32# NORELAX-NEXT:     R_X86_64_GOTPCREL call
33# NORELAX-NEXT:     R_X86_64_GOTPCREL jmp
34# NORELAX-NEXT:   }
35
36movl mov@GOTPCREL(%rip), %eax
37test %eax, test@GOTPCREL(%rip)
38adc adc@GOTPCREL(%rip), %eax
39add add@GOTPCREL(%rip), %eax
40and and@GOTPCREL(%rip), %eax
41cmp cmp@GOTPCREL(%rip), %eax
42or  or@GOTPCREL(%rip), %eax
43sbb sbb@GOTPCREL(%rip), %eax
44sub sub@GOTPCREL(%rip), %eax
45xor xor@GOTPCREL(%rip), %eax
46call *call@GOTPCREL(%rip)
47jmp *jmp@GOTPCREL(%rip)
48
49# COMMON-NEXT:   Section ({{.*}}) .rela.norelax {
50# COMMON-NEXT:     R_X86_64_GOTPCREL mov 0x0
51# COMMON-NEXT:     R_X86_64_GOTPCREL mov 0xFFFFFFFFFFFFFFFC
52# COMMON-NEXT:   }
53# COMMON-NEXT: ]
54
55.section .norelax,"ax",@progbits
56## Clang may emit this expression to load the high 32-bit of the GOT entry.
57## Don't emit R_X86_64_GOTPCRELX.
58movl mov@GOTPCREL+4(%rip), %eax
59## We could emit R_X86_64_GOTPCRELX, but it is probably unnecessary.
60movl mov@GOTPCREL+0(%rip), %eax
61