* expr.c (make_expr_symbol): Fold FAKE_LABEL_NAME use into the
[deliverable/binutils-gdb.git] / gas / literal.c
index d39aa8b96b061f59727de40994f20ffe3760a893..7315f3eee035f64107f71c76b5225c0cc07d0035 100644 (file)
@@ -1,5 +1,5 @@
 /* as.c - GAS literal pool management.
-   Copyright (C) 1994 Free Software Foundation, Inc.
+   Copyright 1994, 2000 Free Software Foundation, Inc.
    Written by Ken Raeburn (raeburn@cygnus.com).
 
    This file is part of GAS, the GNU Assembler.
@@ -16,7 +16,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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* This isn't quite a "constant" pool.  Some of the values may get
    adjusted at run time, e.g., for symbolic relocations when shared
    ever a .lit4?)  On the MIPS, it could be used for .lit4 as well.
 
    The expressions passed here should contain either constants or symbols,
-   *not* a combination of both.  Typically, the constant pool is accessed
+   not a combination of both.  Typically, the constant pool is accessed
    with some sort of GP register, so the size of the pool must be kept down
    if possible.  The exception is section offsets -- if you're storing a
    pointer to the start of .data, for example, and your machine provides
    for 16-bit signed addends, you might want to store .data+32K, so that
-   you can access all of the first 64K of .data with the one pointer...  */
+   you can access all of the first 64K of .data with the one pointer.
+
+   This isn't a requirement, just a guideline that can help keep .o file
+   size down.  */
 
 #include "as.h"
 #include "subsegs.h"
@@ -56,11 +59,15 @@ add_to_literal_pool (sym, addend, sec, size)
   offset = 0;
   /* @@ This assumes all entries in a given section will be of the same
      size...  Probably correct, but unwise to rely on.  */
-  for (fixp = seginfo->fix_root; fixp; fixp = fixp->fx_next, offset += size)
-    {
-      if (fixp->fx_addsy == sym && fixp->fx_offset == addend)
-       return offset;
-    }
+  /* This must always be called with the same subsegment.  */
+  if (seginfo->frchainP)
+    for (fixp = seginfo->frchainP->fix_root;
+        fixp != (fixS *) NULL;
+        fixp = fixp->fx_next, offset += size)
+      {
+       if (fixp->fx_addsy == sym && fixp->fx_offset == addend)
+         return offset;
+      }
 
   subseg_set (sec, 0);
   p = frag_more (size);
@@ -81,10 +88,8 @@ add_to_literal_pool (sym, addend, sec, size)
           reloc_type);
 
   subseg_set (current_section, current_subsec);
-
   offset = seginfo->literal_pool_size;
   seginfo->literal_pool_size += size;
-
   return offset;
 }
 #endif /* BFD_ASSEMBLER */
This page took 0.031417 seconds and 4 git commands to generate.