PR21017, microblaze missing _GLOBAL_OFFSET_TABLE_ symbol
authorAlan Modra <amodra@gmail.com>
Tue, 8 Aug 2017 04:35:33 +0000 (14:05 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 8 Aug 2017 04:38:43 +0000 (14:08 +0930)
PR 21017
* elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump
got.refcount for GOTOFF relocs, just create .got section.

bfd/ChangeLog
bfd/elf32-microblaze.c

index 3ed2e9e16d7c26e225908080f9708bdac9a26979..f42cb5f7dc06126df30c6dd20db1d3031efc1bc3 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-08  Alan Modra  <amodra@gmail.com>
+
+       PR 21017
+       * elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump
+       got.refcount for GOTOFF relocs, just create .got section.
+
 2017-08-07  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elflink.c (elf_link_add_object_symbols): Move common symbol
index 265773675cafd097d3f8469eac5751d71ce72fda..94ef09ed4a7cfa32fcc871da11a39a997060e139 100644 (file)
@@ -2353,7 +2353,6 @@ microblaze_elf_check_relocs (bfd * abfd,
         dogottls:
           sec->has_tls_reloc = 1;
          /* Fall through.  */
-        case R_MICROBLAZE_GOTOFF_64:
         case R_MICROBLAZE_GOT_64:
           if (htab->elf.sgot == NULL)
             {
@@ -2374,6 +2373,17 @@ microblaze_elf_check_relocs (bfd * abfd,
            }
           break;
 
+       case R_MICROBLAZE_GOTOFF_64:
+       case R_MICROBLAZE_GOTOFF_32:
+         if (htab->elf.sgot == NULL)
+           {
+             if (htab->elf.dynobj == NULL)
+               htab->elf.dynobj = abfd;
+             if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
+               return FALSE;
+           }
+         break;
+
         case R_MICROBLAZE_64:
         case R_MICROBLAZE_64_PCREL:
         case R_MICROBLAZE_32: