Index: bfd/coff-arm.c =================================================================== RCS file: /cvs/src/src/bfd/coff-arm.c,v retrieving revision 1.63 diff -u -r1.63 coff-arm.c --- bfd/coff-arm.c 16 Mar 2006 12:20:15 -0000 1.63 +++ bfd/coff-arm.c 26 Apr 2006 22:29:05 -0000 @@ -220,7 +220,7 @@ complain_overflow_dont, aoutarm_fix_pcrel_26_done, "ARM_26D", - FALSE, + TRUE, 0x00ffffff, 0x0, PCRELOFFSET), @@ -233,7 +233,7 @@ complain_overflow_bitfield, coff_arm_reloc, "ARM_32", - FALSE, + TRUE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -246,7 +246,7 @@ complain_overflow_bitfield, coff_arm_reloc, "ARM_RVA32", - FALSE, + TRUE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -294,7 +294,7 @@ complain_overflow_bitfield, coff_arm_reloc, "ARM_SECTION", - FALSE, + TRUE, 0x0000ffff, 0x0000ffff, PCRELOFFSET), @@ -307,7 +307,7 @@ complain_overflow_bitfield, coff_arm_reloc, "ARM_SECREL", - FALSE, + TRUE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -1215,6 +1215,9 @@ #ifdef ARM_WINCE /* MS ARM-CE makes the reloc relative to the opcode's pc, not the next opcode's pc, so is off by one. */ + + if (howto->pc_relative && !info->relocatable) + addend -= 8; #endif /* If we are doing a relocatable link, then we can just ignore Index: gas/config/tc-arm.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-arm.c,v retrieving revision 1.256 diff -u -r1.256 tc-arm.c --- gas/config/tc-arm.c 7 Apr 2006 15:11:19 -0000 1.256 +++ gas/config/tc-arm.c 26 Apr 2006 22:30:19 -0000 @@ -11182,8 +11182,12 @@ then we just want to put out any pipeline compensation that the linker will need. Otherwise we want to use the calculated base. */ if (fixP->fx_pcrel - && ((fixP->fx_addsy && S_GET_SEGMENT (fixP->fx_addsy) != seg) - || arm_force_relocation (fixP))) + && ((fixP->fx_addsy && S_GET_SEGMENT (fixP->fx_addsy) != seg) +#ifdef TE_WINCE + || (!S_IS_EXTERNAL (fixP->fx_addsy) && arm_force_relocation (fixP)))) +#else + || arm_force_relocation (fixP))) +#endif base = 0; switch (fixP->fx_r_type) @@ -11220,7 +11224,19 @@ case BFD_RELOC_ARM_PCREL_BLX: case BFD_RELOC_ARM_PLT32: #ifdef TE_WINCE - return base; + /* + * When handling fixups immediately, because we have already + * discovered the value of a symbol, or the address of the frag involved + * we must account for the offset by +8, as the OS loader will never see the reloc. + * see fixup_segment() in write.c + * The S_IS_EXTERNAL test handles the case of global symbols. + * Those need the calculated base, not just the pipe compensation the linker will need. + */ + if (fixP->fx_pcrel && fixP->fx_addsy && (S_GET_SEGMENT (fixP->fx_addsy) == seg) + && (S_IS_EXTERNAL (fixP->fx_addsy) || !arm_force_relocation (fixP))) + return base + 8; + else + return base; #else return base + 8; #endif @@ -12107,10 +12123,16 @@ case BFD_RELOC_ARM_ROSEGREL32: case BFD_RELOC_ARM_SBREL32: case BFD_RELOC_32_PCREL: +#ifdef TE_WINCE + if (seg->use_rela_p && !fixP->fx_done) + break; + if (fixP->fx_done || fixP->fx_pcrel) + md_number_to_chars (buf, value, 4); +#else if (fixP->fx_done || !seg->use_rela_p) md_number_to_chars (buf, value, 4); +#endif break; - #ifdef OBJ_ELF case BFD_RELOC_ARM_PREL31: if (fixP->fx_done || !seg->use_rela_p) Index: gas/config/te-pe.h =================================================================== RCS file: /cvs/src/src/gas/config/te-pe.h,v retrieving revision 1.2 diff -u -r1.2 te-pe.h --- gas/config/te-pe.h 6 Nov 2002 19:36:19 -0000 1.2 +++ gas/config/te-pe.h 26 Apr 2006 22:30:19 -0000 @@ -1,3 +1,4 @@ +#define TE_WINCE #define TE_PE #define LEX_AT (LEX_BEGIN_NAME | LEX_NAME) /* Can have @'s inside labels. */ Index: ld/pe-dll.c =================================================================== RCS file: /cvs/src/src/ld/pe-dll.c,v retrieving revision 1.83 diff -u -r1.83 pe-dll.c --- ld/pe-dll.c 31 Jan 2006 22:08:14 -0000 1.83 +++ ld/pe-dll.c 26 Apr 2006 22:31:22 -0000 @@ -216,6 +216,9 @@ static autofilter_entry_type autofilter_symbollist[] = { + { "DllMain", 7 }, + { "DllMainCRTStartup", 17 }, + { "_DllMainCRTStartup", 18 }, { "DllMain@12", 10 }, { "DllEntryPoint@0", 15 }, { "DllMainCRTStartup@12", 20 }, @@ -226,12 +229,14 @@ { "_pei386_runtime_relocator", 25 }, { "do_pseudo_reloc", 15 }, { "cygwin_crt0", 11 }, + { ".text", 5 }, { NULL, 0 } }; /* Do not specify library suffix explicitly, to allow for dllized versions. */ static autofilter_entry_type autofilter_liblist[] = { + { "libcegcc", 8 }, { "libcygwin", 9 }, { "libgcc", 6 }, { "libstdc++", 9 }, @@ -261,9 +266,10 @@ static autofilter_entry_type autofilter_symbolprefixlist[] = { - /* { "__imp_", 6 }, */ + { "__imp_", 6 }, /* Do __imp_ explicitly to save time. */ { "__rtti_", 7 }, + { ".idata$", 7 }, /* Don't re-export auto-imported symbols. */ { "_nm_", 4 }, { "__builtin_", 10 }, @@ -1130,9 +1167,14 @@ asymbol **symbols; int nsyms, symsize; +#if 0 /* If it's not loaded, we don't need to relocate it this way. */ + /* sometimes .data section gets no SEC_LOAD flag, but contains relocs */ if (!(s->output_section->flags & SEC_LOAD)) continue; +#endif + if (strncmp (bfd_get_section_name (abfd, s), ".idata",6) == 0) + continue; /* I don't know why there would be a reloc for these, but I've seen it happen - DJ */ @@ -1780,6 +1824,14 @@ 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }; +static unsigned char arm_jtab[] = +{ + 0x00, 0xc0, 0x9f, 0xe5, /* ldr ip, [pc] */ + 0x00, 0xf0, 0x9c, 0xe5, /* ldr pc, [ip] */ + 0, 0, 0, 0 +}; + + static bfd * make_one (def_file_export *exp, bfd *parent) { @@ -1801,6 +1853,10 @@ jmp_bytes = jmp_sh_bytes; jmp_byte_count = sizeof (jmp_sh_bytes); break; + case PE_ARCH_arm: + jmp_bytes = arm_jtab; + jmp_byte_count = sizeof (arm_jtab); + break; case PE_ARCH_mips: jmp_bytes = jmp_mips_bytes; jmp_byte_count = sizeof (jmp_mips_bytes); @@ -1873,6 +1933,9 @@ case PE_ARCH_sh: quick_reloc (abfd, 8, BFD_RELOC_32, 2); break; + case PE_ARCH_arm: + quick_reloc (abfd, 8, BFD_RELOC_32, 2); + break; case PE_ARCH_mips: quick_reloc (abfd, 0, BFD_RELOC_HI16_S, 2); quick_reloc (abfd, 0, BFD_RELOC_LO16, 0); /* MIPS_R_PAIR */ Index: ld/emultempl/pe.em =================================================================== RCS file: /cvs/src/src/ld/emultempl/pe.em,v retrieving revision 1.113 diff -u -r1.113 pe.em --- ld/emultempl/pe.em 24 Nov 2005 06:02:08 -0000 1.113 +++ ld/emultempl/pe.em 26 Apr 2006 22:31:27 -0000 @@ -283,7 +283,7 @@ D(MajorImageVersion,"__major_image_version__", 1), D(MinorImageVersion,"__minor_image_version__", 0), #ifdef TARGET_IS_armpe - D(MajorSubsystemVersion,"__major_subsystem_version__", 2), + D(MajorSubsystemVersion,"__major_subsystem_version__", 3), #else D(MajorSubsystemVersion,"__major_subsystem_version__", 4), #endif