This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Properly split arm-pe / arm-wince-pe. (take 2)
Hi all,
Pedro Alves wrote:
Nick Clifton wrote:
Pedro Alves wrote:
Should I rename wince's bfd format? wince-pei-arm-little? Then, I would
just add a new entry to pe_detail_list[] with the correct values.
Yes, this would be a very good idea.
>Humm, just noticed the patch is not complete.
>I'll work on updating it and send an updated patch later.
>I notice that arm-epoc-pe is broken in dll generation.
Here is take 2 of the same patch. It adds a few missing things I missed
on the previous patch. Additionally, it adds DLL_SUPPORT to arm-epoc-pe.
I've also removed the regenerated files from the patch. Let me know if
you need them.
Tested on arm-wince-pe, arm-pe, arm-epoc-pe and i686-pe-cygwin.
Please review and commit.
Cheers,
Pedro Alves
---
bfd/ChangeLog
2006-08-15 Pedro Alves <pedro_alves@portugalmail.pt>
* Makefile.am: Add rules to build pe-arm-wince.lo
and pei-arm-wince.lo objects.
* Makefile.in: Regenerate.
* pe-arm-wince.c: New file.
* pei-arm-wince.c: New file.
* pei-arm.c: Remove ARM_WINCE block.
* pe-arm.c: Remove ARM_WINCE block. Rename
bfd_arm_pe_allocate_interworking_sections,
bfd_arm_pe_get_bfd_for_interworking, and
bfd_arm_pe_process_before_allocation to
bfd_armpe_allocate_interworking_sections,
bfd_armpe_get_bfd_for_interworking, and
bfd_armpe_process_before_allocation. Move them before
including bfd.h.
* bfd.c: ARM wince bfd format names were renamed. Adjust.
* coff-arm.c [ARM_WINCE]: Adjust so Windows CE doesn't end up
with unexpected/conflicting relocs.
* targets.c: The arm-wince-pe target got its own new vector.
Adjust.
* config.bfd: Likewise.
* configure.in: Likewise.
* configure: Regenerate.
---
binutils/ChangeLog
2006-08-15 Pedro Alves <pedro_alves@portugalmail.pt>
* configure.in: Split arm-pe and arm-wince-pe. Build dlltool
with -DDLLTOOL_ARM_WINCE for Windows CE case.
* configure: Regenerate.
* dlltool.c: Add support for arm-wince.
---
gas/ChangeLog
2006-08-15 Pedro Alves <pedro_alves@portugalmail.pt>
* Makefile.am (TARG_ENV_HFILES): Add te-wince-pe.h.
* Makefile.in: Regenerate.
* config/tc-arm.h [TARGET_FORMAT]: ARM wince bfd names were
renamed. Adjust.
---
ld/ChangeLog
2006-08-15 Pedro Alves <pedro_alves@portugalmail.pt>
* Makefile.am: Split arm-wince into its own emulation.
* Makefile.in: Regenerate.
* configure.tgt: Set targ_emul to arm_wince_pe for ARM Windows
CE targets.
* pe-dll.c : Define PE_ARCH_arm_wince.
(pe_detail_list): Add PE_ARCH_arm_wince case.
(make_one): Handle PE_ARCH_arm_epoc and PE_ARCH_arm_wince cases.
* emulparams/arm_wince_pe.sh: New file.
* emultempl/pe.em: Handle new TARGET_IS_arm_wince_pe define.
Remap bfd_arm_allocate_interworking_sections,
bfd_arm_get_bfd_for_interworking and
bfd_arm_process_before_allocation for arm-pe and arm-wince-pe
targets too.
(gld_${EMULATION_NAME}_recognized_file): Handle arm-wince and
arm-epoc bfd format names.
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/Makefile.am binutils-cvs_wincesplit/bfd/Makefile.am
--- binutils-cvs_pristine/bfd/Makefile.am 2006-08-04 14:13:56.000000000 +0100
+++ binutils-cvs_wincesplit/bfd/Makefile.am 2006-08-15 10:57:12.000000000 +0100
@@ -323,6 +323,8 @@ BFD32_BACKENDS = \
pef.lo \
pe-arm.lo \
pei-arm.lo \
+ pe-arm-wince.lo \
+ pei-arm-wince.lo \
pe-i386.lo \
pei-i386.lo \
pe-mcore.lo \
@@ -495,6 +497,8 @@ BFD32_BACKENDS_CFILES = \
pef.c \
pe-arm.c \
pei-arm.c \
+ pe-arm-wince.c \
+ pei-arm-wince.c \
pe-i386.c \
pei-i386.c \
pe-mcore.c \
@@ -1622,6 +1626,16 @@ pei-arm.lo: pei-arm.c $(INCDIR)/filename
$(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
+pe-arm-wince.lo: pe-arm-wince.c pe-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
+pei-arm-wince.lo: pei-arm-wince.c pei-arm.c $(INCDIR)/filenames.h \
+ coff-arm.c $(INCDIR)/hashtab.h $(INCDIR)/coff/arm.h \
+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
+ peicode.h libpei.h
pe-i386.lo: pe-i386.c $(INCDIR)/filenames.h coff-i386.c \
$(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h $(INCDIR)/coff/external.h \
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/bfd.c binutils-cvs_wincesplit/bfd/bfd.c
--- binutils-cvs_pristine/bfd/bfd.c 2006-08-06 16:04:18.000000000 +0100
+++ binutils-cvs_wincesplit/bfd/bfd.c 2006-08-15 10:57:12.000000000 +0100
@@ -876,7 +876,7 @@ bfd_get_sign_extend_vma (bfd *abfd)
name = bfd_get_target (abfd);
- /* Return a proper value for DJGPP & PE COFF (x86 COFF variants).
+ /* Return a proper value for DJGPP & PE COFF.
This function is required for DWARF2 support, but there is
no place to store this information in the COFF back end.
Should enough other COFF targets add support for DWARF2,
@@ -884,8 +884,8 @@ bfd_get_sign_extend_vma (bfd *abfd)
if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0
|| strcmp (name, "pe-i386") == 0
|| strcmp (name, "pei-i386") == 0
- || strcmp (name, "pe-arm-little") == 0
- || strcmp (name, "pei-arm-little") == 0)
+ || strcmp (name, "pe-arm-wince-little") == 0
+ || strcmp (name, "pei-arm-wince-little") == 0)
return 1;
bfd_set_error (bfd_error_wrong_format);
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/coff-arm.c binutils-cvs_wincesplit/bfd/coff-arm.c
--- binutils-cvs_pristine/bfd/coff-arm.c 2006-08-07 11:26:08.000000000 +0100
+++ binutils-cvs_wincesplit/bfd/coff-arm.c 2006-08-15 10:57:12.000000000 +0100
@@ -163,6 +163,19 @@ coff_arm_reloc (bfd *abfd,
/* These most certainly belong somewhere else. Just had to get rid of
the manifest constants in the code. */
+
+#ifdef ARM_WINCE
+
+#define ARM_26D 0
+#define ARM_32 1
+#define ARM_RVA32 2
+#define ARM_26 3
+#define ARM_THUMB12 4
+#define ARM_SECTION 14
+#define ARM_SECREL 15
+
+#else
+
#define ARM_8 0
#define ARM_16 1
#define ARM_32 2
@@ -179,20 +192,6 @@ coff_arm_reloc (bfd *abfd,
#define ARM_THUMB12 13
#define ARM_THUMB23 14
-#ifdef ARM_WINCE
-#undef ARM_32
-#undef ARM_RVA32
-#undef ARM_26
-#undef ARM_THUMB12
-#undef ARM_26D
-
-#define ARM_26D 0
-#define ARM_32 1
-#define ARM_RVA32 2
-#define ARM_26 3
-#define ARM_THUMB12 4
-#define ARM_SECTION 14
-#define ARM_SECREL 15
#endif
static bfd_reloc_status_type aoutarm_fix_pcrel_26_done
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/config.bfd binutils-cvs_wincesplit/bfd/config.bfd
--- binutils-cvs_pristine/bfd/config.bfd 2006-08-04 14:13:56.000000000 +0100
+++ binutils-cvs_wincesplit/bfd/config.bfd 2006-08-15 10:57:12.000000000 +0100
@@ -225,8 +225,8 @@ case "${targ}" in
targ_cflags=-DARM_COFF_BUGFIX
;;
arm-wince-pe | arm-*-wince)
- targ_defvec=armpe_little_vec
- targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
+ targ_defvec=arm_wince_pe_little_vec
+ targ_selvecs="arm_wince_pe_little_vec arm_wince_pe_big_vec arm_wince_pei_little_vec arm_wince_pei_big_vec"
targ_underscore=no
targ_cflags="-DARM_WINCE -DARM_COFF_BUGFIX"
;;
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/configure.in binutils-cvs_wincesplit/bfd/configure.in
--- binutils-cvs_pristine/bfd/configure.in 2006-08-07 12:04:38.000000000 +0100
+++ binutils-cvs_wincesplit/bfd/configure.in 2006-08-15 16:34:18.000000000 +0100
@@ -573,6 +573,10 @@ do
arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pe_big_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pe_little_vec) tb="$tb pe-arm-wince.lo pe-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_big_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;;
+ arm_wince_pei_little_vec) tb="$tb pei-arm-wince.lo pei-arm.lo peigen.lo cofflink.lo " ;;
armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/pe-arm-wince.c binutils-cvs_wincesplit/bfd/pe-arm-wince.c
--- binutils-cvs_pristine/bfd/pe-arm-wince.c 1970-01-01 00:00:00.000000000 +0000
+++ binutils-cvs_wincesplit/bfd/pe-arm-wince.c 2006-08-14 19:13:04.000000000 +0100
@@ -0,0 +1,35 @@
+/* BFD back-end for ARM WINCE PE files.
+ Copyright 2006 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define TARGET_UNDERSCORE 0
+#define USER_LABEL_PREFIX ""
+
+#define TARGET_LITTLE_SYM arm_wince_pe_little_vec
+#define TARGET_LITTLE_NAME "pe-arm-wince-little"
+#define TARGET_BIG_SYM arm_wince_pe_big_vec
+#define TARGET_BIG_NAME "pe-arm-wince-big"
+
+#define bfd_arm_allocate_interworking_sections \
+ bfd_arm_wince_pe_allocate_interworking_sections
+#define bfd_arm_get_bfd_for_interworking \
+ bfd_arm_wince_pe_get_bfd_for_interworking
+#define bfd_arm_process_before_allocation \
+ bfd_arm_wince_pe_process_before_allocation
+
+#include "pe-arm.c"
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/pe-arm.c binutils-cvs_wincesplit/bfd/pe-arm.c
--- binutils-cvs_pristine/bfd/pe-arm.c 2006-08-06 16:04:18.000000000 +0100
+++ binutils-cvs_wincesplit/bfd/pe-arm.c 2006-08-15 10:57:12.000000000 +0100
@@ -17,6 +17,17 @@ You should have received a copy of the G
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+/* Do this before including bfd.h, so we prototype the right functions. */
+
+#ifndef bfd_arm_allocate_interworking_sections
+#define bfd_arm_allocate_interworking_sections \
+ bfd_armpe_allocate_interworking_sections
+#define bfd_arm_get_bfd_for_interworking \
+ bfd_armpe_get_bfd_for_interworking
+#define bfd_arm_process_before_allocation \
+ bfd_armpe_process_before_allocation
+#endif
+
#include "bfd.h"
#include "sysdep.h"
@@ -31,19 +42,6 @@ Foundation, Inc., 51 Franklin Street - F
#define PCRELOFFSET TRUE
#define COFF_LONG_SECTION_NAMES
-#ifndef bfd_arm_allocate_interworking_sections
-#define bfd_arm_allocate_interworking_sections \
- bfd_arm_pe_allocate_interworking_sections
-#define bfd_arm_get_bfd_for_interworking \
- bfd_arm_pe_get_bfd_for_interworking
-#define bfd_arm_process_before_allocation \
- bfd_arm_pe_process_before_allocation
-#endif
-
-#ifdef ARM_WINCE
-#define TARGET_UNDERSCORE 0
-#endif
-
#define COFF_SECTION_ALIGNMENT_ENTRIES \
{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/pei-arm-wince.c binutils-cvs_wincesplit/bfd/pei-arm-wince.c
--- binutils-cvs_pristine/bfd/pei-arm-wince.c 1970-01-01 00:00:00.000000000 +0000
+++ binutils-cvs_wincesplit/bfd/pei-arm-wince.c 2006-08-09 00:56:30.000000000 +0100
@@ -0,0 +1,28 @@
+/* BFD back-end for ARM WINCE PE IMAGE COFF files.
+ Copyright 2006 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define TARGET_UNDERSCORE 0
+#define USER_LABEL_PREFIX ""
+
+#define TARGET_LITTLE_SYM arm_wince_pei_little_vec
+#define TARGET_LITTLE_NAME "pei-arm-wince-little"
+#define TARGET_BIG_SYM arm_wince_pei_big_vec
+#define TARGET_BIG_NAME "pei-arm-wince-big"
+
+#include "pei-arm.c"
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/pei-arm.c binutils-cvs_wincesplit/bfd/pei-arm.c
--- binutils-cvs_pristine/bfd/pei-arm.c 2006-08-06 16:04:18.000000000 +0100
+++ binutils-cvs_wincesplit/bfd/pei-arm.c 2006-08-15 10:57:12.000000000 +0100
@@ -32,10 +32,6 @@ Foundation, Inc., 51 Franklin Street - F
#define PCRELOFFSET TRUE
#define COFF_LONG_SECTION_NAMES
-#ifdef ARM_WINCE
-# define TARGET_UNDERSCORE 0
-#endif
-
#define COFF_SECTION_ALIGNMENT_ENTRIES \
{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
diff -x CVS -x doc -Nurp binutils-cvs_pristine/bfd/targets.c binutils-cvs_wincesplit/bfd/targets.c
--- binutils-cvs_pristine/bfd/targets.c 2006-08-04 14:13:56.000000000 +0100
+++ binutils-cvs_wincesplit/bfd/targets.c 2006-08-15 10:57:12.000000000 +0100
@@ -541,6 +541,10 @@ extern const bfd_target arm_epoc_pe_big_
extern const bfd_target arm_epoc_pe_little_vec;
extern const bfd_target arm_epoc_pei_big_vec;
extern const bfd_target arm_epoc_pei_little_vec;
+extern const bfd_target arm_wince_pe_big_vec;
+extern const bfd_target arm_wince_pe_little_vec;
+extern const bfd_target arm_wince_pei_big_vec;
+extern const bfd_target arm_wince_pei_little_vec;
extern const bfd_target armcoff_big_vec;
extern const bfd_target armcoff_little_vec;
extern const bfd_target armnetbsd_vec;
@@ -844,6 +848,10 @@ static const bfd_target * const _bfd_tar
&arm_epoc_pe_little_vec,
&arm_epoc_pei_big_vec,
&arm_epoc_pei_little_vec,
+ &arm_wince_pe_big_vec,
+ &arm_wince_pe_little_vec,
+ &arm_wince_pei_big_vec,
+ &arm_wince_pei_little_vec,
&armcoff_big_vec,
&armcoff_little_vec,
&armnetbsd_vec,
diff -x CVS -x doc -Nurp binutils-cvs_pristine/binutils/configure.in binutils-cvs_wincesplit/binutils/configure.in
--- binutils-cvs_pristine/binutils/configure.in 2006-05-31 16:14:36.000000000 +0100
+++ binutils-cvs_wincesplit/binutils/configure.in 2006-08-15 10:57:12.000000000 +0100
@@ -242,7 +242,12 @@ changequote([,])dnl
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
;;
- arm-*-pe* | arm-*-wince)
+ arm-wince-pe* | arm-*-wince)
+ BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
+ DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
+ BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
+ ;;
+ arm-*-pe*)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
diff -x CVS -x doc -Nurp binutils-cvs_pristine/binutils/dlltool.c binutils-cvs_wincesplit/binutils/dlltool.c
--- binutils-cvs_pristine/binutils/dlltool.c 2006-03-09 21:50:54.000000000 +0000
+++ binutils-cvs_wincesplit/binutils/dlltool.c 2006-08-15 10:57:12.000000000 +0100
@@ -385,8 +385,10 @@ static FILE *output_def;
static FILE *base_file;
#ifdef DLLTOOL_ARM
-#ifdef DLLTOOL_ARM_EPOC
+#if defined(DLLTOOL_ARM_EPOC)
static const char *mname = "arm-epoc";
+#elif defined(DLLTOOL_ARM_WINCE)
+static const char *mname = "arm-wince";
#else
static const char *mname = "arm";
#endif
@@ -629,6 +631,15 @@ mtable[] =
arm_jtab, sizeof (arm_jtab), 8
}
,
+ {
+#define MARM_WINCE 10
+ "arm-wince", ".byte", ".short", ".long", ".asciz", "@",
+ "ldr\tip,[pc]\n\tldr\tpc,[ip]\n\t.long",
+ ".global", ".space", ".align\t2",".align\t4", "-mapcs-32",
+ "pe-arm-wince-little", bfd_arch_arm,
+ arm_jtab, sizeof (arm_jtab), 8
+ }
+ ,
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
@@ -760,6 +771,7 @@ rvaafter (int machine)
case MMCORE_ELF:
case MMCORE_ELF_LE:
case MARM_EPOC:
+ case MARM_WINCE:
break;
default:
/* xgettext:c-format */
@@ -784,6 +796,7 @@ rvabefore (int machine)
case MMCORE_ELF:
case MMCORE_ELF_LE:
case MARM_EPOC:
+ case MARM_WINCE:
return ".rva\t";
default:
/* xgettext:c-format */
@@ -807,6 +820,7 @@ asm_prefix (int machine, const char *nam
case MMCORE_ELF:
case MMCORE_ELF_LE:
case MARM_EPOC:
+ case MARM_WINCE:
break;
case M386:
/* Symbol names starting with ? do not have a leading underscore. */
diff -x CVS -x doc -Nurp binutils-cvs_pristine/gas/Makefile.am binutils-cvs_wincesplit/gas/Makefile.am
--- binutils-cvs_pristine/gas/Makefile.am 2006-06-08 06:09:38.000000000 +0100
+++ binutils-cvs_wincesplit/gas/Makefile.am 2006-08-15 10:57:12.000000000 +0100
@@ -381,7 +381,8 @@ TARG_ENV_HFILES = \
config/te-sun3.h \
config/te-svr4.h \
config/te-symbian.h \
- config/te-tmips.h
+ config/te-tmips.h \
+ config/te-wince-pe.h
# Multi files in config
diff -x CVS -x doc -Nurp binutils-cvs_pristine/gas/config/tc-arm.h binutils-cvs_wincesplit/gas/config/tc-arm.h
--- binutils-cvs_pristine/gas/config/tc-arm.h 2006-08-06 16:04:24.000000000 +0100
+++ binutils-cvs_wincesplit/gas/config/tc-arm.h 2006-08-15 10:57:12.000000000 +0100
@@ -66,6 +66,8 @@ struct fix;
# if defined TE_PE
# if defined TE_EPOC
# define TARGET_FORMAT (target_big_endian ? "epoc-pe-arm-big" : "epoc-pe-arm-little")
+# elif defined TE_WINCE
+# define TARGET_FORMAT (target_big_endian ? "pe-arm-wince-big" : "pe-arm-wince-little")
# else
# define TARGET_FORMAT (target_big_endian ? "pe-arm-big" : "pe-arm-little")
# endif
diff -x CVS -x doc -Nurp binutils-cvs_pristine/ld/Makefile.am binutils-cvs_wincesplit/ld/Makefile.am
--- binutils-cvs_pristine/ld/Makefile.am 2006-08-04 14:13:56.000000000 +0100
+++ binutils-cvs_wincesplit/ld/Makefile.am 2006-08-15 10:57:12.000000000 +0100
@@ -108,6 +108,7 @@ ALL_EMULATIONS = \
ealpha.o \
earcelf.o \
earm_epoc_pe.o \
+ earm_wince_pe.o \
earmaoutb.o \
earmaoutl.o \
earmcoff.o \
@@ -569,6 +570,9 @@ earmnto.c: $(srcdir)/emulparams/armnto.s
earm_epoc_pe.c: $(srcdir)/emulparams/arm_epoc_pe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/epocpe.sc ${GEN_DEPENDS}
${GENSCRIPTS} arm_epoc_pe "$(tdir_armpe)"
+earm_wince_pe.c: $(srcdir)/emulparams/arm_wince_pe.sh \
+ $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} arm_wince_pe "$(tdir_armpe)"
earmpe.c: $(srcdir)/emulparams/armpe.sh \
$(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
${GENSCRIPTS} armpe "$(tdir_armpe)"
diff -x CVS -x doc -Nurp binutils-cvs_pristine/ld/configure.tgt binutils-cvs_wincesplit/ld/configure.tgt
--- binutils-cvs_pristine/ld/configure.tgt 2006-08-04 14:13:56.000000000 +0100
+++ binutils-cvs_wincesplit/ld/configure.tgt 2006-08-15 10:57:12.000000000 +0100
@@ -37,7 +37,8 @@ alpha*-*-openbsd*) targ_emul=elf64alpha
arc-*-elf*) targ_emul=arcelf
;;
arm-epoc-pe) targ_emul=arm_epoc_pe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;;
-arm-*-wince) targ_emul=armpe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;;
+arm-wince-pe | arm-*-wince) targ_emul=arm_wince_pe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;;
arm-*-pe) targ_emul=armpe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;;
arm-*-aout | armel-*-aout) targ_emul=armaoutl ;;
armeb-*-aout) targ_emul=armaoutb ;;
diff -x CVS -x doc -Nurp binutils-cvs_pristine/ld/emulparams/arm_wince_pe.sh binutils-cvs_wincesplit/ld/emulparams/arm_wince_pe.sh
--- binutils-cvs_pristine/ld/emulparams/arm_wince_pe.sh 1970-01-01 00:00:00.000000000 +0000
+++ binutils-cvs_wincesplit/ld/emulparams/arm_wince_pe.sh 2006-08-15 12:22:30.000000000 +0100
@@ -0,0 +1,14 @@
+ARCH=arm
+SCRIPT_NAME=pe
+
+OUTPUT_FORMAT="pei-arm-wince-little"
+LITTLE_OUTPUT_FORMAT="pei-arm-wince-little"
+BIG_OUTPUT_FORMAT="pei-arm-wince-big"
+
+RELOCATEABLE_OUTPUT_FORMAT="pe-arm-wince-little"
+
+TEMPLATE_NAME=pe
+ENTRY="WinMainCRTStartup"
+SUBSYSTEM=PE_DEF_SUBSYSTEM
+INITIAL_SYMBOL_CHAR=\"\"
+TARGET_PAGE_SIZE=0x1000
diff -x CVS -x doc -Nurp binutils-cvs_pristine/ld/emultempl/pe.em binutils-cvs_wincesplit/ld/emultempl/pe.em
--- binutils-cvs_pristine/ld/emultempl/pe.em 2006-06-27 12:45:22.000000000 +0100
+++ binutils-cvs_wincesplit/ld/emultempl/pe.em 2006-08-15 12:55:52.000000000 +0100
@@ -37,15 +37,18 @@ cat >>e${EMULATION_NAME}.c <<EOF
#define TARGET_IS_${EMULATION_NAME}
/* Do this before including bfd.h, so we prototype the right functions. */
-#ifdef TARGET_IS_arm_epoc_pe
-#define bfd_arm_pe_allocate_interworking_sections \
- bfd_arm_epoc_pe_allocate_interworking_sections
-#define bfd_arm_pe_get_bfd_for_interworking \
- bfd_arm_epoc_pe_get_bfd_for_interworking
-#define bfd_arm_pe_process_before_allocation \
- bfd_arm_epoc_pe_process_before_allocation
-#endif
+#if defined(TARGET_IS_armpe) \
+ || defined(TARGET_IS_arm_epoc_pe) \
+ || defined(TARGET_IS_arm_wince_pe)
+#define bfd_arm_allocate_interworking_sections \
+ bfd_${EMULATION_NAME}_allocate_interworking_sections
+#define bfd_arm_get_bfd_for_interworking \
+ bfd_${EMULATION_NAME}_get_bfd_for_interworking
+#define bfd_arm_process_before_allocation \
+ bfd_${EMULATION_NAME}_process_before_allocation
+#endif
+
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
@@ -85,10 +88,12 @@ cat >>e${EMULATION_NAME}.c <<EOF
#define PE_DEF_SECTION_ALIGNMENT ${OVERRIDE_SECTION_ALIGNMENT}
#endif
-#if defined(TARGET_IS_i386pe)
-#define DLL_SUPPORT
-#endif
-#if defined(TARGET_IS_shpe) || defined(TARGET_IS_mipspe) || defined(TARGET_IS_armpe)
+#if defined(TARGET_IS_i386pe) \
+ || defined(TARGET_IS_shpe) \
+ || defined(TARGET_IS_mipspe) \
+ || defined(TARGET_IS_armpe) \
+ || defined(TARGET_IS_arm_epoc_pe) \
+ || defined(TARGET_IS_arm_wince_pe)
#define DLL_SUPPORT
#endif
@@ -99,7 +104,8 @@ cat >>e${EMULATION_NAME}.c <<EOF
#undef PE_DEF_SECTION_ALIGNMENT
#undef PE_DEF_FILE_ALIGNMENT
#define NT_EXE_IMAGE_BASE 0x00010000
-#ifdef TARGET_IS_armpe
+
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
#define PE_DEF_SECTION_ALIGNMENT 0x00001000
#define PE_DEF_SUBSYSTEM 9
#else
@@ -139,7 +145,7 @@ gld_${EMULATION_NAME}_before_parse (void
link_info.pei386_runtime_pseudo_reloc = -1;
#if (PE_DEF_SUBSYSTEM == 9) || (PE_DEF_SUBSYSTEM == 2)
-#if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
+#if defined TARGET_IS_mipspe || defined TARGET_IS_armpe || defined TARGET_IS_arm_wince_pe
lang_default_entry ("WinMainCRTStartup");
#else
lang_default_entry ("_WinMainCRTStartup");
@@ -282,7 +288,7 @@ static definfo init[] =
D(MinorOperatingSystemVersion,"__minor_os_version__", 0),
D(MajorImageVersion,"__major_image_version__", 1),
D(MinorImageVersion,"__minor_image_version__", 0),
-#ifdef TARGET_IS_armpe
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
D(MajorSubsystemVersion,"__major_subsystem_version__", 3),
#else
D(MajorSubsystemVersion,"__major_subsystem_version__", 4),
@@ -997,22 +1003,21 @@ gld_${EMULATION_NAME}_after_open (void)
pe_find_data_imports ();
-#if ! (defined (TARGET_IS_i386pe) || defined (TARGET_IS_armpe))
- if (link_info.shared)
-#else
+#if defined (TARGET_IS_i386pe) \
+ || defined (TARGET_IS_armpe) \
+ || defined (TARGET_IS_arm_epoc_pe) \
+ || defined (TARGET_IS_arm_wince_pe)
if (!link_info.relocatable)
-#endif
pe_dll_build_sections (output_bfd, &link_info);
-
-#ifndef TARGET_IS_i386pe
-#ifndef TARGET_IS_armpe
else
pe_exe_build_sections (output_bfd, &link_info);
+#else
+ if (link_info.shared)
+ pe_dll_build_sections (output_bfd, &link_info);
#endif
-#endif
-#endif
+#endif /* DLL_SUPPORT */
-#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe)
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe)
if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
{
/* The arm backend needs special fields in the output hash structure.
@@ -1026,7 +1031,7 @@ gld_${EMULATION_NAME}_after_open (void)
/* Find a BFD that can hold the interworking stubs. */
LANG_FOR_EACH_INPUT_STATEMENT (is)
{
- if (bfd_arm_pe_get_bfd_for_interworking (is->the_bfd, & link_info))
+ if (bfd_arm_get_bfd_for_interworking (is->the_bfd, & link_info))
break;
}
}
@@ -1267,7 +1272,7 @@ gld_${EMULATION_NAME}_before_allocation
ppc_allocate_toc_section (&link_info);
#endif /* TARGET_IS_ppcpe */
-#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe)
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe)
/* FIXME: we should be able to set the size of the interworking stub
section.
@@ -1277,7 +1282,7 @@ gld_${EMULATION_NAME}_before_allocation
{
LANG_FOR_EACH_INPUT_STATEMENT (is)
{
- if (! bfd_arm_pe_process_before_allocation
+ if (! bfd_arm_process_before_allocation
(is->the_bfd, & link_info, support_old_code))
{
/* xgettext:c-format */
@@ -1288,8 +1293,8 @@ gld_${EMULATION_NAME}_before_allocation
}
/* We have seen it all. Allocate it, and carry on. */
- bfd_arm_pe_allocate_interworking_sections (& link_info);
-#endif /* TARGET_IS_armpe */
+ bfd_arm_allocate_interworking_sections (& link_info);
+#endif /* TARGET_IS_armpe || TARGET_IS_arm_epoc_pe || TARGET_IS_arm_wince_pe */
before_allocation_default ();
}
@@ -1404,6 +1409,12 @@ gld_${EMULATION_NAME}_recognized_file (l
#ifdef TARGET_IS_armpe
pe_dll_id_target ("pei-arm-little");
#endif
+#ifdef TARGET_IS_arm_epoc_pe
+ pe_dll_id_target ("epoc-pei-arm-little");
+#endif
+#ifdef TARGET_IS_arm_wince_pe
+ pe_dll_id_target ("pei-arm-wince-little");
+#endif
if (bfd_get_format (entry->the_bfd) == bfd_object)
{
char fbuf[LD_PATHMAX + 1];
@@ -1424,7 +1435,7 @@ gld_${EMULATION_NAME}_recognized_file (l
static void
gld_${EMULATION_NAME}_finish (void)
{
-#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe)
+#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe)
struct bfd_link_hash_entry * h;
if (thumb_entry_symbol != NULL)
@@ -1464,7 +1475,7 @@ gld_${EMULATION_NAME}_finish (void)
else
einfo (_("%P: warning: connot find thumb start symbol %s\n"), thumb_entry_symbol);
}
-#endif /* defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) */
+#endif /* defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe) */
finish_default ();
diff -x CVS -x doc -Nurp binutils-cvs_pristine/ld/pe-dll.c binutils-cvs_wincesplit/ld/pe-dll.c
--- binutils-cvs_pristine/ld/pe-dll.c 2006-06-23 12:20:16.000000000 +0100
+++ binutils-cvs_wincesplit/ld/pe-dll.c 2006-08-15 12:42:16.000000000 +0100
@@ -207,6 +207,7 @@ static autofilter_entry_type autofilter_
#define PE_ARCH_mips 3
#define PE_ARCH_arm 4
#define PE_ARCH_arm_epoc 5
+#define PE_ARCH_arm_wince 6
static pe_details_type pe_detail_list[] =
{
@@ -255,6 +256,15 @@ static pe_details_type pe_detail_list[]
FALSE,
autofilter_symbollist_generic
},
+ {
+ "pei-arm-wince-little",
+ "pe-arm-wince-little",
+ 2, /* ARM_RVA32 on Windows CE, see bfd/coff-arm.c. */
+ PE_ARCH_arm_wince,
+ bfd_arch_arm,
+ FALSE,
+ autofilter_symbollist_generic
+ },
{ NULL, NULL, 0, 0, 0, FALSE, NULL }
};
@@ -1843,6 +1853,8 @@ make_one (def_file_export *exp, bfd *par
jmp_byte_count = sizeof (jmp_mips_bytes);
break;
case PE_ARCH_arm:
+ case PE_ARCH_arm_epoc:
+ case PE_ARCH_arm_wince:
jmp_bytes = jmp_arm_bytes;
jmp_byte_count = sizeof (jmp_arm_bytes);
break;
@@ -1920,6 +1932,8 @@ make_one (def_file_export *exp, bfd *par
quick_reloc (abfd, 4, BFD_RELOC_LO16, 2);
break;
case PE_ARCH_arm:
+ case PE_ARCH_arm_epoc:
+ case PE_ARCH_arm_wince:
quick_reloc (abfd, 8, BFD_RELOC_32, 2);
break;
default: