OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [bfd/] [coffgen.c] - Diff between revs 161 and 163

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 161 Rev 163
Line 981... Line 981...
 
 
/* Write out a symbol to a COFF file that does not come from a COFF
/* Write out a symbol to a COFF file that does not come from a COFF
   file originally.  This symbol may have been created by the linker,
   file originally.  This symbol may have been created by the linker,
   or we may be linking a non COFF file to a COFF file.  */
   or we may be linking a non COFF file to a COFF file.  */
 
 
static bfd_boolean
bfd_boolean
coff_write_alien_symbol (bfd *abfd,
coff_write_alien_symbol (bfd *abfd,
                         asymbol *symbol,
                         asymbol *symbol,
 
                         struct internal_syment *isym,
                         bfd_vma *written,
                         bfd_vma *written,
                         bfd_size_type *string_size_p,
                         bfd_size_type *string_size_p,
                         asection **debug_string_section_p,
                         asection **debug_string_section_p,
                         bfd_size_type *debug_string_size_p)
                         bfd_size_type *debug_string_size_p)
{
{
  combined_entry_type *native;
  combined_entry_type *native;
  combined_entry_type dummy;
  combined_entry_type dummy[2];
  asection *output_section = symbol->section->output_section
  asection *output_section = symbol->section->output_section
                               ? symbol->section->output_section
                               ? symbol->section->output_section
                               : symbol->section;
                               : symbol->section;
 
  struct bfd_link_info *link_info = coff_data (abfd)->link_info;
 
  bfd_boolean ret;
 
 
  native = &dummy;
  if ((!link_info || link_info->strip_discarded)
 
      && !bfd_is_abs_section (symbol->section)
 
      && symbol->section->output_section == bfd_abs_section_ptr)
 
    {
 
      symbol->name = "";
 
      if (isym != NULL)
 
        memset (isym, 0, sizeof(*isym));
 
      return TRUE;
 
    }
 
  native = dummy;
  native->u.syment.n_type = T_NULL;
  native->u.syment.n_type = T_NULL;
  native->u.syment.n_flags = 0;
  native->u.syment.n_flags = 0;
 
  native->u.syment.n_numaux = 0;
  if (bfd_is_und_section (symbol->section))
  if (bfd_is_und_section (symbol->section))
    {
    {
      native->u.syment.n_scnum = N_UNDEF;
      native->u.syment.n_scnum = N_UNDEF;
      native->u.syment.n_value = symbol->value;
      native->u.syment.n_value = symbol->value;
    }
    }
  else if (bfd_is_com_section (symbol->section))
  else if (bfd_is_com_section (symbol->section))
    {
    {
      native->u.syment.n_scnum = N_UNDEF;
      native->u.syment.n_scnum = N_UNDEF;
      native->u.syment.n_value = symbol->value;
      native->u.syment.n_value = symbol->value;
    }
    }
 
  else if (symbol->flags & BSF_FILE)
 
    {
 
      native->u.syment.n_scnum = N_DEBUG;
 
      native->u.syment.n_numaux = 1;
 
    }
  else if (symbol->flags & BSF_DEBUGGING)
  else if (symbol->flags & BSF_DEBUGGING)
    {
    {
      /* There isn't much point to writing out a debugging symbol
      /* There isn't much point to writing out a debugging symbol
         unless we are prepared to convert it into COFF debugging
         unless we are prepared to convert it into COFF debugging
         format.  So, we just ignore them.  We must clobber the symbol
         format.  So, we just ignore them.  We must clobber the symbol
         name to keep it from being put in the string table.  */
         name to keep it from being put in the string table.  */
      symbol->name = "";
      symbol->name = "";
 
      if (isym != NULL)
 
        memset (isym, 0, sizeof(*isym));
      return TRUE;
      return TRUE;
    }
    }
  else
  else
    {
    {
      native->u.syment.n_scnum = output_section->target_index;
      native->u.syment.n_scnum = output_section->target_index;
Line 1035... Line 1055...
          native->u.syment.n_flags = bfd_asymbol_bfd (&c->symbol)->flags;
          native->u.syment.n_flags = bfd_asymbol_bfd (&c->symbol)->flags;
      }
      }
    }
    }
 
 
  native->u.syment.n_type = 0;
  native->u.syment.n_type = 0;
  if (symbol->flags & BSF_LOCAL)
  if (symbol->flags & BSF_FILE)
 
    native->u.syment.n_sclass = C_FILE;
 
  else if (symbol->flags & BSF_LOCAL)
    native->u.syment.n_sclass = C_STAT;
    native->u.syment.n_sclass = C_STAT;
  else if (symbol->flags & BSF_WEAK)
  else if (symbol->flags & BSF_WEAK)
    native->u.syment.n_sclass = obj_pe (abfd) ? C_NT_WEAK : C_WEAKEXT;
    native->u.syment.n_sclass = obj_pe (abfd) ? C_NT_WEAK : C_WEAKEXT;
  else
  else
    native->u.syment.n_sclass = C_EXT;
    native->u.syment.n_sclass = C_EXT;
  native->u.syment.n_numaux = 0;
 
 
 
  return coff_write_symbol (abfd, symbol, native, written, string_size_p,
  ret = coff_write_symbol (abfd, symbol, native, written, string_size_p,
                            debug_string_section_p, debug_string_size_p);
                            debug_string_section_p, debug_string_size_p);
 
  if (isym != NULL)
 
    *isym = native->u.syment;
 
  return ret;
}
}
 
 
/* Write a native symbol to a COFF file.  */
/* Write a native symbol to a COFF file.  */
 
 
static bfd_boolean
static bfd_boolean
Line 1059... Line 1083...
                          asection **debug_string_section_p,
                          asection **debug_string_section_p,
                          bfd_size_type *debug_string_size_p)
                          bfd_size_type *debug_string_size_p)
{
{
  combined_entry_type *native = symbol->native;
  combined_entry_type *native = symbol->native;
  alent *lineno = symbol->lineno;
  alent *lineno = symbol->lineno;
 
  struct bfd_link_info *link_info = coff_data (abfd)->link_info;
 
 
 
  if ((!link_info || link_info->strip_discarded)
 
      && !bfd_is_abs_section (symbol->symbol.section)
 
      && symbol->symbol.section->output_section == bfd_abs_section_ptr)
 
    {
 
      symbol->symbol.name = "";
 
      return TRUE;
 
    }
 
 
  /* If this symbol has an associated line number, we must store the
  /* If this symbol has an associated line number, we must store the
     symbol index in the line number field.  We also tag the auxent to
     symbol index in the line number field.  We also tag the auxent to
     point to the right place in the lineno table.  */
     point to the right place in the lineno table.  */
  if (lineno && !symbol->done_lineno && symbol->symbol.section->owner != NULL)
  if (lineno && !symbol->done_lineno && symbol->symbol.section->owner != NULL)
Line 1151... Line 1184...
      coff_symbol_type *c_symbol = coff_symbol_from (abfd, symbol);
      coff_symbol_type *c_symbol = coff_symbol_from (abfd, symbol);
 
 
      if (c_symbol == (coff_symbol_type *) NULL
      if (c_symbol == (coff_symbol_type *) NULL
          || c_symbol->native == (combined_entry_type *) NULL)
          || c_symbol->native == (combined_entry_type *) NULL)
        {
        {
          if (!coff_write_alien_symbol (abfd, symbol, &written, &string_size,
          if (!coff_write_alien_symbol (abfd, symbol, NULL, &written,
                                        &debug_string_section,
                                        &string_size, &debug_string_section,
                                        &debug_string_size))
                                        &debug_string_size))
            return FALSE;
            return FALSE;
        }
        }
      else
      else
        {
        {
Line 2083... Line 2116...
/* Provided a BFD, a section and an offset (in bytes, not octets) into the
/* Provided a BFD, a section and an offset (in bytes, not octets) into the
   section, calculate and return the name of the source file and the line
   section, calculate and return the name of the source file and the line
   nearest to the wanted location.  */
   nearest to the wanted location.  */
 
 
bfd_boolean
bfd_boolean
coff_find_nearest_line (bfd *abfd,
coff_find_nearest_line_with_names (bfd *abfd,
 
                                   const struct dwarf_debug_section *debug_sections,
                        asection *section,
                        asection *section,
                        asymbol **symbols,
                        asymbol **symbols,
                        bfd_vma offset,
                        bfd_vma offset,
                        const char **filename_ptr,
                        const char **filename_ptr,
                        const char **functionname_ptr,
                        const char **functionname_ptr,
Line 2114... Line 2148...
 
 
  if (found)
  if (found)
    return TRUE;
    return TRUE;
 
 
  /* Also try examining DWARF2 debugging information.  */
  /* Also try examining DWARF2 debugging information.  */
  if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
  if (_bfd_dwarf2_find_nearest_line (abfd, debug_sections,
 
                                     section, symbols, offset,
                                     filename_ptr, functionname_ptr,
                                     filename_ptr, functionname_ptr,
                                     line_ptr, 0,
                                     line_ptr, 0,
                                     &coff_data(abfd)->dwarf2_find_line_info))
                                     &coff_data(abfd)->dwarf2_find_line_info))
    return TRUE;
    return TRUE;
 
 
Line 2297... Line 2332...
 
 
  return TRUE;
  return TRUE;
}
}
 
 
bfd_boolean
bfd_boolean
 
coff_find_nearest_line (bfd *abfd,
 
                        asection *section,
 
                        asymbol **symbols,
 
                        bfd_vma offset,
 
                        const char **filename_ptr,
 
                        const char **functionname_ptr,
 
                        unsigned int *line_ptr)
 
{
 
  return coff_find_nearest_line_with_names (abfd, dwarf_debug_sections,
 
                                            section, symbols, offset,
 
                                            filename_ptr, functionname_ptr,
 
                                            line_ptr);
 
}
 
 
 
bfd_boolean
coff_find_inliner_info (bfd *abfd,
coff_find_inliner_info (bfd *abfd,
                        const char **filename_ptr,
                        const char **filename_ptr,
                        const char **functionname_ptr,
                        const char **functionname_ptr,
                        unsigned int *line_ptr)
                        unsigned int *line_ptr)
{
{

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.