This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][MC] Generate relative relocations for allocatable (more particularly, eh_frame) sections
ClosedPublic

Authored by jmmartinez on Jan 24 2023, 3:55 AM.

Diff Detail

Event Timeline

jmmartinez created this revision.Jan 24 2023, 3:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 24 2023, 3:55 AM
jmmartinez published this revision for review.Jan 27 2023, 9:34 AM
jmmartinez added reviewers: kzhuravl, scott.linder.
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2023, 9:34 AM

Can you also add a codegen test that hits this?

Can you also add a codegen test that hits this?

Unfortunately, there is no codegen path for this (for the moment).

This patch is related to the work I started in https://reviews.llvm.org/D139024, which forces the emission of CFI entries in the .eh_frame section for functions with the uwtable attribute.

The problem is that without this patch https://reviews.llvm.org/D139024 breaks the compilation of AMDGPU programs when the sanitizers are enabled (lld raises an error due to the problematic relocations).

With the work from https://reviews.llvm.org/D139024 , this case will be triggered for functions with the uwtable attribute.

scott.linder accepted this revision.Feb 9 2023, 10:08 AM
scott.linder added inline comments.
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
73

I'm not certain I understand why there are some fixup kinds which encode their PCRelative-ness (e.g. FK_PCRel_4) and some which don't (e.g. FK_Data_4), and yet there is also a separate channel where a fixup that is not intrinsically PCRelative can be tagged as FixupKindFlags::FKF_IsPCRel (here the value of IsPCRel).

The representation seems to be decades old, so I will just take it on faith that it makes sense, and in light of it the change LGTM!

This revision is now accepted and ready to land.Feb 9 2023, 10:08 AM