<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">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>