gas: sparc: fix collision of registers and pseudo-ops.
[deliverable/binutils-gdb.git] / bfd / syms.c
index a1d1d771907006c137b2398b37d19a5f8a105002..5a22c0b38b8b325ebe1a9eeae7f9318c2abc7c8c 100644 (file)
@@ -1,5 +1,5 @@
 /* Generic symbol-table support for the BFD library.
-   Copyright (C) 1990-2014 Free Software Foundation, Inc.
+   Copyright (C) 1990-2016 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -219,8 +219,7 @@ CODE_FRAGMENT
 .#define BSF_EXPORT    BSF_GLOBAL {* No real difference.  *}
 .
 .  {* A normal C symbol would be one of:
-.     <<BSF_LOCAL>>, <<BSF_COMMON>>,  <<BSF_UNDEFINED>> or
-.     <<BSF_GLOBAL>>.  *}
+.     <<BSF_LOCAL>>, <<BSF_UNDEFINED>> or <<BSF_GLOBAL>>.  *}
 .
 .  {* The symbol is a debugging record. The value has an arbitrary
 .     meaning, unless BSF_DEBUGGING_RELOC is also set.  *}
@@ -232,7 +231,9 @@ CODE_FRAGMENT
 .
 .  {* Used by the linker.  *}
 .#define BSF_KEEP              (1 << 5)
-.#define BSF_KEEP_G            (1 << 6)
+.
+.  {* An ELF common symbol.  *}
+.#define BSF_ELF_COMMON                (1 << 6)
 .
 .  {* A weak global symbol, overridable without warnings by
 .     a regular global symbol of the same name.  *}
@@ -823,6 +824,7 @@ _bfd_generic_read_minisymbols (bfd *abfd,
 
   *minisymsp = syms;
   *sizep = sizeof (asymbol *);
+
   return symcount;
 
  error_return:
@@ -1081,11 +1083,13 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
                  return FALSE;
                }
 
-             val = bfd_get_32 (abfd, info->stabs + r->address);
+             val = bfd_get_32 (abfd, info->stabs
+                               + r->address * bfd_octets_per_byte (abfd));
              val &= r->howto->src_mask;
              sym = *r->sym_ptr_ptr;
              val += sym->value + sym->section->vma + r->addend;
-             bfd_put_32 (abfd, (bfd_vma) val, info->stabs + r->address);
+             bfd_put_32 (abfd, (bfd_vma) val, info->stabs
+                         + r->address * bfd_octets_per_byte (abfd));
            }
        }
 
@@ -1191,6 +1195,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
                {
                  nul_fun = stab;
                  nul_str = str;
+                 if (file_name >= (char *) info->strs + strsize || file_name < (char *) str)
+                   file_name = NULL;
                  if (stab + STABSIZE + TYPEOFF < info->stabs + stabsize
                      && *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO)
                    {
@@ -1200,6 +1206,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
                      directory_name = file_name;
                      file_name = ((char *) str
                                   + bfd_get_32 (abfd, stab + STRDXOFF));
+                     if (file_name >= (char *) info->strs + strsize || file_name < (char *) str)
+                       file_name = NULL;
                    }
                }
              break;
@@ -1207,6 +1215,10 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
            case N_SOL:
              /* The name of an include file.  */
              file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
+             /* PR 17512: file: 0c680a1f.  */
+             /* PR 17512: file: 5da8aec4.  */
+             if (file_name >= (char *) info->strs + strsize || file_name < (char *) str)
+               file_name = NULL;
              break;
 
            case N_FUN:
@@ -1214,6 +1226,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
              function_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
              if (function_name == (char *) str)
                continue;
+             if (function_name >= (char *) info->strs + strsize)
+               function_name = NULL;
 
              nul_fun = NULL;
              info->indextable[i].val = bfd_get_32 (abfd, stab + VALOFF);
@@ -1321,6 +1335,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
          if (val <= offset)
            {
              file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
+             if (file_name >= (char *) info->strs + strsize || file_name < (char *) str)
+               file_name = NULL;
              *pline = 0;
            }
          break;
This page took 0.0243409999999999 seconds and 4 git commands to generate.