<div class="socmaildefaultfont" dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div dir="ltr" style="font-family:Arial, Helvetica, sans-serif;font-size:10pt" ><div dir="ltr" >Hi,</div>
<div dir="ltr" >Our linker uses the libLTO interface. Given an lto_module_t, we are trying to check if it contains the @llvm.global_ctors or the @llvm.global_dtors global variables. We need to know this information in order to decide whether to include a bitcode archive member in the LTO step or not.</div>
<div dir="ltr" > </div>
<div dir="ltr" >Typically, symbols in a module are visited using the `lto_module_get_[num_symbols|symbol_name|symbol_attribute]` API, but it seems that symbols starting with "llvm." are skipped.</div>
<div dir="ltr" ><br>Is there a way to check for the existence of these ctor/dtor variables in an LTO module (through the libLTO API)?<br><br>If not, then I can think of two ways to solve it:</div>
<div dir="ltr" > 1) add a new function to libLTO that returns true if either of the two variables are present. Alternatively it can return a list of variable names (essentially the contents of @llvm.global_ctors or @llvm.global_dtors)</div>
<div dir="ltr" > 2) add a new attribute to `lto_symbol_attributes` denoting that the given symbol is a constructor or a destructor (i.e. is present in either @llvm.global_ctors or @llvm.global_dtors)</div>
<div dir="ltr" > </div>
<div dir="ltr" >Thank you for your feedback</div>
<div dir="ltr" > </div>
<div dir="ltr" >Wael Yehia<br>wyehia@ca.ibm.com</div></div></div></div><BR>
<BR>