<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I will try to explain better what I do.</div><div class=""><br class=""></div><div class="">The main goal behind this is to verify that a part of code is not modified by someone else (it is an integrity check).</div><div class=""><br class=""></div><div class="">To do this, I create in IR a function who take 2 parameters, a begin and an end value.</div><div class=""><br class=""></div><div class="">This function perform an hash over the code area (from begin to end) and return it.</div><div class=""><br class=""></div><div class="">At first, I don’t know the addresses and the hash value so I put random value (it is an integer 64 bits).</div><div class=""><br class=""></div><div class="">The function look like<b class=""> uint32_t isModified(uint64_t* begin, uint64_t* end). </b></div><div class=""><br class=""></div><div class="">Once the compilation is over, I need to update the begin address, end address and the hash value.</div><div class=""><br class=""></div><div class="">When I say the compilation is over, I mean the clang driver has finished all of his action (compiling, linking, etc.).</div><div class=""><br class=""></div><div class="">Greetings,</div><div class=""><br class=""></div><div class="">Johan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 22 Feb 2016, at 15:04, mats petersson <<a href="mailto:mats@planetcatfish.com" class="">mats@planetcatfish.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div dir="ltr" class=""><div class=""><div class=""><div class="">What kind of constant: type, value and how is it created?<br class=""><br class=""></div>You can make public symbols that you can extract in a linker script to a special section.<br class=""><br class=""></div>Or perhaps you want some metadata that a special late state (machine instr) pass is extracting and adding. <br class=""><br class=""></div><div class="">The "best" solution really depends on what you are trying to achieve overall and what kind of data you are working with.<br class=""></div><div class=""><br class="">--<br class=""></div>Mats<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 22 February 2016 at 13:04, Wehrli Johan via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br class="">
<br class="">
I want to know if it is possible to pass information from IR to the final binary (like a constant value)?<br class="">
<br class="">
I have a module pass in IR who make some transformation and, once the compilation is finished, I need to apply a post-processing.<br class="">
<br class="">
The post-processing need information from the IR part.<br class="">
<br class="">
Greetings,<br class="">
<br class="">
Johan<br class="">
<br class="">
<br class="">
<br class="">_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>