This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Support some absolute/PC-relative relocation types for REL format
ClosedPublic

Authored by MaskRay on Feb 24 2022, 9:32 PM.

Details

Summary

ctfconvert seems to use REL-format .rel.SUNW_dof for 32-bit architectures.

Binary file usr/ports/lang/perl5.32/work/perl-5.32.1/dtrace_mini.o matches
[alfredo.junior@dell-a ~/tmp/llvm-bug]$ readelf -r dtrace_mini.o

Relocation section (.rel.SUNW_dof):
r_offset r_info   r_type              st_value st_name
00000184 0000281a R_PPC_REL32         00000000 $dtrace1772974259.Perl_dtrace_probe_load

Support R_PPC_REL32 to fix ld.lld: error: drti.c:(.SUNW_dof+0x4E4): internal linker error: cannot read addend for relocation R_PPC_REL32.
While here, add some common relocation types for AArch64, PPC, and PPC64.
We perform minimum tests.

Diff Detail

Event Timeline

MaskRay created this revision.Feb 24 2022, 9:32 PM
MaskRay requested review of this revision.Feb 24 2022, 9:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2022, 9:32 PM
MaskRay retitled this revision from [ELF] Support some PC-relative relocation types for REL format to [ELF] Support some absolute/PC-relative relocation types for REL format.Feb 24 2022, 9:32 PM
MaskRay edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Feb 25 2022, 3:17 AM
adalava accepted this revision.Feb 25 2022, 6:31 AM

LGTM, Tested on FreeBSD/powerpc 32 bit