diff -Nur binutils-cvs20050202_2/bfd/coff-arm.c binutils-cvs20050202/bfd/coff-arm.c --- binutils-cvs20050202_2/bfd/coff-arm.c 2005-01-31 23:13:16.000000000 +0000 +++ binutils-cvs20050202/bfd/coff-arm.c 2005-12-11 10:46:00.000000000 +0000 @@ -273,7 +273,7 @@ complain_overflow_dont, aoutarm_fix_pcrel_26_done, "ARM_26D", - FALSE, + TRUE, 0x00ffffff, 0x0, PCRELOFFSET), @@ -286,7 +286,7 @@ complain_overflow_bitfield, coff_arm_reloc, "ARM_32", - FALSE, + TRUE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -299,7 +299,7 @@ complain_overflow_bitfield, coff_arm_reloc, "ARM_RVA32", - FALSE, + TRUE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -347,7 +347,7 @@ complain_overflow_bitfield, coff_arm_reloc, "ARM_SECTION", - FALSE, + TRUE, 0x0000ffff, 0x0000ffff, PCRELOFFSET), @@ -360,7 +360,7 @@ complain_overflow_bitfield, coff_arm_reloc, "ARM_SECREL", - FALSE, + TRUE, 0xffffffff, 0xffffffff, PCRELOFFSET), @@ -1288,6 +1295,8 @@ #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 @@ -1303,7 +1312,7 @@ VxWorks and EPOC-PE targets, but it is also known that it was suppressed for other ARM targets. This ought to be sorted out one day. */ -#ifdef ARM_COFF_BUGFIX +#if 1//def ARM_COFF_BUGFIX /* We must not ignore the symbol value. If the symbol is within the same section, the relocation should have already been fixed, but if it is not, we'll be handed a reloc into diff -Nur binutils-cvs20050202_2/gas/config/tc-arm.c binutils-cvs20050202/gas/config/tc-arm.c --- binutils-cvs20050202_2/gas/config/tc-arm.c 2005-01-31 23:18:26.000000000 +0000 +++ binutils-cvs20050202/gas/config/tc-arm.c 2005-12-08 21:59:08.000000000 +0000 @@ -1106,7 +1106,10 @@ } inst.reloc.exp.X_op = O_symbol; - inst.reloc.exp.X_add_number = ((int) entry) * 4 - 8; + inst.reloc.exp.X_add_number = ((int) entry) * 4; +#ifndef TE_WINCE + inst.reloc.exp.X_add_number -= 8; /* PC relative adjust. */ +#endif inst.reloc.exp.X_add_symbol = pool->symbol; return SUCCESS; @@ -2404,7 +2407,9 @@ return FAIL; inst.reloc.type = BFD_RELOC_ARM_CP_OFF_IMM; +#ifndef TE_WINCE inst.reloc.exp.X_add_number -= 8; /* PC rel adjust. */ +#endif inst.reloc.pc_rel = 1; inst.instruction |= (REG_PC << 16); pre_inc = PRE_INDEX; @@ -2540,7 +2545,9 @@ return FAIL; inst.reloc.type = BFD_RELOC_ARM_CP_OFF_IMM_S2; - inst.reloc.exp.X_add_number -= 8; /* PC rel adjust. */ +#ifndef TE_WINCE + inst.reloc.exp.X_add_number -= 8; /* PC relative adjust. */ +#endif inst.reloc.pc_rel = 1; inst.instruction |= (REG_PC << 16); pre_inc = PRE_INDEX; @@ -3054,7 +3061,9 @@ inst.instruction |= HWOFFSET_IMM; /* The I bit. */ inst.reloc.type = BFD_RELOC_ARM_OFFSET_IMM8; +#ifndef TE_WINCE inst.reloc.exp.X_add_number -= 8; /* PC rel adjust. */ +#endif inst.reloc.pc_rel = 1; inst.instruction |= (REG_PC << 16); diff -Nur binutils-cvs20050202_2/gas/config/te-pe.h binutils-cvs20050202/gas/config/te-pe.h --- binutils-cvs20050202_2/gas/config/te-pe.h 2002-11-06 19:36:20.000000000 +0000 +++ binutils-cvs20050202/gas/config/te-pe.h 2005-12-04 19:26:56.000000000 +0000 @@ -1,3 +1,4 @@ +#define TE_WINCE #define TE_PE #define LEX_AT (LEX_BEGIN_NAME | LEX_NAME) /* Can have @'s inside labels. */ diff -Nur binutils-cvs20050202_2/ld/pe-dll.c binutils-cvs20050202/ld/pe-dll.c --- binutils-cvs20050202_2/ld/pe-dll.c 2005-01-21 04:16:00.000000000 +0000 +++ binutils-cvs20050202/ld/pe-dll.c 2005-12-05 00:45:10.000000000 +0000 @@ -199,7 +199,7 @@ 11 /* ARM_RVA32 */, PE_ARCH_arm, bfd_arch_arm, - 1 + 0 }, { "epoc-pei-arm-little", @@ -226,6 +226,7 @@ { "_pei386_runtime_relocator", 25 }, { "do_pseudo_reloc", 15 }, { "cygwin_crt0", 11 }, + { ".text", 5 }, { NULL, 0 } }; @@ -261,9 +262,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 }, @@ -735,8 +768,8 @@ else { /* xgettext:c-format */ - einfo (_("%XCannot export %s: symbol not found\n"), - pe_def_file->exports[i].internal_name); + einfo (_("%XCannot export %s (%s): symbol not found\n"), + pe_def_file->exports[i].internal_name,pe_def_file->exports[i].name); } free (name); } @@ -1083,9 +1116,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 */ @@ -1733,6 +1773,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) { @@ -1754,6 +1802,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); @@ -1826,6 +1882,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 */