*** empty log message ***
[deliverable/binutils-gdb.git] / bfd / peXXigen.c
index 825229aab930a158ca0d20c7d8d88955ebdb2ecd..e5065464c05f36cac182f857c23184be55790131 100644 (file)
@@ -2418,7 +2418,9 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
     }
 
   h1 = coff_link_hash_lookup (coff_hash_table (info),
-                             "__tls_used", FALSE, FALSE, TRUE);
+                             (bfd_get_symbol_leading_char(abfd) != 0
+                              ? "__tls_used" : "_tls_used"),
+                             FALSE, FALSE, TRUE);
   if (h1 != NULL)
     {
       if ((h1->root.type == bfd_link_hash_defined
@@ -2456,15 +2458,23 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
 
     if (sec)
       {
-       bfd_size_type x = sec->rawsize ? sec->rawsize : sec->size;
+       bfd_size_type x = sec->rawsize;
+       bfd_byte *tmp_data = NULL;
 
-       if (x && bfd_get_section_contents (abfd, sec, pfinfo->contents, 0, x))
+       if (x)
+         tmp_data = bfd_malloc (x);
+
+       if (tmp_data != NULL)
          {
-           qsort (pfinfo->contents,
-                  (size_t) ((sec->size <x ? sec->size : x) / 12),
-                  12, sort_x64_pdata);
-           bfd_set_section_contents (pfinfo->output_bfd, sec,
-                                     pfinfo->contents, 0, x);
+           if (bfd_get_section_contents (abfd, sec, tmp_data, 0, x))
+             {
+               qsort (tmp_data,
+                      (size_t) (x / 12),
+                      12, sort_x64_pdata);
+               bfd_set_section_contents (pfinfo->output_bfd, sec,
+                                         tmp_data, 0, x);
+             }
+           free (tmp_data);
          }
       }
   }
This page took 0.023603 seconds and 4 git commands to generate.