This is an archive of the discontinued LLVM Phabricator instance.

Getting R_X86_64_PC32 working as our first relocation
ClosedPublic

Authored by jaredwy on May 27 2020, 1:36 AM.

Details

Summary

The first attempt at getting a relocation type added.
So far nothing special but should set the architecture going forward for the rest of the relocations

Diff Detail

Event Timeline

jaredwy created this revision.May 27 2020, 1:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 27 2020, 1:36 AM
lhames accepted this revision.May 27 2020, 3:00 PM

This looks great!

Style issues: There are a number of single line statements with braces around them -- those braces should be moved to match the style guide. You should also clang-format the patch if you haven't already. Otherwise this is good to land.

llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
195–199

No braces for single-line statements. :)

Side note regarding the TODO: Long term I think it would make sense to do some sort of up-front validation of the input file, but for now this is the right place to check this.

236

For what error condition? Empty sections? Does your parser ever produce them?

This revision is now accepted and ready to land.May 27 2020, 3:00 PM

Clang-format was run but doesn't seem to catch this case, ill clean it up later this afternoon.

llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
236

No. If a JITSection is found, it would be next to impossible not to have a block. So if i push the error check on jitSection that should ensure a block is present

lhames requested changes to this revision.May 27 2020, 4:05 PM

Oh, wait: this still needs a test case before it lands. The llvm/test/ExecutionEngine/JITLink/X86/ELF_x86-64_relocations.s test should be updated to include a check for the new relocation.

This revision now requires changes to proceed.May 27 2020, 4:05 PM
jaredwy updated this revision to Diff 266732.May 27 2020, 9:33 PM

This should fix up the review comments, and the clang-tidy issue
Will add the tests later tonight

a6deaeec370ec5e34f9e5aa3fad3bc73770d4895 adds basic support for llvm-jitlink -check tests for ELF. That should allow you to test this.

jaredwy updated this revision to Diff 267416.May 29 2020, 4:55 PM

Adding the relocation test file (thanks lang!)

lhames accepted this revision.May 29 2020, 5:25 PM

LGTM!

This revision is now accepted and ready to land.May 29 2020, 5:25 PM
This revision was automatically updated to reflect the committed changes.