2009-03-19 Kai Tietz <kai.tietz@onevision.com>
authorKai Tietz <kai.tietz@onevision.com>
Thu, 19 Mar 2009 11:02:09 +0000 (11:02 +0000)
committerKai Tietz <kai.tietz@onevision.com>
Thu, 19 Mar 2009 11:02:09 +0000 (11:02 +0000)
        * bfd-in2.h: Regenerated.
        * coffcode.h (sec_to_styp_flags): For pe-coff add SEC_READONLY
        for debugging sections and map memory read/write dependent on
        SEC_COFF_NOREAD.
        (styp_to_sec_flags): Set SEC_COFF_NOREAD for sections
        without memory read flags set.
        * section.c: Add SEC_COFF_NOREAD to section flags.

bfd/ChangeLog
bfd/bfd-in2.h
bfd/coffcode.h
bfd/section.c

index 945504c679281f122ffb5bf183a31dbe1eb5855e..dc5454b0338fa236550cd6730850b7af12ab553b 100644 (file)
@@ -1,3 +1,13 @@
+2009-03-19  Kai Tietz  <kai.tietz@onevision.com>
+
+       * bfd-in2.h: Regenerated.
+       * coffcode.h (sec_to_styp_flags): For pe-coff add SEC_READONLY
+       for debugging sections and map memory read/write dependent on
+       SEC_COFF_NOREAD.
+       (styp_to_sec_flags): Set SEC_COFF_NOREAD for sections
+       without memory read flags set.
+       * section.c: Add SEC_COFF_NOREAD to section flags.
+
 2009-03-19  Andreas Schwab  <schwab@linux-m68k.org>
 
        * elf32-hppa.c (final_link_relocate): Cast bfd_vma values to long
index a173f568ed125c9fecb83a9006d78c4040158864..78a5bd92d25b2c21f62d96fec00bec8a7eabbccb 100644 (file)
@@ -1304,6 +1304,10 @@ typedef struct bfd_section
      TMS320C54X only.  */
 #define SEC_TIC54X_CLINK 0x20000000
 
+  /* Indicate that section has the no read flag set. This happens
+     when memory read flag isn't set. */
+#define SEC_COFF_NOREAD 0x40000000
+
   /*  End of section flags.  */
 
   /* Some internal packed boolean fields.  */
index 44ac08008d67c974f1942ddffbab3990896210f0..484fb6b7ec77b2e51b03c33389e127d3810cf538 100644 (file)
@@ -637,7 +637,7 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
   /* FIXME: There is no gas syntax to specify the debug section flag.  */
   if (CONST_STRNEQ (sec_name, DOT_DEBUG)
       || CONST_STRNEQ (sec_name, GNU_LINKONCE_WI))
-    sec_flags = SEC_DEBUGGING;
+    sec_flags = SEC_DEBUGGING | SEC_READONLY;
 
   /* skip LOAD */
   /* READONLY later */
@@ -666,19 +666,14 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
   /* skip LINK_DUPLICATES */
   /* skip LINKER_CREATED */
 
-  if (sec_flags & (SEC_ALLOC | SEC_LOAD))
-    {
-      /* For now, the read/write bits are mapped onto SEC_READONLY, even
-        though the semantics don't quite match.  The bits from the input
-        are retained in pei_section_data(abfd, section)->pe_flags.  */
-      styp_flags |= IMAGE_SCN_MEM_READ;       /* Always readable.  */
-      if ((sec_flags & SEC_READONLY) == 0)
-       styp_flags |= IMAGE_SCN_MEM_WRITE;    /* Invert READONLY for write.  */
-      if (sec_flags & SEC_CODE)
-       styp_flags |= IMAGE_SCN_MEM_EXECUTE;  /* CODE->EXECUTE.  */
-      if (sec_flags & SEC_COFF_SHARED)
-       styp_flags |= IMAGE_SCN_MEM_SHARED;   /* Shared remains meaningful.  */
-    }
+  if ((sec_flags & SEC_COFF_NOREAD) == 0)
+    styp_flags |= IMAGE_SCN_MEM_READ;     /* Invert NOREAD for read.  */
+  if ((sec_flags & SEC_READONLY) == 0)
+    styp_flags |= IMAGE_SCN_MEM_WRITE;    /* Invert READONLY for write.  */
+  if (sec_flags & SEC_CODE)
+    styp_flags |= IMAGE_SCN_MEM_EXECUTE;  /* CODE->EXECUTE.  */
+  if (sec_flags & SEC_COFF_SHARED)
+    styp_flags |= IMAGE_SCN_MEM_SHARED;   /* Shared remains meaningful.  */
 
   return styp_flags;
 }
@@ -1117,6 +1112,10 @@ styp_to_sec_flags (bfd *abfd,
   /* Assume read only unless IMAGE_SCN_MEM_WRITE is specified.  */
   sec_flags = SEC_READONLY;
 
+  /* If section disallows read, then set the NOREAD flag. */
+  if ((styp_flags & IMAGE_SCN_MEM_READ) == 0)
+    sec_flags |= SEC_COFF_NOREAD;
+
   /* Process each flag bit in styp_flags in turn.  */
   while (styp_flags)
     {
@@ -1149,7 +1148,7 @@ styp_to_sec_flags (bfd *abfd,
          break;
 #endif
        case IMAGE_SCN_MEM_READ:
-         /* Ignored, assume it always to be true.  */
+         sec_flags &= ~SEC_COFF_NOREAD;
          break;
        case IMAGE_SCN_TYPE_NO_PAD:
          /* Skip.  */
index d804dd614b7a0c6d2d5f1008e85a62d25e725807..5a335a62909ad67754c3d6c6763302b5bf2f01a2 100644 (file)
@@ -343,6 +343,10 @@ CODE_FRAGMENT
 .     TMS320C54X only.  *}
 .#define SEC_TIC54X_CLINK 0x20000000
 .
+.  {* Indicate that section has the no read flag set. This happens
+.     when memory read flag isn't set. *}
+.#define SEC_COFF_NOREAD 0x40000000
+.
 .  {*  End of section flags.  *}
 .
 .  {* Some internal packed boolean fields.  *}
This page took 0.033729 seconds and 4 git commands to generate.