Don't try to read past end of info buffer, and correct test results.
[deliverable/binutils-gdb.git] / gas / frags.c
index f5a9d9e5e59889c5a83e219a7afcfda882010c3c..4dc2a7d564bbb50f6b58b3921e3dd4476b19f838 100644 (file)
@@ -1,5 +1,6 @@
 /* frags.c - manage frags -
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -322,6 +323,39 @@ frag_align_pattern (alignment, fill_pattern, n_fill, max)
   memcpy (p, fill_pattern, n_fill);
 }
 
+/* The NOP_OPCODE is for the alignment fill value.  Fill it with a nop
+   instruction so that the disassembler does not choke on it.  */
+#ifndef NOP_OPCODE
+#define NOP_OPCODE 0x00
+#endif
+
+/* Use this to restrict the amount of memory allocated for representing
+   the alignment code.  Needs to be large enough to hold any fixed sized
+   prologue plus the replicating portion.  */
+#ifndef MAX_MEM_FOR_RS_ALIGN_CODE
+  /* Assume that if HANDLE_ALIGN is not defined then no special action
+     is required to code fill, which means that we get just repeat the
+     one NOP_OPCODE byte.  */
+# ifndef HANDLE_ALIGN
+#  define MAX_MEM_FOR_RS_ALIGN_CODE  1
+# else
+#  define MAX_MEM_FOR_RS_ALIGN_CODE  ((1 << alignment) - 1)
+# endif
+#endif
+
+void
+frag_align_code (alignment, max)
+     int alignment;
+     int max;
+{
+  char *p;
+
+  p = frag_var (rs_align_code, MAX_MEM_FOR_RS_ALIGN_CODE, 1,
+               (relax_substateT) max, (symbolS *) 0,
+               (offsetT) alignment, (char *) 0);
+  *p = NOP_OPCODE;
+}
+
 addressT
 frag_now_fix_octets ()
 {
This page took 0.023984 seconds and 4 git commands to generate.