Wehrli Johan via llvm-dev
2016-Feb-22 13:04 UTC
[llvm-dev] Transfer information IR to binary
Hi, I want to know if it is possible to pass information from IR to the final binary (like a constant value)? I have a module pass in IR who make some transformation and, once the compilation is finished, I need to apply a post-processing. The post-processing need information from the IR part. Greetings, Johan -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160222/068b71c6/attachment.sig>
mats petersson via llvm-dev
2016-Feb-22 14:04 UTC
[llvm-dev] Transfer information IR to binary
What kind of constant: type, value and how is it created? You can make public symbols that you can extract in a linker script to a special section. Or perhaps you want some metadata that a special late state (machine instr) pass is extracting and adding. The "best" solution really depends on what you are trying to achieve overall and what kind of data you are working with. -- Mats On 22 February 2016 at 13:04, Wehrli Johan via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > I want to know if it is possible to pass information from IR to the final > binary (like a constant value)? > > I have a module pass in IR who make some transformation and, once the > compilation is finished, I need to apply a post-processing. > > The post-processing need information from the IR part. > > Greetings, > > Johan > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160222/110f81e1/attachment.html>
Wehrli Johan via llvm-dev
2016-Feb-22 14:45 UTC
[llvm-dev] Transfer information IR to binary
I will try to explain better what I do. The main goal behind this is to verify that a part of code is not modified by someone else (it is an integrity check). To do this, I create in IR a function who take 2 parameters, a begin and an end value. This function perform an hash over the code area (from begin to end) and return it. At first, I don’t know the addresses and the hash value so I put random value (it is an integer 64 bits). The function look like uint32_t isModified(uint64_t* begin, uint64_t* end). Once the compilation is over, I need to update the begin address, end address and the hash value. When I say the compilation is over, I mean the clang driver has finished all of his action (compiling, linking, etc.). Greetings, Johan> On 22 Feb 2016, at 15:04, mats petersson <mats at planetcatfish.com> wrote: > > What kind of constant: type, value and how is it created? > > You can make public symbols that you can extract in a linker script to a special section. > > Or perhaps you want some metadata that a special late state (machine instr) pass is extracting and adding. > > The "best" solution really depends on what you are trying to achieve overall and what kind of data you are working with. > > -- > Mats > > On 22 February 2016 at 13:04, Wehrli Johan via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > Hi, > > I want to know if it is possible to pass information from IR to the final binary (like a constant value)? > > I have a module pass in IR who make some transformation and, once the compilation is finished, I need to apply a post-processing. > > The post-processing need information from the IR part. > > Greetings, > > Johan > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160222/dab6e7f8/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160222/dab6e7f8/attachment.sig>