summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-02-15 22:49:17 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-02-15 22:49:17 +0000
commite0afaa301d763096af400ef44714b0f4deb5b68b (patch)
tree31048e173f598af0b2dec78c64e4827c50b36551 /tools
parent225f7474863a11a7baded7d6505400ce3328331e (diff)
downloadllvm-e0afaa301d763096af400ef44714b0f4deb5b68b.tar.gz
llvm-e0afaa301d763096af400ef44714b0f4deb5b68b.tar.bz2
llvm-e0afaa301d763096af400ef44714b0f4deb5b68b.tar.xz
Don't discard definitions of common symbols. Not sure if this is the right fix.
Before this change, the program: int var; int main(void) { return 0; } when run under 'nm -g' would show 'U var' with the gold plugin and 'B var' with gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/gold/gold-plugin.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index a974d81d32..8776d848da 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -290,7 +290,11 @@ ld_plugin_status all_symbols_read_hook(void) {
E = Modules.end(); I != E; ++I) {
(*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) {
+ (*message)(LDPL_WARNING, "def: %d visibility: %d resolution %d",
+ I->syms[i].def, I->syms[i].visibility, I->syms[i].resolution);
+ if (I->syms[i].resolution == LDPR_PREVAILING_DEF ||
+ (I->syms[i].def == LDPK_COMMON &&
+ I->syms[i].resolution == LDPR_RESOLVED_IR)) {
lto_codegen_add_must_preserve_symbol(cg, I->syms[i].name);
anySymbolsPreserved = true;
}