Back to index

cell-binutils  2.17cvs20070401
tc-frv.h
Go to the documentation of this file.
00001 /* tc-frv.h -- Header file for tc-frv.c.
00002    Copyright 2002, 2004, 2005 Free Software Foundation, Inc.
00003 
00004    This file is part of GAS, the GNU Assembler.
00005 
00006    GAS is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    GAS is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with GAS; see the file COPYING.  If not, write to
00018    the Free Software Foundation, 51 Franklin Street - Fifth Floor,
00019    Boston, MA 02110-1301, USA. */
00020 
00021 #define TC_FRV
00022 
00023 #define LISTING_HEADER "FRV GAS "
00024 
00025 /* The target BFD architecture.  */
00026 #define TARGET_ARCH bfd_arch_frv
00027 
00028 #define TARGET_FORMAT (frv_md_fdpic_enabled () \
00029                      ? "elf32-frvfdpic" : "elf32-frv")
00030 extern bfd_boolean frv_md_fdpic_enabled (void);
00031 
00032 #define TARGET_BYTES_BIG_ENDIAN 1
00033 
00034 /* Permit temporary numeric labels.  */
00035 #define LOCAL_LABELS_FB 1
00036 
00037 #define DIFF_EXPR_OK        /* .-foo gets turned into PC relative relocs */
00038 
00039 /* We don't need to handle .word strangely.  */
00040 #define WORKING_DOT_WORD
00041 
00042 /* Values passed to md_apply_fix don't include the symbol value.  */
00043 #define MD_APPLY_SYM_VALUE(FIX) 0
00044 
00045 extern void frv_tomcat_workaround PARAMS ((void));
00046 #define md_cleanup frv_tomcat_workaround
00047 
00048 #define md_number_to_chars frv_md_number_to_chars
00049 
00050 extern long frv_relax_frag PARAMS ((fragS *, long));
00051 #define md_relax_frag(segment, fragP, stretch) frv_relax_frag(fragP, stretch)
00052 
00053 #define tc_fix_adjustable(FIX) frv_fix_adjustable (FIX)
00054 struct fix;
00055 extern bfd_boolean frv_fix_adjustable PARAMS ((struct fix *));
00056 
00057 /* When relaxing, we need to emit various relocs we otherwise wouldn't.  */
00058 #define TC_FORCE_RELOCATION(fix) frv_force_relocation (fix)
00059 extern int frv_force_relocation PARAMS ((struct fix *));
00060 
00061 /* If we simplify subtractions that aren't SUB_SAME or SUB_ABS, we end
00062    up with PCrel fixups, but since we don't have any PCrel relocs, we
00063    crash.  Preventing simplification gets us a good, early error.  */
00064 #define TC_FORCE_RELOCATION_SUB_LOCAL(fixP) 1
00065 
00066 #undef GAS_CGEN_MAX_FIXUPS
00067 #define GAS_CGEN_MAX_FIXUPS 1
00068 
00069 void frv_frob_label PARAMS ((symbolS *));
00070 #define tc_frob_label(sym) frv_frob_label(sym)
00071 
00072 #define tc_gen_reloc gas_cgen_tc_gen_reloc
00073 
00074 #define md_cgen_record_fixup_exp frv_cgen_record_fixup_exp
00075 
00076 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
00077 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
00078 extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
00079 
00080 /* After all of the symbols have been adjusted, go over the file looking
00081    for any relocations that pic won't support.  */
00082 #define tc_frob_file() frv_frob_file ()
00083 extern void frv_frob_file   PARAMS ((void));
00084 
00085 /* We don't want 0x00 for code alignment because this generates `add.p
00086    gr0, gr0, gr0' patterns.  Although it's fine as a nop instruction,
00087    it has the VLIW packing bit set, which means if you have a bunch of
00088    them in a row and attempt to execute them, you'll exceed the VLIW
00089    capacity and fail.  This also gets GDB confused sometimes, because
00090    it won't set breakpoints in instructions other than the first of a
00091    VLIW pack, so you used to be unable to set a breakpoint in the
00092    initial instruction of a function that followed such
00093    alignment-introduced instructions.
00094 
00095    We could have arranged to emit `nop' instructions (0x80880000),
00096    maybe even VLIW-pack sequences of nop instructions as much as
00097    possible for the selected machine type, just in case the alignment
00098    code actually happens to run, but this is probably too much effort
00099    for little gain.  This code is not meant to be run anyway, so just
00100    emit nops.  */
00101 #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4)
00102 #define HANDLE_ALIGN(FRAGP) do                                        \
00103   if ((FRAGP)->fr_type == rs_align_code)                       \
00104     {                                                          \
00105       valueT count = ((FRAGP)->fr_next->fr_address                    \
00106                     - ((FRAGP)->fr_address + (FRAGP)->fr_fix));       \
00107       char *dest = (FRAGP)->fr_literal + (FRAGP)->fr_fix;             \
00108       if ((count & 3) != 0)                                    \
00109        {                                                       \
00110          memset (dest, 0, (count & 3));                        \
00111          (FRAGP)->fr_fix += (count & 3);                       \
00112          dest += (count & 3);                                         \
00113          count -= (count & 3);                                        \
00114        }                                                       \
00115       if (count)                                               \
00116        {                                                       \
00117          (FRAGP)->fr_var = 4;                                         \
00118          *dest++ = 0x80;                                       \
00119          *dest++ = 0x88;                                       \
00120          *dest++ = 0x00;                                       \
00121          *dest++ = 0x00;                                       \
00122        }                                                       \
00123     }                                                          \
00124  while (0)