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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [ldlang.c] - Diff between revs 163 and 166

Show entire file | Details | Blame | View Log

Rev 163 Rev 166
Line 1... Line 1...
/* Linker command language support.
/* Linker command language support.
   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
   Free Software Foundation, Inc.
   Free Software Foundation, Inc.
 
 
   This file is part of the GNU Binutils.
   This file is part of the GNU Binutils.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
Line 1310... Line 1310...
    for (n = &r->name_list; n != NULL; n = n->next)
    for (n = &r->name_list; n != NULL; n = n->next)
      if (strcmp (n->name, name) == 0)
      if (strcmp (n->name, name) == 0)
        {
        {
          if (create)
          if (create)
            einfo (_("%P:%S: warning: redeclaration of memory region `%s'\n"),
            einfo (_("%P:%S: warning: redeclaration of memory region `%s'\n"),
                   name);
                   NULL, name);
          return r;
          return r;
        }
        }
 
 
  if (!create && strcmp (name, DEFAULT_MEMORY_REGION))
  if (!create && strcmp (name, DEFAULT_MEMORY_REGION))
    einfo (_("%P:%S: warning: memory region `%s' not declared\n"), name);
    einfo (_("%P:%S: warning: memory region `%s' not declared\n"),
 
           NULL, name);
 
 
  new_region = (lang_memory_region_type *)
  new_region = (lang_memory_region_type *)
      stat_alloc (sizeof (lang_memory_region_type));
      stat_alloc (sizeof (lang_memory_region_type));
 
 
  new_region->name_list.name = xstrdup (name);
  new_region->name_list.name = xstrdup (name);
Line 1349... Line 1350...
  /* The default region must be unique.  This ensures that it is not necessary
  /* The default region must be unique.  This ensures that it is not necessary
     to iterate through the name list if someone wants the check if a region is
     to iterate through the name list if someone wants the check if a region is
     the default memory region.  */
     the default memory region.  */
  if (strcmp (region_name, DEFAULT_MEMORY_REGION) == 0
  if (strcmp (region_name, DEFAULT_MEMORY_REGION) == 0
      || strcmp (alias, DEFAULT_MEMORY_REGION) == 0)
      || strcmp (alias, DEFAULT_MEMORY_REGION) == 0)
    einfo (_("%F%P:%S: error: alias for default memory region\n"));
    einfo (_("%F%P:%S: error: alias for default memory region\n"), NULL);
 
 
  /* Look for the target region and check if the alias is not already
  /* Look for the target region and check if the alias is not already
     in use.  */
     in use.  */
  region = NULL;
  region = NULL;
  for (r = lang_memory_region_list; r != NULL; r = r->next)
  for (r = lang_memory_region_list; r != NULL; r = r->next)
Line 1362... Line 1363...
        if (region == NULL && strcmp (n->name, region_name) == 0)
        if (region == NULL && strcmp (n->name, region_name) == 0)
          region = r;
          region = r;
        if (strcmp (n->name, alias) == 0)
        if (strcmp (n->name, alias) == 0)
          einfo (_("%F%P:%S: error: redefinition of memory region "
          einfo (_("%F%P:%S: error: redefinition of memory region "
                   "alias `%s'\n"),
                   "alias `%s'\n"),
                 alias);
                 NULL, alias);
      }
      }
 
 
  /* Check if the target region exists.  */
  /* Check if the target region exists.  */
  if (region == NULL)
  if (region == NULL)
    einfo (_("%F%P:%S: error: memory region `%s' "
    einfo (_("%F%P:%S: error: memory region `%s' "
             "for alias `%s' does not exist\n"),
             "for alias `%s' does not exist\n"),
           region_name,
           NULL, region_name, alias);
           alias);
 
 
 
  /* Add alias to region name list.  */
  /* Add alias to region name list.  */
  n = (lang_memory_region_name *) stat_alloc (sizeof (lang_memory_region_name));
  n = (lang_memory_region_name *) stat_alloc (sizeof (lang_memory_region_name));
  n->name = xstrdup (alias);
  n->name = xstrdup (alias);
  n->next = region->name_list.next;
  n->next = region->name_list.next;
Line 4594... Line 4594...
}
}
 
 
static void
static void
insert_pad (lang_statement_union_type **ptr,
insert_pad (lang_statement_union_type **ptr,
            fill_type *fill,
            fill_type *fill,
            unsigned int alignment_needed,
            bfd_size_type alignment_needed,
            asection *output_section,
            asection *output_section,
            bfd_vma dot)
            bfd_vma dot)
{
{
  static fill_type zero_fill = { 1, { 0 } };
  static fill_type zero_fill;
  lang_statement_union_type *pad = NULL;
  lang_statement_union_type *pad = NULL;
 
 
  if (ptr != &statement_list.head)
  if (ptr != &statement_list.head)
    pad = ((lang_statement_union_type *)
    pad = ((lang_statement_union_type *)
           ((char *) ptr - offsetof (lang_statement_union_type, header.next)));
           ((char *) ptr - offsetof (lang_statement_union_type, header.next)));
Line 4649... Line 4649...
  asection *i = is->section;
  asection *i = is->section;
 
 
  if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
  if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
      && (i->flags & SEC_EXCLUDE) == 0)
      && (i->flags & SEC_EXCLUDE) == 0)
    {
    {
      unsigned int alignment_needed;
      bfd_size_type alignment_needed;
      asection *o;
      asection *o;
 
 
      /* Align this section first to the input sections requirement,
      /* Align this section first to the input sections requirement,
         then to the output section's requirement.  If this alignment
         then to the output section's requirement.  If this alignment
         is greater than any seen before, then record it too.  Perform
         is greater than any seen before, then record it too.  Perform
Line 4889... Line 4889...
                      dot += expld.result.section->vma;
                      dot += expld.result.section->vma;
                  }
                  }
                else if (expld.phase != lang_mark_phase_enum)
                else if (expld.phase != lang_mark_phase_enum)
                  einfo (_("%F%S: non constant or forward reference"
                  einfo (_("%F%S: non constant or forward reference"
                           " address expression for section %s\n"),
                           " address expression for section %s\n"),
                         os->name);
                         os->addr_tree, os->name);
              }
              }
 
 
            if (os->bfd_section == NULL)
            if (os->bfd_section == NULL)
              /* This section was removed or never actually created.  */
              /* This section was removed or never actually created.  */
              break;
              break;
Line 6588... Line 6588...
      if (plugin_call_all_symbols_read ())
      if (plugin_call_all_symbols_read ())
        einfo (_("%P%F: %s: plugin reported error after all symbols read\n"),
        einfo (_("%P%F: %s: plugin reported error after all symbols read\n"),
               plugin_error_plugin ());
               plugin_error_plugin ());
      /* Open any newly added files, updating the file chains.  */
      /* Open any newly added files, updating the file chains.  */
      link_info.loading_lto_outputs = TRUE;
      link_info.loading_lto_outputs = TRUE;
      open_input_bfds (added.head, OPEN_BFD_NORMAL);
      open_input_bfds (*added.tail, OPEN_BFD_NORMAL);
      /* Restore the global list pointer now they have all been added.  */
      /* Restore the global list pointer now they have all been added.  */
      lang_list_remove_tail (stat_ptr, &added);
      lang_list_remove_tail (stat_ptr, &added);
      /* And detach the fresh ends of the file lists.  */
      /* And detach the fresh ends of the file lists.  */
      lang_list_remove_tail (&file_chain, &files);
      lang_list_remove_tail (&file_chain, &files);
      lang_list_remove_tail (&input_file_chain, &inputfiles);
      lang_list_remove_tail (&input_file_chain, &inputfiles);
Line 6648... Line 6648...
 
 
  /* Build all sets based on the information gathered from the input
  /* Build all sets based on the information gathered from the input
     files.  */
     files.  */
  ldctor_build_sets ();
  ldctor_build_sets ();
 
 
 
  /* PR 13683: We must rerun the assignments prior to running garbage
 
     collection in order to make sure that all symbol aliases are resolved.  */
 
  lang_do_assignments (lang_mark_phase_enum);
 
  expld.phase = lang_first_phase_enum;
 
 
  /* Remove unreferenced sections if asked to.  */
  /* Remove unreferenced sections if asked to.  */
  lang_gc_sections ();
  lang_gc_sections ();
 
 
  /* Size up the common data.  */
  /* Size up the common data.  */
  lang_common ();
  lang_common ();
Line 6946... Line 6951...
    *region = *lma_region;
    *region = *lma_region;
  else
  else
    *region = lang_memory_region_lookup (memspec, FALSE);
    *region = lang_memory_region_lookup (memspec, FALSE);
 
 
  if (have_lma && lma_memspec != 0)
  if (have_lma && lma_memspec != 0)
    einfo (_("%X%P:%S: section has both a load address and a load region\n"));
    einfo (_("%X%P:%S: section has both a load address and a load region\n"),
 
           NULL);
}
}
 
 
void
void
lang_leave_output_section_statement (fill_type *fill, const char *memspec,
lang_leave_output_section_statement (fill_type *fill, const char *memspec,
                                     lang_output_section_phdr_list *phdrs,
                                     lang_output_section_phdr_list *phdrs,
Line 7133... Line 7139...
  for (pp = &lang_phdr_list; *pp != NULL; pp = &(*pp)->next)
  for (pp = &lang_phdr_list; *pp != NULL; pp = &(*pp)->next)
    if (hdrs
    if (hdrs
        && (*pp)->type == 1
        && (*pp)->type == 1
        && !((*pp)->filehdr || (*pp)->phdrs))
        && !((*pp)->filehdr || (*pp)->phdrs))
      {
      {
        einfo (_("%X%P:%S: PHDRS and FILEHDR are not supported when prior PT_LOAD headers lack them\n"));
        einfo (_("%X%P:%S: PHDRS and FILEHDR are not supported"
 
                 " when prior PT_LOAD headers lack them\n"), NULL);
        hdrs = FALSE;
        hdrs = FALSE;
      }
      }
 
 
  *pp = n;
  *pp = n;
}
}

powered by: WebSVN 2.1.0

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