This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: arm-wince-pe support resurrection


Hi Dmitry,

  With regards to this patch:
-------------------------------------------------------------------------------
2003-11-18  Dmitry Semyonov  <Dmitry.Semyonov@oktet.ru>

	* bfd/peXXigen.c (_bfd_XXi_swap_scnhdr_out): Set flags for some special
	sections (.text, .rdata, .data, .bss) as described in
	"MS PE & COFF Specification".

diff -rNc3p binutils-031114/bfd/peXXigen.c /home/sdv/cross/binutils-031114/bfd/peXXigen.c
*** binutils-031114/bfd/peXXigen.c	Fri Nov 14 21:46:53 2003
--- /home/sdv/cross/binutils-031114/bfd/peXXigen.c	Fri Nov 14 22:11:43 2003
*************** _bfd_XXi_swap_scnhdr_out (abfd, in, out)
*** 959,964 ****
--- 959,993 ----
  
    {
      int flags = scnhdr_int->s_flags;
+     
+     if (strcmp (scnhdr_int->s_name, ".text") == 0)
+       {
+         /* Executable code */
+         flags &= ~IMAGE_SCN_MEM_WRITE;
+         flags |= IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE |
+                  IMAGE_SCN_MEM_READ;
+       }
+     else if (strcmp (scnhdr_int->s_name, ".rdata") == 0)
+       {
+         /* Read-only initialized data */
+         flags &= ~IMAGE_SCN_MEM_WRITE;
+         flags |= IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ;
+       }
+     else if (strcmp (scnhdr_int->s_name, ".data") == 0)
+       {
+         /* Initialized data */
+         flags |= IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ |
+                  IMAGE_SCN_MEM_WRITE;
+       }
+     else if (strcmp (scnhdr_int->s_name, ".bss") == 0)
+       {
+         /* Uninitialized data */
+         flags |= IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_MEM_READ |
+                  IMAGE_SCN_MEM_WRITE;
+       }
+ 
+     /* FIXME: Still not all reserved sections and their characteristics
+      *        are covered here. */
  
      H_PUT_32 (abfd, flags, scnhdr_ext->s_flags);
    }
-------------------------------------------------------------------------------

I am not sure that this is the right place to be doing this.  So you
have an example of how, without this patch applied, the linker is
producing section with incorrect flag bits set ?

Cheers
        Nick
        


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]