Files
TheRock/compiler/amd-llvm/lld/test/ELF/loongarch-relax-pc-hi20-lo12-got-symbols.s
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

91 lines
3.2 KiB
ArmAsm

## This test verifies that the pair pcalau12i + ld.w/d is relaxed/not relaxed
## depending on the target symbol properties.
# REQUIRES: loongarch
# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc --filetype=obj --triple=loongarch32 -mattr=+32s,+relax symbols.s -o symbols.32.o
# RUN: llvm-mc --filetype=obj --triple=loongarch64 -mattr=+relax symbols.s -o symbols.64.o
# RUN: llvm-mc --filetype=obj --triple=loongarch32 -mattr=+32s,+relax abs.s -o abs.32.o
# RUN: llvm-mc --filetype=obj --triple=loongarch64 -mattr=+relax abs.s -o abs.64.o
# RUN: ld.lld --shared -Tlinker.t symbols.32.o abs.32.o -o symbols.32.so
# RUN: ld.lld --shared -Tlinker.t symbols.64.o abs.64.o -o symbols.64.so
# RUN: llvm-objdump -d --no-show-raw-insn symbols.32.so | FileCheck --check-prefixes=LIB %s
# RUN: llvm-objdump -d --no-show-raw-insn symbols.64.so | FileCheck --check-prefixes=LIB %s
# RUN: ld.lld -Tlinker.t -z undefs symbols.32.o abs.32.o -o symbols.32
# RUN: ld.lld -Tlinker.t -z undefs symbols.64.o abs.64.o -o symbols.64
# RUN: llvm-objdump -d --no-show-raw-insn symbols.32 | FileCheck --check-prefixes=EXE %s
# RUN: llvm-objdump -d --no-show-raw-insn symbols.64 | FileCheck --check-prefixes=EXE %s
## Symbol 'hidden_sym' is nonpreemptible, the relaxation should be applied.
LIB: pcaddi $a0, [[#]]
## Symbol 'global_sym' is preemptible, no relaxations should be applied.
LIB-NEXT: pcalau12i $a1, 4
LIB-NEXT: ld.{{[wd]}} $a1, $a1, [[#]]
## Symbol 'undefined_sym' is undefined, no relaxations should be applied.
LIB-NEXT: pcalau12i $a2, 4
LIB-NEXT: ld.{{[wd]}} $a2, $a2, [[#]]
## Symbol 'ifunc_sym' is STT_GNU_IFUNC, no relaxations should be applied.
LIB-NEXT: pcalau12i $a3, 4
LIB-NEXT: ld.{{[wd]}} $a3, $a3, [[#]]
## Symbol 'abs_sym' is absolute, no relaxations should be applied.
LIB-NEXT: pcalau12i $a4, 4
LIB-NEXT: ld.{{[wd]}} $a4, $a4, [[#]]
## Symbol 'hidden_sym' is nonpreemptible, the relaxation should be applied.
EXE: pcaddi $a0, [[#]]
## Symbol 'global_sym' is nonpreemptible, the relaxation should be applied.
EXE-NEXT: pcaddi $a1, [[#]]
## Symbol 'undefined_sym' is undefined, no relaxations should be applied.
EXE-NEXT: pcalau12i $a2, 4
EXE-NEXT: ld.{{[wd]}} $a2, $a2, [[#]]
## Symbol 'ifunc_sym' is STT_GNU_IFUNC, no relaxations should be applied.
EXE-NEXT: pcalau12i $a3, 4
EXE-NEXT: ld.{{[wd]}} $a3, $a3, [[#]]
## Symbol 'abs_sym' is absolute, relaxations may be applied in -no-pie mode.
EXE-NEXT: pcaddi $a4, -[[#]]
## The linker script ensures that .rodata and .text are near (>4M) so that
## the pcalau12i+ld.w/d pair can be relaxed to pcaddi.
#--- linker.t
SECTIONS {
.text 0x10000: { *(.text) }
.rodata 0x14000: { *(.rodata) }
}
# This symbol is defined in a separate file to prevent the definition from
# being folded into the instructions that reference it.
#--- abs.s
.global abs_sym
.hidden abs_sym
abs_sym = 0x1000
#--- symbols.s
.rodata
.hidden hidden_sym
hidden_sym:
.word 10
.global global_sym
global_sym:
.word 10
.text
.type ifunc_sym STT_GNU_IFUNC
.hidden ifunc_sym
ifunc_sym:
nop
.global _start
_start:
la.got $a0, hidden_sym
la.got $a1, global_sym
la.got $a2, undefined_sym
la.got $a3, ifunc_sym
la.got $a4, abs_sym