File: dynamic-reloc.s

package info (click to toggle)
llvm-toolchain-7 1%3A7.0.1-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 733,456 kB
  • sloc: cpp: 3,776,651; ansic: 633,271; asm: 350,301; python: 142,716; objc: 107,612; sh: 22,626; lisp: 11,056; perl: 7,999; pascal: 6,742; ml: 5,537; awk: 3,536; makefile: 2,557; cs: 2,027; xml: 841; ruby: 156
file content (65 lines) | stat: -rw-r--r-- 2,173 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/dynamic-reloc.s -o %t3.o
// RUN: ld.lld -shared %t2.o -o %t2.so
// RUN: ld.lld --hash-style=sysv %t.o %t3.o %t2.so -o %t
// RUN: llvm-readobj -dynamic-table -r --expand-relocs -s %t | FileCheck %s

// CHECK:      Index: 1
// CHECK-NEXT: Name: .dynsym

// CHECK:      Name: .rela.plt
// CHECK-NEXT: Type: SHT_RELA
// CHECK-NEXT: Flags [
// CHECK-NEXT:   SHF_ALLOC
// CHECK-NEXT: ]
// CHECK-NEXT: Address: [[RELAADDR:.*]]
// CHECK-NEXT: Offset:
// CHECK-NEXT: Size: [[RELASIZE:.*]]
// CHECK-NEXT: Link: 1
// CHECK-NEXT: Info: 0
// CHECK-NEXT: AddressAlignment: 8
// CHECK-NEXT: EntrySize: 24

// CHECK:      Name: .text
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT:   SHF_ALLOC
// CHECK-NEXT:   SHF_EXECINSTR
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x201000

// CHECK:      Relocations [
// CHECK-NEXT:   Section ({{.*}}) .rela.plt {
// CHECK-NEXT:     Relocation {
// CHECK-NEXT:       Offset: 0x202018
// CHECK-NEXT:       Type: R_X86_64_JUMP_SLOT
// CHECK-NEXT:       Symbol: bar
// CHECK-NEXT:       Addend: 0x0
// CHECK-NEXT:     }
// CHECK-NEXT:   }
// CHECK-NEXT: ]

// CHECK: DynamicSection [
// CHECK-NEXT:  Tag                Type                 Name/Value
// CHECK-NEXT:  0x0000000000000001 NEEDED               Shared library: [{{.*}}2.so]
// CHECK-NEXT:  0x0000000000000015 DEBUG                0x0
// CHECK-NEXT:  0x0000000000000017 JMPREL
// CHECK-NEXT:  0x0000000000000002 PLTRELSZ             24 (bytes)
// CHECK-NEXT:  0x0000000000000003 PLTGOT
// CHECK-NEXT:  0x0000000000000014 PLTREL               RELA
// CHECK-NEXT:  0x0000000000000006 SYMTAB
// CHECK-NEXT:  0x000000000000000B SYMENT               24 (bytes)
// CHECK-NEXT:  0x0000000000000005 STRTAB
// CHECK-NEXT:  0x000000000000000A STRSZ
// CHECK-NEXT:  0x0000000000000004 HASH
// CHECK-NEXT:  0x0000000000000000 NULL                 0x0
// CHECK-NEXT: ]

.global _start
_start:
.quad bar + 0x42
.weak foo
.quad foo
call main