Don't generate PLT entries for symbols defined in a regular object for
authorkettenis <kettenis@openbsd.org>
Thu, 25 Dec 2014 23:11:21 +0000 (23:11 +0000)
committerkettenis <kettenis@openbsd.org>
Thu, 25 Dec 2014 23:11:21 +0000 (23:11 +0000)
-static -pie.

On sparc64, avoid generating GLOB_DAT relocs and convert certain absolute
relocs into RELATIVE relocs when we can for -static -pie.

With this change we don't need -Wl,-Bsymbolic anymore when building -static
-pie binaries.

ok millert@, kurt@

gnu/usr.bin/binutils-2.17/bfd/elflink.c
gnu/usr.bin/binutils-2.17/bfd/elfxx-sparc.c

index afb05a7..ee15972 100644 (file)
@@ -2327,7 +2327,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
   if (h->needs_plt
       && eif->info->shared
       && is_elf_hash_table (eif->info->hash)
-      && (eif->info->symbolic
+      && (eif->info->symbolic || eif->info->static_link
          || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
       && h->def_regular)
     {
index 1bf2011..11a7f8d 100644 (file)
@@ -2842,7 +2842,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
              /* h->dynindx may be -1 if the symbol was marked to
                 become local.  */
              else if (h != NULL && ! is_plt
-                      && ((! info->symbolic && h->dynindx != -1)
+                      && ((!info->symbolic && !info->static_link
+                           && h->dynindx != -1)
                           || !h->def_regular))
                {
                  BFD_ASSERT (h->dynindx != -1);
@@ -3731,7 +3732,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
         The entry in the global offset table will already have been
         initialized in the relocate_section function.  */
       if (info->shared
-         && (info->symbolic || h->dynindx == -1)
+         && (info->symbolic || info->static_link || h->dynindx == -1)
          && h->def_regular)
        {
          asection *sec = h->root.u.def.section;