File: arm-rwpi-debug-relocs.s

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (54 lines) | stat: -rw-r--r-- 1,266 bytes parent folder | download | duplicates (5)
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
/// Test that R_ARM_SBREL32 relocations in debug info are relocated as if the
/// static base register (r9) is zero. Real DWARF info will use an expression to
/// add this to the real value of the static base at runtime.

// REQUIRES: arm
// RUN: rm -rf %t && split-file %s %t && cd %t

// RUN: llvm-mc -filetype=obj -triple=armv7a asm.s -o obj.o
// RUN: ld.lld -T lds.ld obj.o -o exe.elf 2>&1 | FileCheck %s --implicit-check-not=warning: --allow-empty
// RUN: llvm-objdump -D exe.elf | FileCheck --check-prefix=DISASM %s

// DISASM-LABEL: <rw>:
// DISASM-NEXT:      1000: 0000002a

// DISASM-LABEL: <rw2>:
// DISASM-NEXT:      2000: 000004d2

// DISASM-LABEL: <.debug_something>:
// DISASM-NEXT:         0: 00001000
// DISASM-NEXT:        ...
// DISASM-NEXT:       104: 00002000

//--- lds.ld
SECTIONS {
  data1 0x1000 : { *(data1) }
  data2 0x2000 : { *(data2) }
}

//--- asm.s
  .text
  .type _start,%function
  .globl  _start
_start:
  bx lr
  .size _start, .-_start

  .section data1, "aw", %progbits
  .type rw,%object
  .globl  rw
rw:
  .long 42
  .size rw, 4

  .section data2, "aw", %progbits
  .type rw2,%object
  .globl  rw2
rw2:
  .long 1234
  .size rw2, 4

  .section  .debug_something, "", %progbits
  .long rw(sbrel)
  .space 0x100
  .long rw2(sbrel)