• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -h -s -r -t | FileCheck %s
2
3        .text
4	.globl	main
5	.align	16, 0x90
6	.type	main,@function
7main:                                   # @main
8# %bb.0:
9	subq	$8, %rsp
10	movl	$.L.str1, %edi
11	callq	puts
12	movl	$.L.str2, %edi
13	callq	puts
14	xorl	%eax, %eax
15	addq	$8, %rsp
16    call foo@GOTPCREL
17	ret
18.Ltmp0:
19	.size	main, .Ltmp0-main
20
21	.type	.L.str1,@object         # @.str1
22	.section	.rodata.str1.1,"aMS",@progbits,1
23.L.str1:
24	.asciz	 "Hello"
25	.size	.L.str1, 6
26
27	.type	.L.str2,@object         # @.str2
28.L.str2:
29	.asciz	 "World!"
30	.size	.L.str2, 7
31
32	.section	.note.GNU-stack,"",@progbits
33
34// CHECK: ElfHeader {
35// CHECK:   Class: 64-bit
36// CHECK:   DataEncoding: LittleEndian
37// CHECK:   FileVersion: 1
38// CHECK: }
39// CHECK: Sections [
40// CHECK:   Section {
41// CHECK:     Index: 0
42// CHECK:     Name: (0)
43
44// CHECK:     Name: .text
45
46// CHECK:     Name: .rela.text
47
48// CHECK:      Relocations [
49// CHECK:        Section {{.*}} .rela.text {
50// CHECK-NEXT:     0x5  R_X86_64_32   .rodata.str1.1 0x0
51// CHECK-NEXT:     0xA  R_X86_64_PLT32 puts           0xFFFFFFFFFFFFFFFC
52// CHECK-NEXT:     0xF  R_X86_64_32   .rodata.str1.1 0x6
53// CHECK-NEXT:     0x14 R_X86_64_PLT32 puts           0xFFFFFFFFFFFFFFFC
54// CHECK-NEXT:     0x1F R_X86_64_GOTPCREL foo 0xFFFFFFFFFFFFFFFC
55// CHECK-NEXT:   }
56// CHECK-NEXT: ]
57
58// CHECK:   Symbol {
59// CHECK:     Binding: Local
60// CHECK:     Type: Section
61
62// CHECK:   Symbol {
63// CHECK:     Name: main
64// CHECK:     Binding: Global
65// CHECK:     Type: Function
66// CHECK:  }
67
68// CHECK:   Symbol {
69// CHECK:     Name: puts
70// CHECK:     Binding: Global
71// CHECK:     Type: None
72// CHECK:  }
73