* peicode.h (coff_swap_scnhdr_out): Set IMAGE_SCN_MEM_DISCARDABLE
authorIan Lance Taylor <ian@airs.com>
Wed, 15 Oct 1997 18:17:40 +0000 (18:17 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 15 Oct 1997 18:17:40 +0000 (18:17 +0000)
for .stab* sections.  Replace strlen of constant strings with
number.

bfd/ChangeLog
bfd/peicode.h

index e0fb98049630b7c9b3cfd3d74dd5b4f0d3554d5e..5e266565225099e7b735f3697d84a9bacb3d0424 100644 (file)
@@ -1,3 +1,9 @@
+Wed Oct 15 13:45:10 1997  Ian Lance Taylor  <ian@cygnus.com>
+
+       * peicode.h (coff_swap_scnhdr_out): Set IMAGE_SCN_MEM_DISCARDABLE
+       for .stab* sections.  Replace strlen of constant strings with
+       number.
+
 Tue Oct 14 15:42:45 1997  Richard Henderson  <rth@cygnus.com>
 
        * elf64-alpha.c (elf64_alpha_merge_ind_symbols): New function to
index b365ea2d53dff6867539b36e4e0df49b3836af97..b20682930be03511c4ecb02af72febecf3e7829a 100644 (file)
@@ -52,6 +52,7 @@ Most of this hacked by  Steve Chamberlain,
    wasting too much time.
 */
 
+#undef coff_bfd_print_private_bfd_data
 #define coff_bfd_print_private_bfd_data pe_print_private_bfd_data
 #define coff_mkobject pe_mkobject
 #define coff_mkobject_hook pe_mkobject_hook
@@ -1130,6 +1131,9 @@ coff_swap_scnhdr_out (abfd, in, out)
   /* FIXME: even worse, I don't see how to get the original alignment field*/
   /*        back...                                                        */
 
+  /* FIXME: Basing this on section names is bogus.  Also, this should
+     be in sec_to_styp_flags.  */
+
   {
     int flags = scnhdr_int->s_flags;
     if (strcmp (scnhdr_int->s_name, ".data")  == 0 ||
@@ -1151,16 +1155,16 @@ coff_swap_scnhdr_out (abfd, in, out)
                          IMAGE_SCN_MEM_READ ;
     /* Remember this field is a max of 8 chars, so the null is _not_ there
        for an 8 character name like ".reldata". (yep. Stupid bug) */
-    else if (strncmp (scnhdr_int->s_name, ".reldata", strlen(".reldata")) == 0)
+    else if (strncmp (scnhdr_int->s_name, ".reldata", 8) == 0)
       flags =  IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_8BYTES |
               IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE ;
     else if (strcmp (scnhdr_int->s_name, ".ydata") == 0)
       flags =  IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_8BYTES |
               IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE ;
-    else if (strncmp (scnhdr_int->s_name, ".drectve", strlen(".drectve")) == 0)
+    else if (strncmp (scnhdr_int->s_name, ".drectve", 8) == 0)
       flags =  IMAGE_SCN_LNK_INFO | IMAGE_SCN_LNK_REMOVE ;
 #ifdef POWERPC_LE_PE
-    else if (strncmp (scnhdr_int->s_name, ".stabstr", strlen(".stabstr")) == 0)
+    else if (strncmp (scnhdr_int->s_name, ".stabstr", 8) == 0)
       {
        flags =  IMAGE_SCN_LNK_INFO;
       }
@@ -1169,6 +1173,8 @@ coff_swap_scnhdr_out (abfd, in, out)
        flags =  IMAGE_SCN_LNK_INFO;
       }
 #endif
+    else
+      flags = IMAGE_SCN_MEM_READ;
 
     bfd_h_put_32(abfd, flags, (bfd_byte *) scnhdr_ext->s_flags);
   }
@@ -1231,6 +1237,8 @@ pe_print_idata(abfd, vfile)
 #ifdef POWERPC_LE_PE
   asection *rel_section = bfd_get_section_by_name (abfd, ".reldata");
 #endif
+    else if (strncmp (scnhdr_int->s_name, ".stab", 5) == 0)
+      flags |= IMAGE_SCN_LNK_INFO | IMAGE_SCN_MEM_DISCARDABLE;
 
   bfd_size_type datasize = 0;
   bfd_size_type i;
@@ -1940,6 +1948,7 @@ pe_mkobject_hook (abfd, filehdr, aouthdr)
 /* Copy any private info we understand from the input bfd
    to the output bfd.  */
 
+#undef coff_bfd_copy_private_bfd_data
 #define coff_bfd_copy_private_bfd_data pe_bfd_copy_private_bfd_data
 
 static boolean
This page took 0.030734 seconds and 4 git commands to generate.