[PATCH] Allow ARM ELF relocs to be applied twice

Tim Northover t.p.northover at gmail.com
Sat May 25 01:16:16 PDT 2013


Hi,

This patch is designed to fix PR16013, which notes that ARM's MCJIT
relocation processing can't be reliably applied twice since each
iteration changes the state used by the next. It should allow remote
MCJIT to work reliably on ARM ELF.

The bulk of the patch brings ARM in line with other targets (like
i386) in taking the .rel addends from the object-file as emitted
rather than the one being modified.

However, there is an extra complication which I think deserves review.
The stubs created by the JIT need relocation, but don't actually have
any addend bits to take from the emitted object-file. This means that
none of the generic handling can work for them.

There are two potential solutions to this:
1. Use the R_ARM_PRIVATE_0 special relocation completely internally
within RuntimeDyldELF (see patch).
2. Teach generic RuntimeDyld about the difference between .rel and
.rela relocations, so that it can handle object files emitted using
both styles. Then the stubs would become a .rela style R_ARM_ABS32
with addend 0.

I decided that the second option was rather heavyweight since I can't
see LLVM ever actually emitting both .rel and .rela sections.

OK to commit?

Tim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ARM-use-pristine-object-file-while-processing-reloca.patch
Type: application/octet-stream
Size: 6497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130525/d3717050/attachment.obj>


More information about the llvm-commits mailing list