2010-03-22 Doug Kwan <dougkwan@google.com>
[binutils-gdb.git] / gold / copy-relocs.cc
index 4a98f8366a965c66136a25b5a5529d86ffa5e327..1ff7ffebd69aa2e65c970300761be702aa02d0ef 100644 (file)
@@ -1,6 +1,6 @@
 // copy-relocs.cc -- handle COPY relocations for gold.
 
-// Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
+// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -132,6 +132,9 @@ Copy_relocs<sh_type, size, big_endian>::emit_copy_reloc(
   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");