brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.8 KiB · f91e4f9 Raw
89 lines · plain
1# REQUIRES: aarch642# RUN: rm -rf %t && split-file %s %t3# RUN: llvm-mc -filetype=obj -triple=aarch64 %t/use.s -o %t/use-le.o4# RUN: llvm-mc -filetype=obj -triple=aarch64 %t/def.s -o %t/def-le.o5# RUN: llvm-mc -filetype=obj -triple=aarch64 %t/rel.s -o %t/rel-le.o6 7## Deactivation symbol used without being defined: instruction emitted as usual.8# RUN: ld.lld -o %t/undef-le %t/use-le.o --emit-relocs9# RUN: llvm-objdump -r %t/undef-le | FileCheck --check-prefix=RELOC %s10# RUN: llvm-objdump -d %t/undef-le | FileCheck --check-prefix=UNDEF %s11# RUN: ld.lld -pie -o %t/undef-le %t/use-le.o --emit-relocs12# RUN: llvm-objdump -r %t/undef-le | FileCheck --check-prefix=RELOC %s13# RUN: llvm-objdump -d %t/undef-le | FileCheck --check-prefix=UNDEF %s14 15## Deactivation symbol defined: instructions overwritten with NOPs.16# RUN: ld.lld -o %t/def-le %t/use-le.o %t/def-le.o --emit-relocs17# RUN: llvm-objdump -r %t/def-le | FileCheck --check-prefix=RELOC %s18# RUN: llvm-objdump -d %t/def-le | FileCheck --check-prefix=DEF %s19# RUN: ld.lld -pie -o %t/def-le %t/use-le.o %t/def-le.o --emit-relocs20# RUN: llvm-objdump -r %t/def-le | FileCheck --check-prefix=RELOC %s21# RUN: llvm-objdump -d %t/def-le | FileCheck --check-prefix=DEF %s22 23## Relocation pointing to a non-SHN_UNDEF non-SHN_ABS symbol is an error.24# RUN: not ld.lld -o %t/rel-le %t/use-le.o %t/rel-le.o 2>&1 | FileCheck --check-prefix=ERROR %s25# RUN: not ld.lld -pie -o %t/rel-le %t/use-le.o %t/rel-le.o 2>&1 | FileCheck --check-prefix=ERROR %s26 27## Behavior unchanged by endianness: relocation always written as little endian.28# RUN: llvm-mc -filetype=obj -triple=aarch64_be %t/use.s -o %t/use-be.o29# RUN: llvm-mc -filetype=obj -triple=aarch64_be %t/def.s -o %t/def-be.o30# RUN: llvm-mc -filetype=obj -triple=aarch64_be %t/rel.s -o %t/rel-be.o31# RUN: ld.lld -o %t/undef-be %t/use-be.o --emit-relocs32# RUN: llvm-objdump -r %t/undef-be | FileCheck --check-prefix=RELOC %s33# RUN: llvm-objdump -d %t/undef-be | FileCheck --check-prefix=UNDEF %s34# RUN: ld.lld -pie -o %t/undef-be %t/use-be.o --emit-relocs35# RUN: llvm-objdump -r %t/undef-be | FileCheck --check-prefix=RELOC %s36# RUN: llvm-objdump -d %t/undef-be | FileCheck --check-prefix=UNDEF %s37# RUN: ld.lld -o %t/def-be %t/use-be.o %t/def-be.o --emit-relocs38# RUN: llvm-objdump -r %t/def-be | FileCheck --check-prefix=RELOC %s39# RUN: llvm-objdump -d %t/def-be | FileCheck --check-prefix=DEF %s40# RUN: ld.lld -pie -o %t/def-be %t/use-be.o %t/def-be.o --emit-relocs41# RUN: llvm-objdump -r %t/def-be | FileCheck --check-prefix=RELOC %s42# RUN: llvm-objdump -d %t/def-be | FileCheck --check-prefix=DEF %s43# RUN: not ld.lld -o %t/rel-be %t/use-be.o %t/rel-be.o 2>&1 | FileCheck --check-prefix=ERROR %s44# RUN: not ld.lld -pie -o %t/rel-be %t/use-be.o %t/rel-be.o 2>&1 | FileCheck --check-prefix=ERROR %s45 46# RELOC:      R_AARCH64_JUMP2647# RELOC-NEXT: R_AARCH64_PATCHINST ds48# RELOC-NEXT: R_AARCH64_PATCHINST ds49# RELOC-NEXT: R_AARCH64_PATCHINST ds0+0xd503201f50 51#--- use.s52.weak ds53.weak ds054# This instruction has a single relocation: the DS relocation.55# UNDEF: add x0, x1, x256# DEF: nop57# ERROR: R_AARCH64_PATCHINST relocation against non-absolute symbol ds58.reloc ., R_AARCH64_PATCHINST, ds59add x0, x1, x260# This instruction has two relocations: the DS relocation and the JUMP26 to f1.61# Make sure that the DS relocation takes precedence.62.reloc ., R_AARCH64_PATCHINST, ds63# UNDEF: b {{.*}} <f1>64# DEF: nop65# ERROR: R_AARCH64_PATCHINST relocation against non-absolute symbol ds66b f167# Alternative representation: instruction opcode stored in addend.68# UNDEF: add x3, x4, x569# DEF: nop70# ERROR: R_AARCH64_PATCHINST relocation against non-absolute symbol ds071.reloc ., R_AARCH64_PATCHINST, ds0 + 0xd503201f72add x3, x4, x573 74.section .text.f1,"ax",@progbits75f1:76ret77 78#--- def.s79.globl ds80ds = 0xd503201f81.globl ds082ds0 = 083 84#--- rel.s85.globl ds86ds:87.globl ds088ds0:89