2010-10-18 16:38:04 +00:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -o - | elf-dump | FileCheck %s
|
|
|
|
|
2010-10-18 16:58:03 +00:00
|
|
|
// Test that we produce the correct relocation types and that the relocation
|
|
|
|
// to .Lfoo uses the symbol and not the section.
|
2010-10-18 16:38:04 +00:00
|
|
|
|
2010-10-18 20:25:33 +00:00
|
|
|
// Section 3 is bss
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK: # Section 0x00000003
|
|
|
|
// CHECK-NEXT: (('sh_name', 0x0000000d) # '.bss'
|
2010-10-18 16:38:04 +00:00
|
|
|
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK: # Symbol 0x00000001
|
|
|
|
// CHECK-NEXT: (('st_name', 0x00000005) # '.Lfoo'
|
2010-10-18 16:38:04 +00:00
|
|
|
|
2010-10-18 20:25:33 +00:00
|
|
|
// Symbol 6 is section 3
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK: # Symbol 0x00000006
|
|
|
|
// CHECK-NEXT: (('st_name', 0x00000000) # ''
|
|
|
|
// CHECK-NEXT: ('st_value', 0x00000000)
|
|
|
|
// CHECK-NEXT: ('st_size', 0x00000000)
|
|
|
|
// CHECK-NEXT: ('st_bind', 0x00000000)
|
|
|
|
// CHECK-NEXT: ('st_type', 0x00000003)
|
|
|
|
// CHECK-NEXT: ('st_other', 0x00000000)
|
|
|
|
// CHECK-NEXT: ('st_shndx', 0x00000003)
|
2010-10-18 20:25:33 +00:00
|
|
|
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK: # Relocation 0x00000000
|
|
|
|
// CHECK-NEXT: (('r_offset', 0x00000002)
|
|
|
|
// CHECK-NEXT: ('r_sym', 0x00000001)
|
|
|
|
// CHECK-NEXT: ('r_type', 0x00000009)
|
2010-10-18 16:58:03 +00:00
|
|
|
// CHECK-NEXT: ),
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK-NEXT: # Relocation 0x00000001
|
2010-10-18 16:58:03 +00:00
|
|
|
// CHECK-NEXT: (('r_offset',
|
|
|
|
// CHECK-NEXT: ('r_sym',
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK-NEXT: ('r_type', 0x00000004)
|
2010-10-18 18:36:12 +00:00
|
|
|
// CHECK-NEXT: ),
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK-NEXT: # Relocation 0x00000002
|
2010-10-18 18:36:12 +00:00
|
|
|
// CHECK-NEXT: (('r_offset',
|
|
|
|
// CHECK-NEXT: ('r_sym',
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK-NEXT: ('r_type', 0x0000000a)
|
2010-10-18 20:25:33 +00:00
|
|
|
// CHECK-NEXT: ),
|
|
|
|
|
2010-10-18 20:47:21 +00:00
|
|
|
// Relocation 3 (bar3@GOTOFF) is done with symbol 6 (bss)
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK-NEXT: # Relocation 0x00000003
|
2010-10-18 20:25:33 +00:00
|
|
|
// CHECK-NEXT: (('r_offset',
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK-NEXT: ('r_sym', 0x00000006
|
2010-10-18 20:25:33 +00:00
|
|
|
// CHECK-NEXT: ('r_type',
|
2010-10-18 20:47:21 +00:00
|
|
|
// CHECK-NEXT: ),
|
|
|
|
|
|
|
|
// Relocation 4 (bar2@GOT) is of type R_386_GOT32
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK-NEXT: # Relocation 0x00000004
|
2010-10-18 20:47:21 +00:00
|
|
|
// CHECK-NEXT: (('r_offset',
|
|
|
|
// CHECK-NEXT: ('r_sym',
|
2010-10-19 17:39:10 +00:00
|
|
|
// CHECK-NEXT: ('r_type', 0x00000003
|
2010-10-18 18:36:12 +00:00
|
|
|
// CHECK-NEXT: ),
|
2010-10-18 16:38:04 +00:00
|
|
|
|
|
|
|
.text
|
|
|
|
bar:
|
|
|
|
leal .Lfoo@GOTOFF(%ebx), %eax
|
2010-10-18 16:58:03 +00:00
|
|
|
|
|
|
|
.global bar2
|
|
|
|
bar2:
|
|
|
|
calll bar2@PLT
|
2010-10-18 18:36:12 +00:00
|
|
|
addl $_GLOBAL_OFFSET_TABLE_, %ebx
|
2010-10-18 20:25:33 +00:00
|
|
|
movb bar3@GOTOFF(%ebx), %al
|
|
|
|
|
|
|
|
.type bar3,@object
|
|
|
|
.local bar3
|
|
|
|
.comm bar3,1,1
|
2010-10-18 16:58:03 +00:00
|
|
|
|
2010-10-18 20:47:21 +00:00
|
|
|
movl bar2j@GOT(%eax), %eax
|
|
|
|
|
2010-10-18 16:58:03 +00:00
|
|
|
.section .rodata.str1.16,"aMS",@progbits,1
|
2010-10-18 16:38:04 +00:00
|
|
|
.Lfoo:
|
|
|
|
.asciz "bool llvm::llvm_start_multithreaded()"
|