- <p>The <tt>LLVMSymbol</tt> class is used to describe the externally visible
- functions and global variables, defined in LLVM bytecode files, to the linker.
- This includes symbol visibility information. This information is used by
- the linker to do symbol resolution. For example: function <tt>foo2()</tt> is
- defined inside an LLVM bytecode module and it is an externally visible symbol.
- This helps the linker connect the use of <tt>foo2()</tt> in native object
- files with a future definition of the symbol <tt>foo2()</tt>. The linker
- will see the actual definition of <tt>foo2()</tt> when it receives the
- optimized native object file in
- <a href="#phase4">Symbol Resolution after optimization</a> phase. If the
- linker does not find any uses of <tt>foo2()</tt>, it updates LLVMSymbol
- visibility information to notify LLVM intermodular optimizer that it is dead.
- The LLVM intermodular optimizer takes advantage of such information to
- generate better code.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
- <a name="readllvmobjectfile">readLLVMObjectFile()</a>
-</div>
-
-<div class="doc_text">
- <p>The <tt>readLLVMObjectFile()</tt> function is used by the linker to read
- LLVM bytecode files and collect LLVMSymbol innformation. This routine also
- supplies a list of externally defined symbols that are used by LLVM bytecode
- files. The linker uses this symbol information to do symbol resolution.
- Internally, <a href="#lto">LLVMlto</a> maintains LLVM bytecode modules in
- memory. This function also provides a list of external references used by
- bytecode files.</p>
+ <p>A non-native object file is handled via an <tt>lto_module_t</tt>.
+ The following functions allow the linker to check if a file (on disk
+ or in a memory buffer) is a file which libLTO can process: <pre>
+ lto_module_is_object_file(const char*)
+ lto_module_is_object_file_for_target(const char*, const char*)
+ lto_module_is_object_file_in_memory(const void*, size_t)
+ lto_module_is_object_file_in_memory_for_target(const void*, size_t, const char*)</pre>
+ If the object file can be processed by libLTO, the linker creates a
+ <tt>lto_module_t</tt> by using one of <pre>
+ lto_module_create(const char*)
+ lto_module_create_from_memory(const void*, size_t)</pre>
+ and when done, the handle is released via<pre>
+ lto_module_dispose(lto_module_t)</pre>
+ The linker can introspect the non-native object file by getting the number
+ of symbols and getting the name and attributes of each symbol via: <pre>
+ lto_module_get_num_symbols(lto_module_t)
+ lto_module_get_symbol_name(lto_module_t, unsigned int)
+ lto_module_get_symbol_attribute(lto_module_t, unsigned int)</pre>
+ The attributes of a symbol include the alignment, visibility, and kind.
+</p>