[LLD] [COFF] Warn about pseudo relocations that are too narrow
authorMartin Storsjö <martin@martin.st>
Wed, 5 Jul 2023 22:04:12 +0000 (01:04 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 11 Jul 2023 20:43:34 +0000 (23:43 +0300)
commit6daa4b90e28ef4789ae0eb3163c6770c110d3a28
tree607be1c3587d096c64c293f6fc4eb6235d0fad98
parent1776dc81240cab4e365d55bc720b552823697081
[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
lld/COFF/Chunks.cpp
lld/test/CMakeLists.txt
lld/test/COFF/autoimport-nowarn.s [new file with mode: 0644]
lld/test/COFF/autoimport-warn.s [new file with mode: 0644]