summaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2013-05-21 20:56:13 +0000
committerCary Coutant <ccoutant@google.com>2013-05-21 20:56:13 +0000
commitdedb2627c3410603135a55ab51575d6cefa74485 (patch)
treec710446e8b4bf294da0903fcf03d8458bf0dfb7f /gold
parent23cf2f70b8270feebe67bc7a745f641ea2246662 (diff)
downloadbinutils-redhat-dedb2627c3410603135a55ab51575d6cefa74485.tar.gz
gold/
* object.cc (Sized_relobj_file::get_symbol_location_info): Set type of enclosing symbol. (Relocate_info::location): Check symbol type when describing symbol. * object.h (Symbol_location_info): Remove unused line_number; add enclosing_symbol_type. * testsuite/debug_msg.sh: Adjust expected output.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog9
-rw-r--r--gold/object.cc13
-rw-r--r--gold/object.h4
-rwxr-xr-xgold/testsuite/debug_msg.sh15
4 files changed, 25 insertions, 16 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index fb612f66ad..c0fd434a31 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,12 @@
+2013-05-21 Cary Coutant <ccoutant@google.com>
+
+ * object.cc (Sized_relobj_file::get_symbol_location_info): Set
+ type of enclosing symbol.
+ (Relocate_info::location): Check symbol type when describing symbol.
+ * object.h (Symbol_location_info): Remove unused line_number;
+ add enclosing_symbol_type.
+ * testsuite/debug_msg.sh: Adjust expected output.
+
2013-05-13 Cary Coutant <ccoutant@google.com>
* configure.ac: Export DEFAULT_TARGET.
diff --git a/gold/object.cc b/gold/object.cc
index 715f7acd4a..1f113d14fa 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -1,6 +1,6 @@
// object.cc -- support for an object file for linking in gold
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
// Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
@@ -2687,6 +2687,7 @@ Sized_relobj_file<size, big_endian>::get_symbol_location_info(
&& (static_cast<off_t>(sym.get_st_value() + sym.get_st_size())
> offset))
{
+ info->enclosing_symbol_type = sym.get_st_type();
if (sym.get_st_name() > names_size)
info->enclosing_symbol_name = "(invalid)";
else
@@ -2996,12 +2997,10 @@ Relocate_info<size, big_endian>::location(size_t, off_t offset) const
ret += ":";
ret += info.source_file;
}
- size_t len = info.enclosing_symbol_name.length() + 100;
- char* buf = new char[len];
- snprintf(buf, len, _(":function %s"),
- info.enclosing_symbol_name.c_str());
- ret += buf;
- delete[] buf;
+ ret += ":";
+ if (info.enclosing_symbol_type == elfcpp::STT_FUNC)
+ ret += _("function ");
+ ret += info.enclosing_symbol_name;
return ret;
}
diff --git a/gold/object.h b/gold/object.h
index a2baecc0d0..c17c13d285 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -1,6 +1,6 @@
// object.h -- support for an object file for linking in gold -*- C++ -*-
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
// Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
@@ -103,7 +103,7 @@ struct Symbol_location_info
{
std::string source_file;
std::string enclosing_symbol_name;
- int line_number;
+ elfcpp::STT enclosing_symbol_type;
};
// Data about a single relocation section. This is read in
diff --git a/gold/testsuite/debug_msg.sh b/gold/testsuite/debug_msg.sh
index 8c10d31b98..1227f3f070 100755
--- a/gold/testsuite/debug_msg.sh
+++ b/gold/testsuite/debug_msg.sh
@@ -2,7 +2,8 @@
# debug_msg.sh -- a test case for printing debug info for missing symbols.
-# Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2013
+# Free Software Foundation, Inc.
# Written by Ian Lance Taylor <iant@google.com>.
# This file is part of gold.
@@ -55,9 +56,9 @@ check_missing()
# We don't know how the compiler might order these variables, so we
# can't test for the actual offset from .data, hence the regexp.
-check debug_msg.err "debug_msg.o:debug_msg.cc:function fn_array: error: undefined reference to 'undef_fn1()'"
-check debug_msg.err "debug_msg.o:debug_msg.cc:function fn_array: error: undefined reference to 'undef_fn2()'"
-check debug_msg.err "debug_msg.o:debug_msg.cc:function badref1: error: undefined reference to 'undef_int'"
+check debug_msg.err "debug_msg.o:debug_msg.cc:fn_array: error: undefined reference to 'undef_fn1()'"
+check debug_msg.err "debug_msg.o:debug_msg.cc:fn_array: error: undefined reference to 'undef_fn2()'"
+check debug_msg.err "debug_msg.o:debug_msg.cc:badref1: error: undefined reference to 'undef_int'"
# These tests check only for the source file's file name (not the complete
# path) because use of -fdebug-prefix-map may change the path to the source
@@ -93,9 +94,9 @@ check debug_msg.err "odr_violation2.cc:27"
# Check for the same error messages when using --compressed-debug-sections.
if test -r debug_msg_cdebug.err
then
- check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:function fn_array: error: undefined reference to 'undef_fn1()'"
- check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:function fn_array: error: undefined reference to 'undef_fn2()'"
- check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:function badref1: error: undefined reference to 'undef_int'"
+ check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:fn_array: error: undefined reference to 'undef_fn1()'"
+ check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:fn_array: error: undefined reference to 'undef_fn2()'"
+ check debug_msg_cdebug.err "debug_msg_cdebug.o:debug_msg.cc:badref1: error: undefined reference to 'undef_int'"
check debug_msg_cdebug.err ".*/debug_msg.cc:50: error: undefined reference to 'undef_fn1()'"
check debug_msg_cdebug.err ".*/debug_msg.cc:55: error: undefined reference to 'undef_fn2()'"
check debug_msg_cdebug.err ".*/debug_msg.cc:43: error: undefined reference to 'undef_fn1()'"