This is an archive of the discontinued LLVM Phabricator instance.

Updates and adds tests for i386/ELF JITLink backend
ClosedPublic

Authored by jain98 on Nov 19 2022, 8:17 PM.

Details

Summary

This CR modifies the existing 32 bit pcrel relocation test to
include the case when the relocation target might be present at
a smaller address than the address of the location that needs to be
patched.

Additionally, it adds a test for 16 bit absolute relocation.

Diff Detail

Event Timeline

jain98 created this revision.Nov 19 2022, 8:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2022, 8:17 PM
jain98 requested review of this revision.Nov 19 2022, 8:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2022, 8:17 PM
sunho added inline comments.Nov 20 2022, 12:01 AM
llvm/test/ExecutionEngine/JITLink/i386/ELF_i386_pc_relative_relocations_32.s
39

The test is noexec but it's without "jitlink-check"?

I think what you would want to do is create another function that only contains calll bar and use jitlink-check to actually check if it's patched with valid value. You can see some examples in file ELF_x86-64_small_pic_relocations.s Specifically, look at test_call_local.

jain98 added inline comments.Nov 20 2022, 9:49 AM
llvm/test/ExecutionEngine/JITLink/i386/ELF_i386_pc_relative_relocations_32.s
39

Thanks @sunho! I have changed the test accordingly.

39

Are similar checks not necessary for the absolute relocations?

jain98 updated this revision to Diff 476788.Nov 20 2022, 6:55 PM

Updating D138372: Updates and adds tests for i386/ELF JITLink backend

sunho accepted this revision.Nov 21 2022, 3:00 PM

LGTM to me in general. Few minor comments.

llvm/test/ExecutionEngine/JITLink/i386/ELF_i386_absolute_relocations_16.s
1

Is --show-encoding --show-inst needed?

llvm/test/ExecutionEngine/JITLink/i386/ELF_i386_pc_relative_relocations_32.s
23

Maybe it's worth to rename functions to be more descriptive. Like test_pc_rel_pos.

This revision is now accepted and ready to land.Nov 21 2022, 3:00 PM
This revision was automatically updated to reflect the committed changes.