This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: COPY relocs need the dynamic object
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Thu, 07 Jan 2010 11:34:10 -0800
- Subject: gold patch committed: COPY relocs need the dynamic object
PR 11042 is about a case where --as-needed is used with a shared
library, and the only reference to that shared library is via a COPY
reloc. gold was not considering the library as needed for purposes of
--as-needed. I committed this patch to fix this bug.
Ian
2010-01-07 Ian Lance Taylor <iant@google.com>
PR 11042
* copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
object as needed.
Index: copy-relocs.cc
===================================================================
RCS file: /cvs/src/src/gold/copy-relocs.cc,v
retrieving revision 1.7
diff -p -u -r1.7 copy-relocs.cc
--- copy-relocs.cc 30 Dec 2009 06:57:17 -0000 1.7
+++ copy-relocs.cc 7 Jan 2010 19:32:05 -0000
@@ -132,6 +132,9 @@ Copy_relocs<sh_type, size, big_endian>::
while ((value & (addralign - 1)) != 0)
addralign >>= 1;
+ // Mark the dynamic object as needed for the --as-needed option.
+ sym->object()->set_is_needed();
+
if (this->dynbss_ == NULL)
{
this->dynbss_ = new Output_data_space(addralign, "** dynbss");