Files
clang-p2996/lld/test/ELF/systemz-init-padding.s
Ulrich Weigand fe3406e349 [lld] Add target support for SystemZ (s390x) (#75643)
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>
2024-02-13 11:29:21 +01:00

28 lines
766 B
ArmAsm

# REQUIRES: systemz
# RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %p/Inputs/systemz-init.s -o systemz-init.o
# RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %s -o %t.o
# RUN: ld.lld -dynamic-linker /lib/ld64.so.1 %t.o systemz-init.o -o %t
# RUN: llvm-objdump -d --no-show-raw-insn -j .init %t | FileCheck %s
# glibc < 2.39 used to align .init and .fini code at a 4-byte boundary.
# When that happens, the linker must not pad the code with invalid
# instructions, e.g. null bytes.
.section .init,"ax",@progbits
brasl %r14, startup
# CHECK: <.init>:
# CHECK-NEXT: brasl %r14,
# CHECK-NEXT: bcr 0, %r7
# CHECK-NEXT: lg %r4, 272(%r15)
.text
.globl startup
.p2align 4
startup:
br %r14
.globl main
.p2align 4
main:
br %r14