<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">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><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>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">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><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div>