From 056350c6bd025c6b73b25f39247c890581b215b1 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 24 Feb 2000 19:49:18 +0000 Subject: [PATCH] Add support for WinCE targeted toolchains. --- gas/ChangeLog | 30 ++++++ gas/config/obj-coff.h | 17 +++ gas/config/tc-arm.c | 26 ++++- gas/config/tc-mips.c | 16 ++- gas/config/tc-mips.h | 3 +- gas/config/tc-sh.c | 7 ++ gas/config/tc-sh.h | 6 +- gas/config/te-wince-pe.h | 2 + gas/configure | 3 + gas/configure.in | 3 + include/coff/ChangeLog | 7 ++ include/coff/arm.h | 21 +++- include/coff/mipspe.h | 223 +++++++++++++++++++++++++++++++++++++++ include/coff/pe.h | 14 ++- include/coff/sh.h | 37 +++++++ 15 files changed, 405 insertions(+), 10 deletions(-) create mode 100644 gas/config/te-wince-pe.h create mode 100644 include/coff/mipspe.h diff --git a/gas/ChangeLog b/gas/ChangeLog index 5f9004c667..574ac0a3e4 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,33 @@ +2000-02-24 Nick Clifton + + * configure: Add arm-wince, mips-pe and sh-pe targets. + * configure: Regenerate. + + * config/obj-coff.h (COFF_WITH_PE): Define for mips-pe and + sh-pe targets. + (TARGET_FORMAT): Set to "pe-shl" for the sh-pe target and to + "pe-mips" for the mips-pe target. + + * config/tc-arm.c (insns): Change displacement encoded in BL + and B instructions if the target port is arm-wince. + (do_ldst): Do not bias the relocation offset if the target + port is arm-wince. + (md_pcrel_from): Add in missing relocation offset bias if the + target os arm-wince. + + * config/tc-mips.c (mips_target_format): Support COFF flavour. + (md_begin): Disable -G support for mips-pe target. + (md_apply_fix): Treat BFD_RELOC_RVA reloc as BFD_RELOC_32. + * config/tc-mips.h (USE_GLOBAL_POINTER_OPT): Add support for + COFF flavour. + + * config/tc-sh.c (md_begin): sh-pe target is little endian. + * config/tc-sh.h (SUB_SEGMENT_ALIGN): If using a BFD + assembler, just set the alignment to 4. + + * config/te-wince-pe.h: New file for WinCE targets. Define + TE_WINCE. + 2000-02-25 Alan Modra * config/tc-i386.c (md_assemble): Swap segments too for intel mode diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h index a616872801..f60ae365fb 100644 --- a/gas/config/obj-coff.h +++ b/gas/config/obj-coff.h @@ -110,12 +110,29 @@ #endif #ifdef TC_SH + +#ifdef TE_PE +#define COFF_WITH_PE +#endif + #include "coff/sh.h" + +#ifdef TE_PE +#define TARGET_FORMAT "pe-shl" +#else #define TARGET_FORMAT \ (shl \ ? (sh_small ? "coff-shl-small" : "coff-shl") \ : (sh_small ? "coff-sh-small" : "coff-sh")) #endif +#endif + +#ifdef TC_MIPS +#define COFF_WITH_PE +#include "coff/mipspe.h" +#undef TARGET_FORMAT +#define TARGET_FORMAT "pe-mips" +#endif #ifdef TC_M88K #include "coff/m88k.h" diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 86e36008fc..f8f43bed33 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -1,5 +1,5 @@ /* tc-arm.c -- Assemble for the ARM - Copyright (C) 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. + Copyright (C) 1994, 95, 96, 97, 98, 1999, 2000 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Modified by David Taylor (dtaylor@armltd.co.uk) @@ -54,7 +54,7 @@ #define ARM_EXT_V5 0x00000080 /* allow CLZ etc */ #define ARM_EXT_V5E 0x00000200 /* "El Segundo" */ -/* Architectures are the sum of the base and extensions */ +/* Architectures are the sum of the base and extensions. */ #define ARM_ARCH_V4 (ARM_7 | ARM_LONGMUL | ARM_HALFWORD) #define ARM_ARCH_V4T (ARM_ARCH_V4 | ARM_THUMB) #define ARM_ARCH_V5 (ARM_ARCH_V4 | ARM_EXT_V5) @@ -547,9 +547,14 @@ static CONST struct asm_opcode insns[] = {"stm", 0x08000000, NULL, stm_flags, ARM_ANY, do_ldmstm}, {"ldm", 0x08100000, NULL, ldm_flags, ARM_ANY, do_ldmstm}, {"swi", 0x0f000000, NULL, NULL, ARM_ANY, do_swi}, +#ifdef TE_WINCE + {"bl", 0x0b000000, NULL, NULL, ARM_ANY, do_branch}, + {"b", 0x0a000000, NULL, NULL, ARM_ANY, do_branch}, +#else {"bl", 0x0bfffffe, NULL, NULL, ARM_ANY, do_branch}, {"b", 0x0afffffe, NULL, NULL, ARM_ANY, do_branch}, - +#endif + /* Pseudo ops */ {"adr", 0x028f0000, NULL, NULL, ARM_ANY, do_adr}, {"adrl", 0x028f0000, NULL, NULL, ARM_ANY, do_adrl}, @@ -3020,7 +3025,9 @@ do_ldst (str, flags) } else inst.reloc.type = BFD_RELOC_ARM_OFFSET_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 = 1; @@ -4116,6 +4123,7 @@ thumb_add_sub (str, subtract) } } } + end_of_line (str); } @@ -4140,7 +4148,7 @@ thumb_shift (str, shift) { /* Two operand immediate format, set Rs to Rd. */ Rs = Rd; - str++; + str ++; if (my_get_expression (&inst.reloc.exp, &str)) return; } @@ -4225,6 +4233,7 @@ thumb_shift (str, shift) inst.instruction |= Rd | (Rs << 3); } + end_of_line (str); } @@ -5206,7 +5215,13 @@ md_pcrel_from (fixP) return (fixP->fx_where + fixP->fx_frag->fr_address) & ~3; } +#ifdef TE_WINCE + /* The pattern was adjusted to accomodate CE's off-by-one fixups, + so we un-adjust here to compensate for the accomodation. */ + return fixP->fx_where + fixP->fx_frag->fr_address + 8; +#else return fixP->fx_where + fixP->fx_frag->fr_address; +#endif } /* Round up a section size to the appropriate boundary. */ @@ -6890,13 +6905,14 @@ arm_adjust_symtab () #endif #ifdef OBJ_ELF symbolS * sym; - elf_symbol_type * elf_sym; char bind; for (sym = symbol_rootP; sym != NULL; sym = symbol_next (sym)) { if (ARM_IS_THUMB (sym)) { + elf_symbol_type * elf_sym; + elf_sym = elf_symbol (symbol_get_bfdsym (sym)); bind = ELF_ST_BIND (elf_sym); diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index b8b8c46988..9426519c67 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -1,5 +1,5 @@ /* tc-mips.c -- assemble code for a MIPS chip. - Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 97, 98, 1999, 2000 Free Software Foundation, Inc. Contributed by the OSF and Ralph Campbell. Written by Keith Knowles and Ralph Campbell, working independently. Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus @@ -118,6 +118,8 @@ mips_target_format () return target_big_endian ? "a.out-mips-big" : "a.out-mips-little"; case bfd_target_ecoff_flavour: return target_big_endian ? "ecoff-bigmips" : ECOFF_LITTLE_FORMAT; + case bfd_target_coff_flavour: + return "pe-mips"; case bfd_target_elf_flavour: return (target_big_endian ? (mips_64 ? "elf64-bigmips" : "elf32-bigmips") @@ -133,6 +135,8 @@ mips_target_format () ? ".data" \ : OUTPUT_FLAVOR == bfd_target_ecoff_flavour \ ? ".rdata" \ + : OUTPUT_FLAVOR == bfd_target_coff_flavour \ + ? ".rdata" \ : OUTPUT_FLAVOR == bfd_target_elf_flavour \ ? ".rodata" \ : (abort (), "")) @@ -848,6 +852,15 @@ md_begin () int broken = 0; int mips_isa_from_cpu; + /* GP relative stuff not working for PE */ + if (strncmp (TARGET_OS, "pe", 2) == 0 + && g_switch_value != 0) + { + if (g_switch_seen) + as_bad (_("-G not supported in this configuration.")); + g_switch_value = 0; + } + cpu = TARGET_CPU; if (strcmp (cpu + (sizeof TARGET_CPU) - 3, "el") == 0) { @@ -9645,6 +9658,7 @@ md_apply_fix (fixP, valueP) } break; + case BFD_RELOC_RVA: case BFD_RELOC_32: /* If we are deleting this reloc entry, we must fill in the value now. This can happen if we have a .word which is not diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h index a17c642169..1008b75ecc 100644 --- a/gas/config/tc-mips.h +++ b/gas/config/tc-mips.h @@ -1,5 +1,5 @@ /* tc-mips.h -- header file for tc-mips.c. - Copyright (C) 1993, 94, 95, 96, 97, 1999 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 97, 1999, 2000 Free Software Foundation, Inc. Contributed by the OSF and Ralph Campbell. Written by Keith Knowles and Ralph Campbell, working independently. Modified for ECOFF support by Ian Lance Taylor of Cygnus Support. @@ -142,6 +142,7 @@ extern void md_mips_end PARAMS ((void)); #define md_end() md_mips_end() #define USE_GLOBAL_POINTER_OPT (OUTPUT_FLAVOR == bfd_target_ecoff_flavour \ + || OUTPUT_FLAVOR == bfd_target_coff_flavour \ || OUTPUT_FLAVOR == bfd_target_elf_flavour) extern void mips_pop_insert PARAMS ((void)); diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 777d76cf24..66dbb5b38c 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -206,8 +206,13 @@ md_begin () char *prev_name = ""; int target_arch; +#ifdef TE_PE + /* The WinCE OS only supports little endian executables. */ + target_big_endian = 0; +#else if (! shl) target_big_endian = 1; +#endif target_arch = arch_sh1_up & ~(sh_dsp ? arch_sh3e_up : arch_sh_dsp_up); valid_arch = target_arch; @@ -1678,6 +1683,7 @@ DEFUN (md_undefined_symbol, (name), } #ifdef OBJ_COFF +#ifndef BFD_ASSEMBLER void DEFUN (tc_crawl_symbol_chain, (headers), @@ -1693,6 +1699,7 @@ DEFUN (tc_headers_hook, (headers), printf (_("call to tc_headers_hook \n")); } +#endif #endif /* Various routines to kill one day */ diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h index 90129c2065..099e915391 100644 --- a/gas/config/tc-sh.h +++ b/gas/config/tc-sh.h @@ -1,5 +1,5 @@ /* This file is tc-sh.h - Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. + Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -129,6 +129,9 @@ extern void sh_coff_reloc_mangle #define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag) extern int tc_coff_sizemachdep PARAMS ((fragS *)); +#ifdef BFD_ASSEMBLER +#define SUB_SEGMENT_ALIGN(SEG) 4 +#else /* We align most sections to a 16 byte boundary. */ #define SUB_SEGMENT_ALIGN(SEG) \ (strncmp (obj_segment_name (SEG), ".stabstr", 8) == 0 \ @@ -138,6 +141,7 @@ extern int tc_coff_sizemachdep PARAMS ((fragS *)); || strcmp (obj_segment_name (SEG), ".dtors") == 0) \ ? 2 \ : (sh_small ? 2 : 4))) +#endif #endif /* OBJ_COFF */ diff --git a/gas/config/te-wince-pe.h b/gas/config/te-wince-pe.h new file mode 100644 index 0000000000..d1193b8602 --- /dev/null +++ b/gas/config/te-wince-pe.h @@ -0,0 +1,2 @@ +#define TE_WINCE +#include "te-pe.h" diff --git a/gas/configure b/gas/configure index 6bcc0d34a2..62d35d1881 100755 --- a/gas/configure +++ b/gas/configure @@ -2089,6 +2089,7 @@ for this_target in $target $canon_targets ; do arm-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; arm-*-oabi | thumb-*-oabi) fmt=elf ;; arm-epoc-pe | thumb-epoc-pe) fmt=coff em=epoc-pe ;; + arm-*-wince) fmt=coff em=wince-pe bfd_gas=yes;; arm-*-pe | thumb-*-pe) fmt=coff em=pe ;; arm-*-riscix*) fmt=aout em=riscix ;; @@ -2203,6 +2204,7 @@ EOF mips-*-osf*) fmt=ecoff endian=little ;; mips-*-ecoff*) fmt=ecoff ;; mips-*-ecoff*) fmt=ecoff ;; + mips-*-pe*) fmt=coff endian=little em=pe ;; mips-*-irix6*) fmt=elf ;; mips-*-irix5*) fmt=elf ;; mips-*-irix*) fmt=ecoff ;; @@ -2251,6 +2253,7 @@ EOF sh-*-elf*) fmt=elf ;; sh-*-coff*) fmt=coff ;; + sh-*-pe*) fmt=coff em=pe bfd_gas=yes;; sh-*-rtemself*) fmt=elf ;; sh-*-rtems*) fmt=coff ;; diff --git a/gas/configure.in b/gas/configure.in index b6d6d0b5e7..361ae64947 100644 --- a/gas/configure.in +++ b/gas/configure.in @@ -155,6 +155,7 @@ changequote([,])dnl arm-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; arm-*-oabi | thumb-*-oabi) fmt=elf ;; arm-epoc-pe | thumb-epoc-pe) fmt=coff em=epoc-pe ;; + arm-*-wince) fmt=coff em=wince-pe bfd_gas=yes;; arm-*-pe | thumb-*-pe) fmt=coff em=pe ;; arm-*-riscix*) fmt=aout em=riscix ;; @@ -267,6 +268,7 @@ changequote([,])dnl mips-*-osf*) fmt=ecoff endian=little ;; mips-*-ecoff*) fmt=ecoff ;; mips-*-ecoff*) fmt=ecoff ;; + mips-*-pe*) fmt=coff endian=little em=pe ;; mips-*-irix6*) fmt=elf ;; mips-*-irix5*) fmt=elf ;; mips-*-irix*) fmt=ecoff ;; @@ -311,6 +313,7 @@ changequote([,])dnl sh-*-elf*) fmt=elf ;; sh-*-coff*) fmt=coff ;; + sh-*-pe*) fmt=coff em=pe bfd_gas=yes;; sh-*-rtemself*) fmt=elf ;; sh-*-rtems*) fmt=coff ;; diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index 7d5b236dac..1890c80ec4 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,10 @@ +2000-02-22 Nick Clifton DJ Delorie + + * sh.h: Add Windows CE definitions. + * arm.h: Add Windows CE definitions. + * mipspe.h: New file: Windows CE definitions for MIPS. + * pe.h: Add constants for ILF support. + 2000-01-05 Nick Clifton * pe.h: Fix formatting of comments. diff --git a/include/coff/arm.h b/include/coff/arm.h index d5163f8222..7ca93299ad 100644 --- a/include/coff/arm.h +++ b/include/coff/arm.h @@ -85,10 +85,16 @@ struct external_filehdr * XXX - NC 5/6/97 */ -#define ARMMAGIC 0xa00 /* I just made this up */ +#define ARMMAGIC 0xa00 /* I just made this up */ #define ARMBADMAG(x) (((x).f_magic != ARMMAGIC)) +#define ARMPEMAGIC 0x1c0 +#define THUMBPEMAGIC 0x1c2 + +#undef ARMBADMAG +#define ARMBADMAG(x) (((x).f_magic != ARMMAGIC) && ((x).f_magic != ARMPEMAGIC) && ((x).f_magic != THUMBPEMAGIC)) + #define FILHDR struct external_filehdr #define FILHSZ 20 @@ -272,6 +278,18 @@ union external_auxent #define _ETEXT "etext" /********************** RELOCATION DIRECTIVES **********************/ +#ifdef ARM_WINCE +struct external_reloc +{ + char r_vaddr[4]; + char r_symndx[4]; + char r_type[2]; +}; + +#define RELOC struct external_reloc +#define RELSZ 10 + +#else struct external_reloc { char r_vaddr[4]; @@ -282,3 +300,4 @@ struct external_reloc #define RELOC struct external_reloc #define RELSZ 14 +#endif diff --git a/include/coff/mipspe.h b/include/coff/mipspe.h new file mode 100644 index 0000000000..f8ca624bdf --- /dev/null +++ b/include/coff/mipspe.h @@ -0,0 +1,223 @@ +/*** coff information for Windows CE with MIPS VR4111 */ + +/********************** FILE HEADER **********************/ + +struct external_filehdr { + char f_magic[2]; /* magic number */ + char f_nscns[2]; /* number of sections */ + char f_timdat[4]; /* time & date stamp */ + char f_symptr[4]; /* file pointer to symtab */ + char f_nsyms[4]; /* number of symtab entries */ + char f_opthdr[2]; /* sizeof(optional hdr) */ + char f_flags[2]; /* flags */ +}; + + + +#define MIPS_ARCH_MAGIC_WINCE 0x0166 /* Windows CE - little endian */ + + +#define MIPSBADMAG(x) \ + ((x).f_magic!=MIPS_ARCH_MAGIC_WINCE) + +#define FILHDR struct external_filehdr +#define FILHSZ 20 + + +/********************** AOUT "OPTIONAL HEADER" **********************/ + + +typedef struct +{ + char magic[2]; /* type of file */ + char vstamp[2]; /* version stamp */ + char tsize[4]; /* text size in bytes, padded to FW bdry*/ + char dsize[4]; /* initialized data " " */ + char bsize[4]; /* uninitialized data " " */ + char entry[4]; /* entry pt. */ + char text_start[4]; /* base of text used for this file */ + char data_start[4]; /* base of data used for this file */ +} +AOUTHDR; + + +#define AOUTHDRSZ 28 +#define AOUTSZ 28 + + + + +/* define some NT default values */ +/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ +#define NT_SECTION_ALIGNMENT 0x1000 +#define NT_FILE_ALIGNMENT 0x200 +#define NT_DEF_RESERVE 0x100000 +#define NT_DEF_COMMIT 0x1000 + +/********************** SECTION HEADER **********************/ + + +struct external_scnhdr { + char s_name[8]; /* section name */ + char s_paddr[4]; /* physical address, aliased s_nlib */ + char s_vaddr[4]; /* virtual address */ + char s_size[4]; /* section size */ + char s_scnptr[4]; /* file ptr to raw data for section */ + char s_relptr[4]; /* file ptr to relocation */ + char s_lnnoptr[4]; /* file ptr to line numbers */ + char s_nreloc[2]; /* number of relocation entries */ + char s_nlnno[2]; /* number of line number entries*/ + char s_flags[4]; /* flags */ +}; + +/* + * names of "special" sections + */ +#define _TEXT ".text" +#define _DATA ".data" +#define _BSS ".bss" + + +#define SCNHDR struct external_scnhdr +#define SCNHSZ 40 + + +/********************** LINE NUMBERS **********************/ + +/* 1 line number entry for every "breakpointable" source line in a section. + * Line numbers are grouped on a per function basis; first entry in a function + * grouping will have l_lnno = 0 and in place of physical address will be the + * symbol table index of the function name. + */ +struct external_lineno { + union { + char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ + char l_paddr[4]; /* (physical) address of line number */ + } l_addr; + char l_lnno[2]; /* line number */ +}; + +#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); +#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); + +#define LINENO struct external_lineno +#define LINESZ 6 + + +/********************** SYMBOLS **********************/ + +#define E_SYMNMLEN 8 /* # characters in a symbol name */ +#define E_FILNMLEN 14 /* # characters in a file name */ +#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ + +struct external_syment +{ + union { + char e_name[E_SYMNMLEN]; + struct { + char e_zeroes[4]; + char e_offset[4]; + } e; + } e; + char e_value[4]; + char e_scnum[2]; + char e_type[2]; + char e_sclass[1]; + char e_numaux[1]; +}; + + + +#define N_BTMASK (017) +#define N_TMASK (060) +#define N_BTSHFT (4) +#define N_TSHIFT (2) + + +union external_auxent { + struct { + char x_tagndx[4]; /* str, un, or enum tag indx */ + union { + struct { + char x_lnno[2]; /* declaration line number */ + char x_size[2]; /* str/union/array size */ + } x_lnsz; + char x_fsize[4]; /* size of function */ + } x_misc; + union { + struct { /* if ISFCN, tag, or .bb */ + char x_lnnoptr[4]; /* ptr to fcn line # */ + char x_endndx[4]; /* entry ndx past block end */ + } x_fcn; + struct { /* if ISARY, up to 4 dimen. */ + char x_dimen[E_DIMNUM][2]; + } x_ary; + } x_fcnary; + char x_tvndx[2]; /* tv index */ + } x_sym; + + union { + char x_fname[E_FILNMLEN]; + struct { + char x_zeroes[4]; + char x_offset[4]; + } x_n; + } x_file; + + struct { + char x_scnlen[4]; /* section length */ + char x_nreloc[2]; /* # relocation entries */ + char x_nlinno[2]; /* # line numbers */ + char x_checksum[4]; /* section COMDAT checksum */ + char x_associated[2]; /* COMDAT associated section index */ + char x_comdat[1]; /* COMDAT selection number */ + } x_scn; + + struct { + char x_tvfill[4]; /* tv fill value */ + char x_tvlen[2]; /* length of .tv */ + char x_tvran[2][2]; /* tv range */ + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ + + +}; + +#define SYMENT struct external_syment +#define SYMESZ 18 +#define AUXENT union external_auxent +#define AUXESZ 18 + + + +/********************** RELOCATION DIRECTIVES **********************/ + +/* The external reloc has an offset field, because some of the reloc + types on the h8 don't have room in the instruction for the entire + offset - eg the strange jump and high page addressing modes */ + +struct external_reloc { + char r_vaddr[4]; + char r_symndx[4]; + char r_type[2]; +}; + + +#define RELOC struct external_reloc +#define RELSZ 10 + +/* MIPS PE relocation types. */ + +#define MIPS_R_ABSOLUTE 0 /* ignored */ +#define MIPS_R_REFHALF 1 +#define MIPS_R_REFWORD 2 +#define MIPS_R_JMPADDR 3 +#define MIPS_R_REFHI 4 /* PAIR follows */ +#define MIPS_R_REFLO 5 +#define MIPS_R_GPREL 6 +#define MIPS_R_LITERAL 7 /* same as GPREL */ +#define MIPS_R_SECTION 10 +#define MIPS_R_SECREL 11 +#define MIPS_R_SECRELLO 12 +#define MIPS_R_SECRELHI 13 /* PAIR follows */ +#define MIPS_R_RVA 34 /* 0x22 */ +#define MIPS_R_PAIR 37 /* 0x25 - symndx is really a signed 16-bit addend */ diff --git a/include/coff/pe.h b/include/coff/pe.h index 6a1954ca63..6932ee87b7 100644 --- a/include/coff/pe.h +++ b/include/coff/pe.h @@ -183,4 +183,16 @@ typedef struct #undef E_FILNMLEN #define E_FILNMLEN 18 /* # characters in a file name */ -#endif + +/* Import Tyoes fot ILF format object files.. */ +#define IMPORT_CODE 0 +#define IMPORT_DATA 1 +#define IMPORT_CONST 2 + +/* Import Name Tyoes for ILF format object files. */ +#define IMPORT_ORDINAL 0 +#define IMPORT_NAME 1 +#define IMPORT_NAME_NOPREFIX 2 +#define IMPORT_NAME_UNDECORATE 3 + +#endif /* _PE_H */ diff --git a/include/coff/sh.h b/include/coff/sh.h index 41957df7f9..2065b626cc 100644 --- a/include/coff/sh.h +++ b/include/coff/sh.h @@ -16,10 +16,12 @@ struct external_filehdr { #define SH_ARCH_MAGIC_BIG 0x0500 #define SH_ARCH_MAGIC_LITTLE 0x0550 /* Little endian SH */ +#define SH_ARCH_MAGIC_WINCE 0x01a2 /* Windows CE - little endian */ #define SHBADMAG(x) \ (((x).f_magic!=SH_ARCH_MAGIC_BIG) && \ + ((x).f_magic!=SH_ARCH_MAGIC_WINCE) && \ ((x).f_magic!=SH_ARCH_MAGIC_LITTLE)) #define FILHDR struct external_filehdr @@ -48,6 +50,12 @@ AOUTHDR; +/* Define some NT default values. */ +/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ +#define NT_SECTION_ALIGNMENT 0x1000 +#define NT_FILE_ALIGNMENT 0x200 +#define NT_DEF_RESERVE 0x100000 +#define NT_DEF_COMMIT 0x1000 /********************** SECTION HEADER **********************/ @@ -89,14 +97,26 @@ struct external_lineno { char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ char l_paddr[4]; /* (physical) address of line number */ } l_addr; +#ifdef COFF_WITH_PE + char l_lnno[2]; /* line number */ +#else char l_lnno[4]; /* line number */ +#endif }; #define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) (ext->l_lnno)); #define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32(abfd,val, (bfd_byte *) (ext->l_lnno)); #define LINENO struct external_lineno +#ifdef COFF_WITH_PE +#define LINESZ 6 +#undef GET_LINENO_LNNO +#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); +#undef PUT_LINENO_LNNO +#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); +#else #define LINESZ 8 +#endif /********************** SYMBOLS **********************/ @@ -163,6 +183,9 @@ union external_auxent { char x_scnlen[4]; /* section length */ char x_nreloc[2]; /* # relocation entries */ char x_nlinno[2]; /* # line numbers */ + char x_checksum[4]; /* section COMDAT checksum */ + char x_associated[2]; /* COMDAT associated section index */ + char x_comdat[1]; /* COMDAT selection number */ } x_scn; struct { @@ -187,6 +210,7 @@ union external_auxent { types on the h8 don't have room in the instruction for the entire offset - eg the strange jump and high page addressing modes */ +#ifndef COFF_WITH_PE struct external_reloc { char r_vaddr[4]; char r_symndx[4]; @@ -194,14 +218,26 @@ struct external_reloc { char r_type[2]; char r_stuff[2]; }; +#else +struct external_reloc { + char r_vaddr[4]; + char r_symndx[4]; + char r_type[2]; +}; +#endif #define RELOC struct external_reloc +#ifdef COFF_WITH_PE +#define RELSZ 10 +#else #define RELSZ 16 +#endif /* SH relocation types. Not all of these are actually used. */ #define R_SH_UNUSED 0 /* only used internally */ +#define R_SH_IMM32CE 2 /* 32 bit immediate for WinCE */ #define R_SH_PCREL8 3 /* 8 bit pcrel */ #define R_SH_PCREL16 4 /* 16 bit pcrel */ #define R_SH_HIGH8 5 /* high 8 bits of 24 bit address */ @@ -213,6 +249,7 @@ struct external_reloc { #define R_SH_PCDISP 12 /* 12 bit branch */ #define R_SH_IMM32 14 /* 32 bit immediate */ #define R_SH_IMM8 16 /* 8 bit immediate */ +#define R_SH_IMAGEBASE 16 /* Windows CE */ #define R_SH_IMM8BY2 17 /* 8 bit immediate *2 */ #define R_SH_IMM8BY4 18 /* 8 bit immediate *4 */ #define R_SH_IMM4 19 /* 4 bit immediate */ -- 2.34.1