<div dir="ltr">Just to close this out, I've updated <a href="http://reviews.llvm.org/D19904">http://reviews.llvm.org/D19904</a> to use named ELF groups per-function, and have the runtime library use __start_xray_instr_map and __stop_xray_instr_map as weak symbols from the C++ side. I've sent a patch to make creating these COMDAT/Group sections easier when lowering through the MCStreamer interface (<a href="http://reviews.llvm.org/D21743">http://reviews.llvm.org/D21743</a>).<div><br></div><div>Cheers</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jun 24, 2016 at 4:23 AM Dean Michael Berris <<a href="mailto:dberris@google.com">dberris@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Awesome, thanks Peter!<div><br></div><div>Cheers</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 23, 2016 at 10:35 AM Peter Collingbourne <<a href="mailto:peter@pcc.me.uk" target="_blank">peter@pcc.me.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If you give your section a valid C identifier name, i.e. something like "xray_instr_map" (no period), the linker will synthesize symbols named "__start_xray_instr_map" and "__stop_xray_instr_map", which will point to the start and end of the combined section.<div><br></div><div>Peter</div></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 23, 2016 at 10:26 AM, Dean Michael Berris via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>As part of working on XRay, I'm trying to accomplish the following: create a section that contains an array of entries pertaining to the instrumentation map (nop sleds) in an object file, and have those merged into a single section in the final binary where the contents are concatenated. The trick though is I'd like to be able to reference the whole array with a single symbol (or two, one to mark the start and the other to mark the end). I'm trying to get this to work initially on x86 and Linux (ELF).</div><div><br></div><div>What I've got currently in <a href="http://reviews.llvm.org/D19904" target="_blank">http://reviews.llvm.org/D19904</a> creates this section (.xray_instr_map) and defines two globals in that section named "__xray_instr_map" and "__xray_instr_map_end". The problem inevitably with this approach is that having multiple object files have these definitions cause issues with multiple definition violations at link time.</div><div><br></div><div>I *think* the solution involves having COMDAT sections per-function that has the instrumentation points, then have those concatenated into a single .xray_instr_map section.</div><div><br></div><div>What I'm not sure about is how to define the "__xray_instr_map" and "__xray_instr_map" symbols such that they refer to the contents of the section in the final binary.</div><div><br></div><div>Thoughts?</div></div>
<br></blockquote></div></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div></div><div class="gmail_extra"><br><br clear="all"><div><br></div>-- <br><div class="m_-6885163122044409587m_8924424613974271971gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></blockquote></div></blockquote></div>