Files
TheRock/compiler/amd-llvm/lld/test/COFF/autoimport-refptr.s
T
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

78 lines
2.8 KiB
ArmAsm

# REQUIRES: x86
# RUN: echo -e ".global variable\n.global DllMainCRTStartup\n.text\nDllMainCRTStartup:\nret\n.data\nvariable:\n.long 42" > %t-lib.s
# RUN: llvm-mc -triple=x86_64-windows-gnu %t-lib.s -filetype=obj -o %t-lib.obj
# RUN: lld-link -out:%t-lib.dll -dll %t-lib.obj -lldmingw -implib:%t-lib.lib
# RUN: llvm-mc -triple=x86_64-windows-gnu %s -defsym listptrs=1 -filetype=obj -o %t.obj
# RUN: lld-link -lldmingw -out:%t.exe -entry:main %t.obj %t-lib.lib -verbose
# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORTS %s
# RUN: llvm-objdump --no-print-imm-hex -d %t.exe | FileCheck --check-prefix=DISASM %s
# RUN: llvm-objdump -s %t.exe | FileCheck --check-prefix=CONTENTS %s
## Check that we can autoimport these variables with pseudo relocs disabled.
# RUN: llvm-mc -triple=x86_64-windows-gnu %s -defsym listptrs=0 -filetype=obj -o %t.noptrs.obj
# RUN: lld-link -lldmingw -runtime-pseudo-reloc:no -out:%t.exe -entry:main %t.noptrs.obj %t-lib.lib
## Check that we can't autoimport them with autoimport disabled.
# RUN: not lld-link -lldmingw -auto-import:no -out:%t.exe -entry:main %t.noptrs.obj %t-lib.lib 2>&1 | FileCheck --check-prefix=NO-AUTOIMPORT %s
# IMPORTS: Import {
# IMPORTS-NEXT: Name: autoimport-refptr.s.tmp-lib.dll
# IMPORTS-NEXT: ImportLookupTableRVA: 0x2050
# IMPORTS-NEXT: ImportAddressTableRVA: 0x2060
# IMPORTS-NEXT: Symbol: variable (0)
# IMPORTS-NEXT: }
# DISASM: Disassembly of section .text:
# DISASM-EMPTY:
# DISASM: <.text>:
# Relative offset at 0x1002 pointing at the IAT at 0x2060
# DISASM: 140001000: 48 8b 05 59 10 00 00 movq 4185(%rip), %rax
# DISASM: 140001007: 8b 00 movl (%rax), %eax
# Relative offset at 0x100b pointing at the .refptr.localvar stub at
# 0x2000
# DISASM: 140001009: 48 8b 0d f0 0f 00 00 movq 4080(%rip), %rcx
# DISASM: 140001010: 03 01 addl (%rcx), %eax
# DISASM: 140001012: c3 retq
# relocs: pointing at an empty list of runtime pseudo relocs.
# localvar: 42
# CONTENTS: Contents of section .data:
# CONTENTS: 140003000 08200040 01000000 08200040 01000000
# CONTENTS: 140003010 2a000000
# NO-AUTOIMPORT: error: undefined symbol: variable
.global main
.global localvar
.text
main:
movq .refptr.variable(%rip), %rax
movl (%rax), %eax
movq .refptr.localvar(%rip), %rcx
addl (%rcx), %eax
ret
.data
.if listptrs==1
relocs:
.quad __RUNTIME_PSEUDO_RELOC_LIST__
.quad __RUNTIME_PSEUDO_RELOC_LIST_END__
.endif
localvar:
.int 42
# Normally the compiler wouldn't emit a stub for a variable that is
# emitted in the same translation unit.
.section .rdata$.refptr.localvar,"dr",discard,.refptr.localvar
.global .refptr.localvar
.refptr.localvar:
.quad localvar
.section .rdata$.refptr.variable,"dr",discard,.refptr.variable
.global .refptr.variable
.refptr.variable:
.quad variable