[BOLT] Ignore PC-relative relocations from data to data
authorMaksim Panchenko <maks@fb.com>
Wed, 13 Apr 2022 01:42:19 +0000 (18:42 -0700)
committerMaksim Panchenko <maks@fb.com>
Wed, 13 Apr 2022 18:13:51 +0000 (11:13 -0700)
commit36cb736665dbdaefd188d54376dc6c7f92e1fb68
tree3263b87e917e7ef0083c67c3a1d0fc99f863902d
parentbad3798113f8760a7978d745d428a1271e75554c
[BOLT] Ignore PC-relative relocations from data to data

BOLT expects PC-relative relocations in data sections to reference code
and the relocated data to form a jump table. However, there are cases
where PC-relative addressing is used for data-to-data references
(e.g. clang-15 can generate such code). BOLT should recognize and ignore
such relocations. Otherwise, they will be considered relocations not
claimed by any jump table and cause a failure in the strict mode.

Reviewed By: yota9, Amir

Differential Revision: https://reviews.llvm.org/D123650
bolt/lib/Rewrite/RewriteInstance.cpp
bolt/test/X86/data-to-data-pcrel.s [new file with mode: 0644]