<div class="gmail_quote">2009/7/19 Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div style="WORD-WRAP: break-word">
<div>
<div class="im">
<div>On Jul 19, 2009, at 12:43 PM, Aaron Gray wrote:</div>
<blockquote type="cite">
<div class="gmail_quote">2009/7/19 Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div style="WORD-WRAP: break-word"><br>
<div>
<div>
<div>On Jul 19, 2009, at 8:35 AM, Aaron Gray wrote:</div><br>
<blockquote type="cite">
<div>I am getting a simular problem with ___main appearing if <a href="mailto:'@main'" target="_blank">'@main'</a> is used but there is no instance of it in the Module iterators, only in the relocations.</div>


<div> </div>
<div>Is it possible to do something about these 'ghost symbols' and have them defined in Module. Rather than having to check for them and pick them up when processing relocations.</div></blockquote><br></div>You should not be walking the module.</div>

</div></blockquote>
<div> </div>
<div>How else do you get the right symbol info ?</div></div></blockquote>
<div><br></div></div>You see symbol definitions and references come through the code generator.</div>
<div>
<div class="im"><br>
<blockquote type="cite">
<div class="gmail_quote">
<div>But as I have said lowering functions donot generate there substitute value symbols in the Module. They just magically appear in the relocations without being in the module. This is a design flaw in LLVM.</div></div>

</blockquote>
<div><br></div></div>You do not understand how the code generator works.</div>
<div class="im">
<div><br>
<blockquote type="cite">
<div class="gmail_quote">
<div>I have done a hack in the COFF writer's relocation code to get round this for now. But it does not work very well with symbol indexes.</div>
<div> </div>
<div>But am thinking of doing a cleanup pass, or walk the module to get this info.</div>
<div> </div>
<div>What do you mean "You should not be walking the module." ?</div></div></blockquote></div><br></div>
<div>You should not walk the function list of the module.  You should not use Module* for anything other than handling file scope inline asm and walking the global variables.  </div>
<div></div></div></blockquote>
<div> </div>
<div> </div>
<div>Okay.</div>
<div> </div>
<div>Yeah, it just the order semantics of writing COFF files, it would have been nice to have everything upfront. Although when its rewritten using the DOE design, generation and writing will be separated and things will be neater and easier.<br>

<br>Aaron</div>
<div> </div></div>