[llvm-dev] Need help implementing relocations

Josh Sharp via llvm-dev llvm-dev at lists.llvm.org
Sat Mar 30 15:21:23 PDT 2019


In function relocateone() in lld/ELF/Arch/XXX.cpp, I need to compute the difference between the PC and the 'Val' function argument so that I can increment the PC by that difference. Is there a relationship between the PC and 'Loc'? Thanks.

________________________________
From: Tim Northover <t.p.northover at gmail.com>
Sent: Wednesday, March 13, 2019 8:49 AM
To: Josh Sharp
Cc: via llvm-dev
Subject: Re: [llvm-dev] Need help implementing relocations

On Wed, 13 Mar 2019 at 15:14, Josh Sharp <mm92126 at hotmail.com> wrote:
> "it tells the linker to insert the address of
> date when converting this .o file into a final executable."
>
> Which utility do you use to convert .o to .elf and insert the address of 'date'? llvm-objcopy?

The linker in the LLVM project is called "lld". It's pretty good for
ELF, but you'll have to implement the parts for your target
(specifically exactly how R_XXX_MOVI does its job in this case).
Alternatively, if your platform already has GCC support you can use ld
from GNU binutils, but you'll probably have to cross-compile it
yourself.

Cheers.

Tim.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190330/0d2dde9b/attachment.html>


More information about the llvm-dev mailing list