This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gold patch committed: Don't warn about reloc to warning in same object


This patch fixes gold to not warn about a relocation to a warning symbol
if the relocation is in the same object in which the warning symbol is
defined.  This kind of relocation can occur from debug info or when
compiling with -fPIC.  We can presumably trust the user to not get
confused within the same object file.  In any case, this is how GNU ld
works, as GNU ld issues warnings based on the symbol table, not on the
relocations, so a defined symbol never triggers a warning.  Committed to
mainline.

Ian


2011-06-16  Ian Lance Taylor  <iant@google.com>

	* symtab.cc (Warnings::issue_warning): Don't warn if relocation
	occurs in same object.


Index: symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.153
diff -u -r1.153 symtab.cc
--- symtab.cc	8 Jun 2011 04:05:25 -0000	1.153
+++ symtab.cc	16 Jun 2011 17:52:29 -0000
@@ -3282,6 +3282,12 @@
 			size_t relnum, off_t reloffset) const
 {
   gold_assert(sym->has_warning());
+
+  // We don't want to issue a warning for a relocation against the
+  // symbol in the same object file in which the symbol is defined.
+  if (sym->object() == relinfo->object)
+    return;
+
   Warning_table::const_iterator p = this->warnings_.find(sym->name());
   gold_assert(p != this->warnings_.end());
   gold_warning_at_location(relinfo, relnum, reloffset,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]