opcodes/
[deliverable/binutils-gdb.git] / gas / literal.c
index f622d310c96317d6a2d0b9a4b7c06c380822a787..6cbbe7e54ac2d3594ffbff8094f1bf6663d83a1c 100644 (file)
@@ -1,12 +1,12 @@
-/* as.c - GAS literal pool management.
-   Copyright (C) 1994 Free Software Foundation, Inc.
+/* literal.c - GAS literal pool management.
+   Copyright 1994, 2000, 2005, 2007 Free Software Foundation, Inc.
    Written by Ken Raeburn (raeburn@cygnus.com).
 
    This file is part of GAS, the GNU Assembler.
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    Written by Ken Raeburn (raeburn@cygnus.com).
 
    This file is part of GAS, the GNU Assembler.
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    GAS is distributed in the hope that it will be useful,
    any later version.
 
    GAS is distributed in the hope that it will be useful,
@@ -16,7 +16,8 @@
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to
 
    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, 51 Franklin Street - Fifth Floor,
+   Boston, MA 02110-1301, 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
 
 /* This isn't quite a "constant" pool.  Some of the values may get
    adjusted at run time, e.g., for symbolic relocations when shared
@@ -39,7 +40,7 @@
 #include "as.h"
 #include "subsegs.h"
 
 #include "as.h"
 #include "subsegs.h"
 
-#if defined (BFD_ASSEMBLER) && defined (NEED_LITERAL_POOL)
+#ifdef NEED_LITERAL_POOL
 
 valueT
 add_to_literal_pool (sym, addend, sec, size)
 
 valueT
 add_to_literal_pool (sym, addend, sec, size)
@@ -59,11 +60,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.  */
   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);
 
   subseg_set (sec, 0);
   p = frag_more (size);
@@ -84,10 +89,8 @@ add_to_literal_pool (sym, addend, sec, size)
           reloc_type);
 
   subseg_set (current_section, current_subsec);
           reloc_type);
 
   subseg_set (current_section, current_subsec);
-
   offset = seginfo->literal_pool_size;
   seginfo->literal_pool_size += size;
   offset = seginfo->literal_pool_size;
   seginfo->literal_pool_size += size;
-
   return offset;
 }
   return offset;
 }
-#endif /* BFD_ASSEMBLER */
+#endif
This page took 0.02424 seconds and 4 git commands to generate.