summaryrefslogtreecommitdiff
path: root/bfd/coffcode.h
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2009-03-19 11:02:09 +0000
committerKai Tietz <kai.tietz@onevision.com>2009-03-19 11:02:09 +0000
commit894bcb35bbd4b2077ad42512697e9302507f3b53 (patch)
treef6f47185dabe79d1bfceebab021eff86c1e65225 /bfd/coffcode.h
parent0baf4bafb2621d0c90f414c6d38c656fffbf35f1 (diff)
downloadbinutils-redhat-894bcb35bbd4b2077ad42512697e9302507f3b53.tar.gz
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.
Diffstat (limited to 'bfd/coffcode.h')
-rw-r--r--bfd/coffcode.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 44ac08008d..484fb6b7ec 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -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. */