Files
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

81 lines
2.4 KiB
ArmAsm

# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
# RUN: %lld -lSystem -o %t %t.o
# RUN: llvm-objdump --no-print-imm-hex --section-headers --syms -d %t | FileCheck %s
# CHECK-LABEL: Sections:
# CHECK: __branch_target {{[0-9a-z]+}} [[#%x, BRANCH_SECT:]]
# CHECK: __data {{[0-9a-z]+}} [[#%x, DATA_ADDR:]]
# CHECK-LABEL: SYMBOL TABLE:
# CHECK-DAG: [[#%x, F_ADDR:]] {{.*}} _f
# CHECK-DAG: [[#%x, G_ADDR:]] {{.*}} _g
# CHECK-LABEL: <_main>:
## Test X86_64_RELOC_BRANCH
## Test symbol (extern) relocations first (most common case)
# CHECK: callq 0x[[#%x, F_ADDR]] <_f>
# CHECK: jrcxz 0x[[#%x, F_ADDR]] <_f>
# CHECK: callq 0x[[#%x, G_ADDR]] <_g>
# CHECK: jrcxz 0x[[#%x, G_ADDR]] <_g>
## Test section (local) BRANCH relocations
# CHECK: callq 0x[[#%x, BRANCH_SECT]]
## NOTE: ld64 rejects 1-byte local branch relocations as unsupported, but it
## doesn't take any extra code for us to support it
# CHECK: jrcxz 0x[[#%x, BRANCH_SECT]]
# CHECK-LABEL: <_f>:
## Test extern (symbol) X86_64_RELOC_SIGNED
# CHECK: leaq [[#%u, LOCAL_OFF:]](%rip), %rsi
# CHECK-NEXT: [[#%x, DATA_ADDR - LOCAL_OFF]]
## Test non-extern (section) X86_64_RELOC_SIGNED
# CHECK: leaq [[#%u, PRIVATE_OFF:]](%rip), %rsi
# CHECK-NEXT: [[#%x, DATA_ADDR + 8 - PRIVATE_OFF]]
# RUN: llvm-objdump --section=__const --full-contents %t | FileCheck %s --check-prefix=NONPCREL
# NONPCREL: Contents of section __DATA_CONST,__const:
# NONPCREL-NEXT: 100001000 08200000 01000000 08200000 01000000
.section __TEXT,__text
.globl _main, _f, _g
_main:
callq _f # X86_64_RELOC_BRANCH with r_length=2
jrcxz _f # X86_64_RELOC_BRANCH with r_length=0
# Test negative addends
callq _f - 1
jrcxz _f - 1
# Test section relocations
callq L_.branch_target
jrcxz L_.branch_target
mov $0, %rax
ret
_g:
.byte 0x0
_f:
leaq _local(%rip), %rsi # Generates a X86_64_RELOC_SIGNED pcrel symbol relocation
leaq L_.private(%rip), %rsi # Generates a X86_64_RELOC_SIGNED pcrel section relocation
movq L_.ptr_1(%rip), %rsi
ret
.section __TEXT,__branch_target
L_.branch_target:
ret
.data
## References to this generate a symbol relocation
_local:
.quad 123
## References to this generate a section relocation
L_.private:
.quad 123
.section __DATA,__const
## These generate X86_64_RELOC_UNSIGNED non-pcrel section relocations
L_.ptr_1:
.quad L_.private
L_.ptr_2:
.quad L_.private