[PATCH] [AArch64] Add missing PCRel relocations for AArch64 in RuntimeDyldELF

Lang Hames lhames at gmail.com
Thu Feb 6 14:58:48 PST 2014


Hi All,

Andy's right - we don't want to rule out small code model just because
some (or even most) memory management schemes wouldn't support it. If
the client can supply a memory manager that will satisfy the
constraints of the small code model on their platform then we should
be able to apply the necessary relocations.

Cheers,
Lang.


On Wed, Feb 5, 2014 at 10:08 AM, Kaylor, Andrew <andrew.kaylor at intel.com> wrote:
> Hi Tim,
>
> I think you're right about the hazards of mmap as it relates to small memory model.  I tried a variation in allocateMappedMemory that used the MAP_32BIT flag in some circumstances to try to address this issue, but apparently that flag is only supported on x86-64 platforms so I abandoned that approach.
>
> I suspect that for most application it would be sufficient to just have adequate error handling to catch the rare circumstance where memory can't be allocated within 2GB proximity.  I don't have any evidence for this, but I suspect that it's likely to be a failure on the order of an out-of-memory condition.
>
> For guaranteed success, I think we'd need something like the patch that Vaidas Gasiunas submitted which calculates the total size of a loaded image in advance to allow memory manager's to pre-allocate a single block of pages to hold the memory.
>
> -Andy
>
> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Tim Northover
> Sent: Wednesday, February 05, 2014 5:11 AM
> To: bradley.smith at arm.com
> Cc: llvm-commits at cs.uiuc.edu
> Subject: Re: [PATCH] [AArch64] Add missing PCRel relocations for AArch64 in RuntimeDyldELF
>
>
>   Hi Bradley,
>
>   I think this patch might be opening up a can of worms. AArch64 doesn't support the small memory model at all in MCJIT at the moment. The relocations you've added are necessary, but only a small section of the ones that would be needed.
>
>   I'm also a little concerned about enabling small memory-model JIT tests in general. Linux's mmap seems to make startlingly few guarantees about just how close to your requested address the memory you get will be (at least on its man page). It sounds like something that will work most of the time, but might randomly fail in some odd set of circumstances.
>
>   Cheers.
>
>   Tim.
>
>
> ================
> Comment at: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:459
> @@ +458,3 @@
> +    // Operation: Page(S+A) - Page(P)
> +    uint64_t Result = ((Value + Addend) & ~0xfffU) - (FinalAddress & ~0xfffU);
> +
> ----------------
> Shouldn't the constants be ULL? I'd have thought ~0xfffU would be (unsigned)0xfffff000 and then get zero-extended to 64-bits.
>
>
> http://llvm-reviews.chandlerc.com/D2696
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list