This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: arm-wince-pe support resurrection
- From: Nick Clifton <nickc at redhat dot com>
- To: <Dmitry dot Semyonov at oktet dot ru>
- Cc: <binutils at sources dot redhat dot com>
- Date: Thu, 04 Dec 2003 18:07:44 +0000
- Subject: Re: arm-wince-pe support resurrection
- References: <Pine.LNX.4.33.0311182221220.15453-103000@mail.oktet.ru>
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