mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 03:06:04 +00:00

This patch adds full support for linking SystemZ (ELF s390x) object files. Support should be generally complete: - All relocation types are supported. - Full shared library support (DYNAMIC, GOT, PLT, ifunc). - Relaxation of TLS and GOT relocations where appropriate. - Platform-specific test cases. In addition to new platform code and the obvious changes, there were a few additional changes to common code: - Add three new RelExpr members (R_GOTPLT_OFF, R_GOTPLT_PC, and R_PLT_GOTREL) needed to support certain s390x relocations. I chose not to use a platform-specific name since nothing in the definition of these relocs is actually platform-specific; it is well possible that other platforms will need the same. - A couple of tweaks to TLS relocation handling, as the particular semantics of the s390x versions differ slightly. See comments in the code. This was tested by building and testing >1500 Fedora packages, with only a handful of failures; as these also have issues when building with LLD on other architectures, they seem unrelated. Co-authored-by: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
62 lines
1.2 KiB
ArmAsm
62 lines
1.2 KiB
ArmAsm
# REQUIRES: systemz
|
|
# RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %s -o %t.o
|
|
|
|
# RUN: ld.lld %t.o -o %t
|
|
# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
|
|
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
|
|
# RUN: llvm-objdump --section .data.rel.ro --full-contents %t | FileCheck --check-prefix=LE-DATA %s
|
|
|
|
# NOREL: no relocations
|
|
|
|
## TP offset for a is at 0x1002200
|
|
# LE: lgrl %r1, 0x1002200
|
|
# LE-NEXT: lgf %r1, 0(%r1,%r7)
|
|
|
|
## TP offset for b is at 0x1002208
|
|
# LE-NEXT: lgrl %r1, 0x1002208
|
|
# LE-NEXT: lgf %r1, 0(%r1,%r7)
|
|
|
|
## TP offset for c is at 0x1002210
|
|
# LE-NEXT: lgrl %r1, 0x1002210
|
|
# LE-NEXT: lgf %r1, 0(%r1,%r7)
|
|
|
|
## TP offsets:
|
|
# a: -8
|
|
# b: -4
|
|
# c: 0
|
|
# LE-DATA: 1002200 ffffffff fffffff8 ffffffff fffffffc
|
|
# LE-DATA: 1002210 00000000 00000000
|
|
|
|
ear %r7,%a0
|
|
sllg %r7,%r1,32
|
|
ear %r7,%a1
|
|
|
|
lgrl %r1, .LC0
|
|
lgf %r1,0(%r1,%r7)
|
|
|
|
lgrl %r1, .LC1
|
|
lgf %r1,0(%r1,%r7)
|
|
|
|
lgrl %r1, .LC2
|
|
lgf %r1,0(%r1,%r7)
|
|
|
|
.section .data.rel.ro,"aw"
|
|
.align 8
|
|
.LC0:
|
|
.quad a@ntpoff
|
|
.LC1:
|
|
.quad b@ntpoff
|
|
.LC2:
|
|
.quad c@ntpoff
|
|
|
|
.section .tbss
|
|
.globl a
|
|
.globl b
|
|
.globl c
|
|
.zero 8
|
|
a:
|
|
.zero 4
|
|
b:
|
|
.zero 4
|
|
c:
|