diff -Naur binutils-2.21-old/gold/plugin.cc binutils-2.21-new/gold/plugin.cc
--- binutils-2.21-old/gold/plugin.cc	2010-10-14 15:10:22.000000000 -0700
+++ binutils-2.21-new/gold/plugin.cc	2010-12-08 07:11:30.000000000 -0800
@@ -668,28 +668,50 @@
           break;
         }
 
-      switch (isym->visibility)
-        {
-        case LDPV_PROTECTED:
-          vis = elfcpp::STV_PROTECTED;
-          break;
-        case LDPV_INTERNAL:
-          vis = elfcpp::STV_INTERNAL;
-          break;
-        case LDPV_HIDDEN:
-          vis = elfcpp::STV_HIDDEN;
-          break;
-        case LDPV_DEFAULT:
-        default:
-          vis = elfcpp::STV_DEFAULT;
-          break;
-        }
-
       if (isym->comdat_key != NULL
           && isym->comdat_key[0] != '\0'
           && !this->include_comdat_group(isym->comdat_key, layout))
         shndx = elfcpp::SHN_UNDEF;
 
+      if (shndx == elfcpp::SHN_UNDEF)
+      {
+        switch (isym->visibility)
+          {
+          case LDPV_PROTECTED:
+            vis = elfcpp::STV_DEFAULT;
+            break;
+          case LDPV_INTERNAL:
+            vis = elfcpp::STV_DEFAULT;
+            break;
+          case LDPV_HIDDEN:
+            vis = elfcpp::STV_DEFAULT;
+            break;
+          case LDPV_DEFAULT:
+          default:
+            vis = elfcpp::STV_DEFAULT;
+            break;
+          }
+      }
+      else
+      {
+        switch (isym->visibility)
+          {
+          case LDPV_PROTECTED:
+            vis = elfcpp::STV_PROTECTED;
+            break;
+          case LDPV_INTERNAL:
+            vis = elfcpp::STV_INTERNAL;
+            break;
+          case LDPV_HIDDEN:
+            vis = elfcpp::STV_HIDDEN;
+            break;
+          case LDPV_DEFAULT:
+          default:
+            vis = elfcpp::STV_DEFAULT;
+            break;
+          }
+      }
+
       osym.put_st_name(0);
       osym.put_st_value(0);
       osym.put_st_size(static_cast<Elf_size_type>(isym->size));
