llvm-project/lld/test/COFF/autoimport-nowarn.s
Martin Storsjö 6daa4b90e2 [LLD] [COFF] Warn about pseudo relocations that are too narrow
In 64 bit mode, any references to symbols that might end up autoimported
must be made via full 64 bit pointers (usually in .refptr stubs
generated by the compiler).

If referenced via e.g. a 32 bit rip relative offset, it might work
as long as DLLs are loaded close together in the 64 bit address
space, but will fail surprisingly later if they happen to be loaded
further apart. Any cases of that happening is usually a toolchain
error, and the sooner we can warn about it, the easier it is to diagnose.

Differential Revision: https://reviews.llvm.org/D154777
2023-07-11 23:43:34 +03:00

20 lines
536 B
ArmAsm

# REQUIRES: x86
# RUN: echo -e "EXPORTS\nvariable" > %t-lib.def
# RUN: llvm-dlltool -m i386 -d %t-lib.def -D lib.dll -l %t-lib.lib
# RUN: llvm-mc -triple=i386-windows-gnu %s -filetype=obj -o %t.obj
# RUN: lld-link -lldmingw -out:%t.exe -entry:main %t.obj %t-lib.lib -verbose 2>&1 | FileCheck --allow-empty %s
# CHECK-NOT: runtime pseudo relocation {{.*}} is too narrow
.global _main
.text
_main:
movl _variable, %eax
ret
relocs:
.long ___RUNTIME_PSEUDO_RELOC_LIST__
.long ___RUNTIME_PSEUDO_RELOC_LIST_END__