This is an archive of the discontinued LLVM Phabricator instance.

[ELF][RISCV] Error on R_RISCV_PCREL_LO12_[IS] that point to absolute symbols
ClosedPublic

Authored by MaskRay on Jun 13 2019, 7:57 AM.

Details

Summary

The referenced symbol is expected to point to an R_RISCV_*_HI20
relocation. An absolute symbol has no associated section, therefore
there cannot be a matching R_RISCV_*_HI20.

This fixes the crash reported by PR42038. For reference, ld.bfd errors:

(.init+0x4): dangerous relocation: %pcrel_lo missing matching %pcrel_hi

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Jun 13 2019, 7:57 AM
Herald added a project: Restricted Project. · View Herald Transcript
jrtc27 added a comment.Jul 3 2019, 5:14 AM

Seems like a good idea

jrtc27 requested changes to this revision.Jul 3 2019, 5:15 AM
jrtc27 added inline comments.
ELF/InputSection.cpp
574 ↗(On Diff #204542)

We should print the symbol name though like we do below

This revision now requires changes to proceed.Jul 3 2019, 5:15 AM
MaskRay updated this revision to Diff 207768.Jul 3 2019, 5:41 AM
MaskRay marked an inline comment as done.

Print symbol name

This revision was not accepted when it landed; it landed in state Needs Review.Jul 3 2019, 8:41 AM
This revision was automatically updated to reflect the committed changes.