* powerpc.c (Target_powerpc::Scan::global): Don't emit relative
authorAlan Modra <amodra@gmail.com>
Fri, 30 Nov 2012 05:01:20 +0000 (05:01 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 30 Nov 2012 05:01:20 +0000 (05:01 +0000)
relocs against protected symbols when building 32-bit shared libs.

gold/ChangeLog
gold/powerpc.cc

index ae44916ac6592bd7e2ff7966987a20f91a5e4f90..92cbe1465ab9bfc5f8c82039e7fa039784ccacbe 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-30  Alan Modra  <amodra@gmail.com>
+
+       * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
+       relocs against protected symbols when building 32-bit shared libs.
+
 2012-11-30  Alan Modra  <amodra@gmail.com>
 
        * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
index 0c5288f79134429a0964a28d831748cb84b1eabf..a3bb9f2683ad939223e628b58b6f199c4f924cd7 100644 (file)
@@ -3664,11 +3664,15 @@ Target_powerpc<size, big_endian>::Scan::global(
                target->copy_reloc(symtab, layout, object,
                                   data_shndx, output_section, gsym, reloc);
              }
-           else if (((size == 32 && r_type == elfcpp::R_POWERPC_ADDR32)
-                     || (size == 64 && r_type == elfcpp::R_PPC64_ADDR64))
-                    && (gsym->can_use_relative_reloc(false)
-                        || (size == 64
-                            && data_shndx == ppc_object->opd_shndx())))
+           else if ((size == 32
+                     && r_type == elfcpp::R_POWERPC_ADDR32
+                     && gsym->can_use_relative_reloc(false)
+                     && !(gsym->visibility() == elfcpp::STV_PROTECTED
+                          && parameters->options().shared()))
+                    || (size == 64
+                        && r_type == elfcpp::R_PPC64_ADDR64
+                        && (gsym->can_use_relative_reloc(false)
+                            || data_shndx == ppc_object->opd_shndx())))
              {
                Reloc_section* rela_dyn = target->rela_dyn_section(layout);
                unsigned int dynrel = elfcpp::R_POWERPC_RELATIVE;