[LLVMdev] Fix crash in gold LTO plugin

Todd Jackson quantum.skyline at gmail.com
Mon Jul 25 20:13:50 PDT 2011

While doing research using the LLVM link time optimizer, we discovered
a bug in the LTO plugin.   After running the passes, the plugin tries to
tell gold about 0 symbols produced from a bitcode file, indexing an
empty vector in the expression &I->syms[0].  We're not completely sure
if this is the best patch or if it is a symptom of a larger problem,
but it worked for us.  When we found this, all of the input bitcode
files had at least one symbol before running passes.

The attached patch for 2.9 places a guard around the calls to the
add_symbols plugin
callback to only report symbols when the vector of symbols in the
claimed_file is nonempty.

Full credit for discovery and the patch goes to Jeffrey Bosboom.


Todd Jackson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gold-plugin.patch
Type: application/octet-stream
Size: 1142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110725/3eef7775/attachment.obj>

More information about the llvm-dev mailing list