[PATCH] RuntimeDyldElf: Add (trivial) support for R_X86_64_NONE, it's a no-op

Will Dietz via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 17 10:27:01 PST 2016


Hmm well if there is a way, I'm not sure how to create it.

I explored using something like:
--------
  .text
foo:
  .reloc 0, R_X86_64_NONE, bar
  nop
--------

Which works with GNU 'as' but it seems llvm-mc doesn't recognize the
relocation name.

Can someone commit this on my behalf? I'm not currently in a very good
position to do so myself O:).  Thanks!

~Will

On Tue, Oct 18, 2016 at 2:33 PM, Lang Hames <lhames at gmail.com> wrote:
> Hi Will,
>
> If there's a way to produce this relocation with an assembly directive, I
> would add a regression test along the lines of
> test/ExecutionEngine/RuntimeDyld/X86/ELF-relaxed.s . Otherwise, this looks
> good to me.
>
> Cheers,
> Lang.
>
> On Thu, Oct 13, 2016 at 6:45 AM, Will Dietz via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> Ping?
>>
>> To help explain/motivate:
>>
>> Files with these relocations can be given to RuntimeDyld through an object
>> or archive,
>> and without this fix RuntimeDyld hits the "Relocation type not
>> implemented" unreachable/assertion failure.
>> (Not sure if any of our JIT's would produce the need for these, but maybe
>> them too)
>>
>>
>> Why this is correct:
>>
>> Searching the same file you can see how the equivalent relocation is
>> handled on other architectures (R_ARM_NONE, R_MIPS_NONE), which is the same:
>> do nothing :).
>>
>> I don't have a useful way to craft a test for this, but if that's a
>> blocker please let me know and I'll see what I can do.
>>
>> Thanks! :)
>>
>> ~Will
>>
>> On Wed, Sep 21, 2016 at 9:28 AM Will Dietz <wdietz2 at illinois.edu> wrote:
>>>
>>> Patch attached and reproduced below inline:
>>> ----------------------
>>> From 91f56e48e0d267c8647410652be57dd7ab69200b Mon Sep 17 00:00:00 2001
>>> From: Will Dietz <w at wdtz.org>
>>> Date: Wed, 27 Jul 2016 07:20:37 -0500
>>> Subject: [PATCH] RuntimeDyldELF: Don't abort on R_X86_64_NONE, they're
>>> no-ops.
>>>
>>> ---
>>>  lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp |    2 ++
>>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>>> b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>>> index 9cbdb13..ec8fe3a 100644
>>> --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>>> +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>>> @@ -231,6 +231,8 @@ void RuntimeDyldELF::resolveX86_64Relocation(const
>>> SectionEntry &Section,
>>>    default:
>>>      llvm_unreachable("Relocation type not implemented yet!");
>>>      break;
>>> +  case ELF::R_X86_64_NONE:
>>> +    break;
>>>    case ELF::R_X86_64_64: {
>>>      support::ulittle64_t::ref(Section.getAddressWithOffset(Offset)) =
>>>          Value + Addend;
>>> --
>>> 1.7.1
>>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>


More information about the llvm-commits mailing list