[PATCH] [mips] Resolve relocation for the stubs in MCJIT when load address is known

Kaylor, Andrew andrew.kaylor at intel.com
Mon Nov 18 13:49:11 PST 2013


I don't think this patch is quite correct for two reasons.

First, in the call to resolveMIPSRelocation, the Section parameter refers to the section which contains the location to which the relocation is being applied while the Value parameter contains the LoadAddress of the symbol to which the relocation refers (in this case the section containing the stub).

It looks like the RuntimeDyldELF handling of this relocation guarantees the section containing the symbol to which the relocation refers will always be the same as the section which is the target of the relocation for the R_MIPS_26 relocation type, but in the general case (that is, across the ELF relocation handling) that isn't true.  The change you made to resolveMIPSRelocation will calculate the right value, I think, but I don't believe that change is even necessary.  Unless I'm mistaken, the line "Value = Section.LoadAddress + Addend" will not change the value of Value, which already contained the Value input argument (which should have been the section load address) + the Addend argument.  If this is true, the new change will just introduce potentially misleading code.

The second issue is more serious.  In RuntimeDyldELF::processRelocationRef, where you made your other change, there were two possible places where the old code would have attempted to apply the relocation immediately.  The place where you made your change handles the case where a new stub is created.  However, a few lines above that there is a place where the code found that the needed stub already existed and it attempts to immediately apply a relocation referencing that stub location.  I believe you also need to update that code.

-Andy


From: Petar Jovanovic [mailto:Petar.Jovanovic at imgtec.com]
Sent: Monday, November 18, 2013 12:46 PM
To: llvm-commits at cs.uiuc.edu
Cc: Kaylor, Andrew; NAKAMURA Takumi
Subject: [PATCH] [mips] Resolve relocation for the stubs in MCJIT when load address is known

Hi everyone,

here is a patch for several MIPS MCJIT failures.

Regards,
Petar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131118/b2734b0a/attachment.html>


More information about the llvm-commits mailing list