Back to index

cell-binutils  2.17cvs20070401
sh.h
Go to the documentation of this file.
00001 /* coff information for Renesas SH
00002    
00003    Copyright 2000, 2003 Free Software Foundation, Inc.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 2 of the License, or
00008    (at your option) any later version.
00009    
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014    
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00018 
00019 #ifdef COFF_WITH_PE
00020 #define L_LNNO_SIZE 2
00021 #else
00022 #define L_LNNO_SIZE 4
00023 #endif
00024 #define INCLUDE_COMDAT_FIELDS_IN_AUXENT
00025 #include "coff/external.h"
00026 
00027 #define       SH_ARCH_MAGIC_BIG    0x0500
00028 #define       SH_ARCH_MAGIC_LITTLE 0x0550  /* Little endian SH */
00029 #define SH_ARCH_MAGIC_WINCE 0x01a2  /* Windows CE - little endian */
00030 #define SH_PE_MAGIC         0x010b
00031 
00032 #define SHBADMAG(x) \
00033  (((x).f_magic != SH_ARCH_MAGIC_BIG) && \
00034   ((x).f_magic != SH_ARCH_MAGIC_WINCE) && \
00035   ((x).f_magic != SH_ARCH_MAGIC_LITTLE))
00036 
00037 /* Define some NT default values.  */
00038 /*  #define NT_IMAGE_BASE        0x400000 moved to internal.h */
00039 #define NT_SECTION_ALIGNMENT 0x1000
00040 #define NT_FILE_ALIGNMENT    0x200
00041 #define NT_DEF_RESERVE       0x100000
00042 #define NT_DEF_COMMIT        0x1000
00043 
00044 /********************** RELOCATION DIRECTIVES **********************/
00045 
00046 /* The external reloc has an offset field, because some of the reloc
00047    types on the h8 don't have room in the instruction for the entire
00048    offset - eg the strange jump and high page addressing modes.  */
00049 
00050 #ifndef COFF_WITH_PE
00051 struct external_reloc
00052 {
00053   char r_vaddr[4];
00054   char r_symndx[4];
00055   char r_offset[4];
00056   char r_type[2];
00057   char r_stuff[2];
00058 };
00059 #else
00060 struct external_reloc
00061 {
00062   char r_vaddr[4];
00063   char r_symndx[4];
00064   char r_type[2];
00065 };
00066 #endif
00067 
00068 #define RELOC struct external_reloc
00069 #ifdef COFF_WITH_PE
00070 #define RELSZ 10
00071 #else
00072 #define RELSZ 16
00073 #endif
00074 
00075 /* SH relocation types.  Not all of these are actually used.  */
00076 
00077 #define R_SH_UNUSED  0             /* only used internally */
00078 #define R_SH_IMM32CE 2             /* 32 bit immediate for WinCE */
00079 #define R_SH_PCREL8  3             /*  8 bit pcrel      */
00080 #define R_SH_PCREL16        4             /* 16 bit pcrel      */
00081 #define R_SH_HIGH8   5             /* high 8 bits of 24 bit address */
00082 #define R_SH_LOW16   7             /* low 16 bits of 24 bit immediate */
00083 #define R_SH_IMM24   6             /* 24 bit immediate */
00084 #define R_SH_PCDISP8BY4     9             /* PC rel 8 bits *4 +ve */
00085 #define R_SH_PCDISP8BY2     10            /* PC rel 8 bits *2 +ve */
00086 #define R_SH_PCDISP8    11                /* 8 bit branch */
00087 #define R_SH_PCDISP     12                /* 12 bit branch */
00088 #define R_SH_IMM32      14                /* 32 bit immediate */
00089 #define R_SH_IMM8    16            /* 8 bit immediate */
00090 #define R_SH_IMAGEBASE      16            /* Windows CE */
00091 #define R_SH_IMM8BY2    17         /* 8 bit immediate *2 */
00092 #define R_SH_IMM8BY4    18         /* 8 bit immediate *4 */
00093 #define R_SH_IMM4    19            /* 4 bit immediate */
00094 #define R_SH_IMM4BY2    20         /* 4 bit immediate *2 */
00095 #define R_SH_IMM4BY4    21         /* 4 bit immediate *4 */
00096 #define R_SH_PCRELIMM8BY2   22            /* PC rel 8 bits *2 unsigned */
00097 #define R_SH_PCRELIMM8BY4   23            /* PC rel 8 bits *4 unsigned */
00098 #define R_SH_IMM16      24                /* 16 bit immediate */
00099 
00100 /* The switch table reloc types are used for relaxing.  They are
00101    generated for expressions such as
00102      .word L1 - L2
00103    The r_offset field holds the difference between the reloc address
00104    and L2.  */
00105 #define R_SH_SWITCH8 33            /* 8 bit switch table entry */
00106 #define R_SH_SWITCH16       25            /* 16 bit switch table entry */
00107 #define R_SH_SWITCH32       26            /* 32 bit switch table entry */
00108 
00109 /* The USES reloc type is used for relaxing.  The compiler will
00110    generate .uses pseudo-ops when it finds a function call which it
00111    can relax.  The r_offset field of the USES reloc holds the PC
00112    relative offset to the instruction which loads the register used in
00113    the function call.  */
00114 #define R_SH_USES    27            /* .uses pseudo-op */
00115 
00116 /* The COUNT reloc type is used for relaxing.  The assembler will
00117    generate COUNT relocs for addresses referred to by the register
00118    loads associated with USES relocs.  The r_offset field of the COUNT
00119    reloc holds the number of times the address is referenced in the
00120    object file.  */
00121 #define R_SH_COUNT   28            /* Count of constant pool uses */
00122 
00123 /* The ALIGN reloc type is used for relaxing.  The r_offset field is
00124    the power of two to which subsequent portions of the object file
00125    must be aligned.  */
00126 #define R_SH_ALIGN   29            /* .align pseudo-op */
00127 
00128 /* The CODE and DATA reloc types are used for aligning load and store
00129    instructions.  The assembler will generate a CODE reloc before a
00130    block of instructions.  It will generate a DATA reloc before data.
00131    A section should be processed assuming it contains data, unless a
00132    CODE reloc is seen.  The only relevant pieces of information in the
00133    CODE and DATA relocs are the section and the address.  The symbol
00134    and offset are meaningless.  */
00135 #define R_SH_CODE    30            /* start of code */
00136 #define R_SH_DATA    31            /* start of data */
00137 
00138 /* The LABEL reloc type is used for aligning load and store
00139    instructions.  The assembler will generate a LABEL reloc for each
00140    label within a block of instructions.  This permits the linker to
00141    avoid swapping instructions which are the targets of branches.  */
00142 #define R_SH_LABEL   32            /* label */
00143 
00144 /* NB: R_SH_SWITCH8 is 33 */
00145 
00146 #define R_SH_LOOP_START     34
00147 #define R_SH_LOOP_END       35