Fix region length calculations when regions end with .align padding.
[deliverable/binutils-gdb.git] / gas / config / tc-mmix.h
index e0b6f492b68a8342a12d46c0ba86261b28118ec7..c6d222f1fdd3bb0ee2d9d0a4aa27c8f9c41fefce 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-mmix.h -- Header file for tc-mmix.c.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
    Written by Hans-Peter Nilsson (hp@bitrange.com).
 
    This file is part of GAS, the GNU Assembler.
@@ -17,7 +17,7 @@
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA. */
+   02111-1307, USA.  */
 
 #define TC_MMIX
 
@@ -75,7 +75,7 @@ extern int mmix_gnu_syntax;
   && (name[0] == '@'                                           \
       ? (! is_part_of_name (name[1])                           \
         && mmix_current_location (current_location, exp))      \
-      : ((name[0] == ':' || isupper (name[0]))                 \
+      : ((name[0] == ':' || ISUPPER (name[0]))                 \
         && mmix_parse_predefined_name (name, exp))))
 
 extern char *mmix_prefix_name PARAMS ((char *));
@@ -92,24 +92,25 @@ extern void mmix_fb_label PARAMS ((expressionS *));
 /* Since integer_constant is local to expr.c, we have to make this a
    macro.  FIXME: Do it cleaner.  */
 #define md_operand(exp)                                                        \
- do {                                                                  \
-  if (input_line_pointer[0] == '#')                                    \
+  do                                                                   \
     {                                                                  \
-      input_line_pointer++;                                            \
-      integer_constant (16, (exp));                                    \
+      if (input_line_pointer[0] == '#')                                        \
+       {                                                               \
+         input_line_pointer++;                                         \
+         integer_constant (16, (exp));                                 \
+       }                                                               \
+      else if (input_line_pointer[0] == '&'                            \
+              && input_line_pointer[1] != '&')                         \
+       as_bad (_("`&' serial number operator is not supported"));      \
+      else                                                             \
+       mmix_fb_label (exp);                                            \
     }                                                                  \
-  else if (input_line_pointer[0] == '&'                                        \
-          && input_line_pointer[1] != '&')                             \
-    as_bad (_("`&' serial number operator is not supported")); \
-  else                                                                 \
-    mmix_fb_label (exp);                                               \
- } while (0)
-
+  while (0)
 
 /* Gas dislikes the 2ADD, 8ADD etc. insns, so we have to assemble them in
    the error-recovery loop.  Hopefully there are no significant
    differences.  Also, space on a line isn't gracefully handled.  */
-extern int mmix_assemble_return_nonzero PARAMS ((char  *));
+extern int mmix_assemble_return_nonzero PARAMS ((char *));
 #define tc_unrecognized_line(c)                                                \
  ((c) == ' '                                                           \
   || (((c) == '1' || (c) == '2' || (c) == '4' || (c) == '8')           \
@@ -122,53 +123,57 @@ extern int mmix_assemble_return_nonzero PARAMS ((char  *));
 extern const struct relax_type mmix_relax_table[];
 #define TC_GENERIC_RELAX_TABLE mmix_relax_table
 
-/* We use the relax table for everything except the GREG frags.  */
+/* We use the relax table for everything except the GREG frags and PUSHJ.  */
 extern long mmix_md_relax_frag PARAMS ((segT, fragS *, long));
 #define md_relax_frag mmix_md_relax_frag
 
-#define tc_fix_adjustable(X)                                   \
- ((! (X)->fx_addsy                                             \
-   || (! S_IS_WEAK ((X)->fx_addsy)                             \
-       && S_GET_SEGMENT ((X)->fx_addsy) != reg_section))       \
-  && (X)->fx_r_type != BFD_RELOC_VTABLE_INHERIT                        \
-  && (X)->fx_r_type != BFD_RELOC_VTABLE_ENTRY)
+#define tc_fix_adjustable(FIX)                                 \
+ (((FIX)->fx_addsy == NULL                                     \
+   || S_GET_SEGMENT ((FIX)->fx_addsy) != reg_section)          \
+  && (FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT              \
+  && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY                        \
+  && (FIX)->fx_r_type != BFD_RELOC_MMIX_LOCAL)
 
 /* Adjust symbols which are registers.  */
 #define tc_adjust_symtab() mmix_adjust_symtab ()
 extern void mmix_adjust_symtab PARAMS ((void));
 
-/* Avoid outputting GAS register section symbols.  This happens when the
-   assembly had errors, and will propagate to an assert in BFD.  FIXME:
-   It seems the symbol output when-errors is a bug in GAS.  Fix that
-   some time.  See also tc_gen_reloc.
-
-   Here's where we make all symbols global, when so requested.
+/* Here's where we make all symbols global, when so requested.
    We must avoid doing that for expression symbols or section symbols,
    though.  */
 extern int mmix_globalize_symbols;
-#define tc_frob_symbol(sym, punt)                      \
- do {                                                  \
-  if (S_GET_SEGMENT (sym) == reg_section               \
-      || (symp) == section_symbol (absolute_section))  \
-    (punt) = 1;                                                \
-                                                       \
-  if (mmix_globalize_symbols                           \
-      && ! symbol_section_p (sym)                      \
-      && symp != section_symbol (absolute_section)     \
-      && (! S_IS_LOCAL (sym)                           \
-         || S_GET_SEGMENT (sym) == reg_section)        \
-      && (S_GET_SEGMENT (sym) != reg_section           \
-         || (S_GET_NAME (sym)[0] != '$'                \
-             && S_GET_VALUE (sym) < 256)))             \
-    S_SET_EXTERNAL (sym);                              \
- } while (0)
+#define tc_frob_symbol(sym, punt)                              \
+  do                                                           \
+    {                                                          \
+      if (S_GET_SEGMENT (sym) == reg_section)                  \
+       {                                                       \
+         if (S_GET_NAME (sym)[0] != '$'                        \
+             && S_GET_VALUE (sym) < 256)                       \
+           {                                                   \
+             if (mmix_globalize_symbols)                       \
+               S_SET_EXTERNAL (sym);                           \
+             else                                              \
+               symbol_mark_used_in_reloc (sym);                \
+           }                                                   \
+       }                                                       \
+      else if (mmix_globalize_symbols                          \
+              && ! symbol_section_p (sym)                      \
+              && sym != section_symbol (absolute_section)      \
+              && ! S_IS_LOCAL (sym))                           \
+       S_SET_EXTERNAL (sym);                                   \
+    }                                                          \
+  while (0)
+
+/* No shared lib support, so we don't need to ensure externally
+   visible symbols can be overridden.  */
+#define EXTERN_FORCE_RELOC 0
 
 /* When relaxing, we need to emit various relocs we otherwise wouldn't.  */
 #define TC_FORCE_RELOCATION(fix) mmix_force_relocation (fix)
 extern int mmix_force_relocation PARAMS ((struct fix *));
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
-#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
+#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
 extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
 
 #define md_section_align(seg, size) (size)
@@ -188,14 +193,22 @@ extern fragS *mmix_opcode_frag;
    fixups are done and relocs are output.  Similarly for each unknown
    symbol.  */
 extern void mmix_frob_file PARAMS ((void));
-#define tc_frob_file mmix_frob_file
+#define tc_frob_file_before_fix mmix_frob_file
 
 /* Used by mmix_frob_file.  Hangs on section symbols and unknown symbols.  */
 struct mmix_symbol_gregs;
 #define TC_SYMFIELD_TYPE struct mmix_symbol_gregs *
 
-extern void mmix_frob_file_before_adjust PARAMS ((void));
-#define tc_frob_file_before_adjust mmix_frob_file_before_adjust
+/* Used by relaxation, counting maximum needed PUSHJ stubs for a section.  */
+struct mmix_segment_info_type
+ {
+   /* We only need to keep track of the last stubbable frag because
+      there's no less hackish way to keep track of different relaxation
+      rounds.  */
+   fragS *last_stubfrag;
+   bfd_size_type nstubs;
+ };
+#define TC_SEGMENT_INFO_TYPE struct mmix_segment_info_type
 
 extern void mmix_md_elf_section_change_hook PARAMS ((void));
 #define md_elf_section_change_hook mmix_md_elf_section_change_hook
This page took 0.026122 seconds and 4 git commands to generate.