File: ppc32-reloc-got.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (36 lines) | stat: -rw-r--r-- 1,125 bytes parent folder | download | duplicates (18)
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
# REQUIRES: ppc
# RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
# RUN: echo '.globl b; b:' | llvm-mc -filetype=obj -triple=powerpc - -o %t1.o
# RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so

# RUN: ld.lld %t.o %t1.so -o %t
# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
# RUN: llvm-readobj -x .got %t | FileCheck --check-prefix=HEX %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s

## Check we can handle R_PPC_GOT16, which may be generated by -fpic code.

# RELOC:      .rela.dyn {
# RELOC-NEXT:   0x10020218 R_PPC_GLOB_DAT b 0x0
# RELOC-NEXT: }

# NM: 1002020c d _GLOBAL_OFFSET_TABLE_
# NM: 10030220 d a

## The GOT slot of a can be filled at link time.
# HEX:      section '.got':
# HEX:      0x1002020c [[#%x,]] 00000000 00000000 00000000
# HEX-NEXT: 0x1002021c 10030220

## a: &.got[4] - _GLOBAL_OFFSET_TABLE_ = 0x1002021c - 0x1002020c = 16
## b: &.got[3] - _GLOBAL_OFFSET_TABLE_ = 0x10020218 - 0x1002020c = 12
# CHECK: lwz 3, 16(30)
# CHECK: lwz 4, 12(30)

lwz 3,a@got(30)
lwz 4,b@got(30)

.data
a:
.long _GLOBAL_OFFSET_TABLE_