From 1fcd0f15813d390b1c5cc04811fcca3ff761ddb5 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Tue, 26 Jul 2011 08:40:36 +0000 Subject: [PATCH] Don't try to dereference syms[0] on an empty vector. Reported by Todd Jackson and Jeffrey Bosboom! llvm-svn: 136066 --- llvm/tools/gold/gold-plugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 9e43bef31f8e..8cb4fb4bca41 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -360,6 +360,8 @@ static ld_plugin_status all_symbols_read_hook(void) { bool anySymbolsPreserved = false; for (std::list::iterator I = Modules.begin(), E = Modules.end(); I != E; ++I) { + if (I->syms.empty()) + continue; (*get_symbols)(I->handle, I->syms.size(), &I->syms[0]); for (unsigned i = 0, e = I->syms.size(); i != e; i++) { if (I->syms[i].resolution == LDPR_PREVAILING_DEF) {