daily update
[deliverable/binutils-gdb.git] / ld / emultempl / xtensaelf.em
index bc91365037f8c371cb314496a18a02edb01178f6..87629200f657e1e3ad3982ed853dfb0beecd4f45 100644 (file)
@@ -26,22 +26,8 @@ cat >>e${EMULATION_NAME}.c <<EOF
 
 #include <xtensa-config.h>
 
-static char *elf_xtensa_choose_target
-  PARAMS ((int, char **));
-static bfd_boolean elf_xtensa_place_orphan
-  PARAMS ((lang_input_statement_type *, asection *));
-static void elf_xtensa_before_parse
-  PARAMS ((void));
-static void elf_xtensa_before_allocation
-  PARAMS ((void));
-static void xtensa_wild_group_interleave
-  PARAMS ((lang_statement_union_type *));
-static void xtensa_wild_group_interleave_callback
-  PARAMS ((lang_statement_union_type *));
-static void xtensa_colocate_output_literals
-  PARAMS ((lang_statement_union_type *));
-static void xtensa_colocate_output_literals_callback
-  PARAMS ((lang_statement_union_type *));
+static void xtensa_wild_group_interleave (lang_statement_union_type *);
+static void xtensa_colocate_output_literals (lang_statement_union_type *);
 
 
 /* Flag for the emulation-specific "--no-relax" option.  */
@@ -58,9 +44,8 @@ static bfd_boolean xtensa_use_literal_pages = FALSE;
 
 
 static char *
-elf_xtensa_choose_target (argc, argv)
-     int argc ATTRIBUTE_UNUSED;
-     char **argv ATTRIBUTE_UNUSED;
+elf_xtensa_choose_target (int argc ATTRIBUTE_UNUSED,
+                         char **argv ATTRIBUTE_UNUSED)
 {
   if (XCHAL_HAVE_BE)
     return "${BIG_OUTPUT_FORMAT}";
@@ -70,9 +55,7 @@ elf_xtensa_choose_target (argc, argv)
 
 
 static bfd_boolean
-elf_xtensa_place_orphan (file, s)
-     lang_input_statement_type *file;
-     asection *s;
+elf_xtensa_place_orphan (lang_input_statement_type *file, asection *s)
 {
   /* Early exit for relocatable links.  */
   if (link_info.relocatable)
@@ -83,7 +66,7 @@ elf_xtensa_place_orphan (file, s)
 
 
 static void
-elf_xtensa_before_parse ()
+elf_xtensa_before_parse (void)
 {
   /* Just call the default hook.... Tensilica's version of this function
      does some other work that isn't relevant here.  */
@@ -94,8 +77,8 @@ elf_xtensa_before_parse ()
 /* This is called after the sections have been attached to output
    sections, but before any sizes or addresses have been set.  */
 
-void
-elf_xtensa_before_allocation ()
+static void
+elf_xtensa_before_allocation (void)
 {
   bfd *in_bfd;
   bfd_boolean is_big_endian = XCHAL_HAVE_BE;
@@ -143,7 +126,7 @@ elf_xtensa_before_allocation ()
   gld${EMULATION_NAME}_before_allocation ();
 
   xtensa_wild_group_interleave (stat_ptr->head);
-  if (command_line.relax) 
+  if (command_line.relax)
     xtensa_colocate_output_literals (stat_ptr->head);
 
   /* TBD: We need to force the page alignments to here and only do
@@ -184,64 +167,29 @@ struct reloc_deps_graph_t
 };
 
 static void xtensa_layout_wild
-  PARAMS ((const reloc_deps_graph *, lang_wild_statement_type *));
+  (const reloc_deps_graph *, lang_wild_statement_type *);
 
-typedef void (*deps_callback_t)
-  PARAMS ((asection *, /* src_sec */
-          bfd_vma,    /* src_offset */
-          asection *, /* target_sec */
-          bfd_vma,    /* target_offset */
-          PTR));      /* closure */
+typedef void (*deps_callback_t) (asection *, /* src_sec */
+                                bfd_vma,    /* src_offset */
+                                asection *, /* target_sec */
+                                bfd_vma,    /* target_offset */
+                                void *);    /* closure */
 
-static void build_deps_graph_callback
-  PARAMS ((asection *, bfd_vma, asection *, bfd_vma, PTR));
 extern bfd_boolean xtensa_callback_required_dependence
-  PARAMS ((bfd *, asection *, struct bfd_link_info *,
-          deps_callback_t, PTR));
+  (bfd *, asection *, struct bfd_link_info *, deps_callback_t, void *);
 static void xtensa_ldlang_clear_addresses
-  PARAMS ((lang_statement_union_type *));
+  (lang_statement_union_type *);
 static bfd_boolean ld_local_file_relocations_fit
-  PARAMS ((lang_statement_union_type *, const reloc_deps_graph *));
+  (lang_statement_union_type *, const reloc_deps_graph *);
 static bfd_vma ld_assign_relative_paged_dot
-  PARAMS ((bfd_vma, lang_statement_union_type *,
-          const reloc_deps_graph *, bfd_boolean)); 
+  (bfd_vma, lang_statement_union_type *, const reloc_deps_graph *,
+   bfd_boolean);
 static bfd_vma ld_xtensa_insert_page_offsets
-  PARAMS ((bfd_vma, lang_statement_union_type *, reloc_deps_graph *,
-          bfd_boolean));
-static void lang_for_each_statement_worker
-  PARAMS ((void (*) (lang_statement_union_type *),
-          lang_statement_union_type *));
-static void xtensa_move_dependencies_to_front
-  PARAMS ((reloc_deps_graph *, lang_wild_statement_type *));
-static reloc_deps_graph *ld_build_required_section_dependence
-  PARAMS ((lang_statement_union_type *));
-static bfd_boolean section_is_source
-  PARAMS ((const reloc_deps_graph *, lang_statement_union_type *));
-static bfd_boolean section_is_target
-  PARAMS ((const reloc_deps_graph *, lang_statement_union_type *));
-static bfd_boolean section_is_source_or_target
-  PARAMS ((const reloc_deps_graph *, lang_statement_union_type *));
-static bfd_boolean deps_has_sec_edge
-  PARAMS ((const reloc_deps_graph *, asection *, asection *));
-static bfd_boolean deps_has_edge
-  PARAMS ((const reloc_deps_graph *, lang_statement_union_type *,
-          lang_statement_union_type *));
-static void add_deps_edge
-  PARAMS ((reloc_deps_graph *, asection *, asection *));
+  (bfd_vma, lang_statement_union_type *, reloc_deps_graph *, bfd_boolean);
 #if EXTRA_VALIDATION
 static size_t ld_count_children
-  PARAMS ((lang_statement_union_type *));
+  (lang_statement_union_type *);
 #endif
-static void free_reloc_deps_graph
-  PARAMS ((reloc_deps_graph *));
-static void xtensa_colocate_literals
-  PARAMS ((reloc_deps_graph *, lang_statement_union_type *));
-static reloc_deps_section *xtensa_get_section_deps
-  PARAMS ((const reloc_deps_graph *, asection *));
-static void xtensa_set_section_deps
-  PARAMS ((const reloc_deps_graph *, asection *, reloc_deps_section *));
-static void xtensa_append_section_deps
-  PARAMS ((reloc_deps_graph *, asection *));
 
 extern lang_statement_list_type constructor_list;
 
@@ -250,99 +198,94 @@ extern lang_statement_list_type constructor_list;
     there statically.  */
 
 static void
-lang_for_each_statement_worker (func, s)
-     void (*func) PARAMS ((lang_statement_union_type *));
-     lang_statement_union_type *s;
+lang_for_each_statement_worker (void (*func) (lang_statement_union_type *),
+                               lang_statement_union_type *s)
 {
   for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
     {
       func (s);
 
       switch (s->header.type)
-        {
-        case lang_constructors_statement_enum:
-          lang_for_each_statement_worker (func, constructor_list.head);
-          break;
-        case lang_output_section_statement_enum:
-          lang_for_each_statement_worker
-            (func,
-             s->output_section_statement.children.head);
-          break;
-        case lang_wild_statement_enum:
-          lang_for_each_statement_worker
-            (func,
-             s->wild_statement.children.head);
-          break;
-        case lang_group_statement_enum:
-          lang_for_each_statement_worker (func,
-                                          s->group_statement.children.head);
-          break;
-        case lang_data_statement_enum:
-        case lang_reloc_statement_enum:
-        case lang_object_symbols_statement_enum:
-        case lang_output_statement_enum:
-        case lang_target_statement_enum:
-        case lang_input_section_enum:
-        case lang_input_statement_enum:
-        case lang_assignment_statement_enum:
-        case lang_padding_statement_enum:
-        case lang_address_statement_enum:
-        case lang_fill_statement_enum:
-          break;
-        default:
-          FAIL ();
-          break;
-        }
+       {
+       case lang_constructors_statement_enum:
+         lang_for_each_statement_worker (func, constructor_list.head);
+         break;
+       case lang_output_section_statement_enum:
+         lang_for_each_statement_worker
+           (func,
+            s->output_section_statement.children.head);
+         break;
+       case lang_wild_statement_enum:
+         lang_for_each_statement_worker
+           (func,
+            s->wild_statement.children.head);
+         break;
+       case lang_group_statement_enum:
+         lang_for_each_statement_worker (func,
+                                         s->group_statement.children.head);
+         break;
+       case lang_data_statement_enum:
+       case lang_reloc_statement_enum:
+       case lang_object_symbols_statement_enum:
+       case lang_output_statement_enum:
+       case lang_target_statement_enum:
+       case lang_input_section_enum:
+       case lang_input_statement_enum:
+       case lang_assignment_statement_enum:
+       case lang_padding_statement_enum:
+       case lang_address_statement_enum:
+       case lang_fill_statement_enum:
+         break;
+       default:
+         FAIL ();
+         break;
+       }
     }
 }
 
 /* End of verbatim code from ldlang.c.  */
 
 
-reloc_deps_section *
-xtensa_get_section_deps (deps, sec)
-     const reloc_deps_graph *deps ATTRIBUTE_UNUSED;
-     asection *sec;
+static reloc_deps_section *
+xtensa_get_section_deps (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
+                        asection *sec)
 {
   /* We have a separate function for this so that
      we could in the future keep a completely independent
      structure that maps a section to its dependence edges.
      For now, we place these in the sec->userdata field.  */
-  reloc_deps_section *sec_deps = (reloc_deps_section *) sec->userdata;
+  reloc_deps_section *sec_deps = sec->userdata;
   return sec_deps;
 }
 
-void
-xtensa_set_section_deps (deps, sec, deps_section)
-     const reloc_deps_graph *deps ATTRIBUTE_UNUSED;
-     asection *sec;
-     reloc_deps_section *deps_section;
+static void
+xtensa_set_section_deps (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
+                        asection *sec,
+                        reloc_deps_section *deps_section)
 {
-  sec->userdata = (void *) deps_section;
+  sec->userdata = deps_section;
 }
 
 
 /* This is used to keep a list of all of the sections participating in
    the graph so we can clean them up quickly.  */
 
-static void 
-xtensa_append_section_deps (deps, sec)
-     reloc_deps_graph *deps;
-     asection *sec;
+static void
+xtensa_append_section_deps (reloc_deps_graph *deps, asection *sec)
 {
   if (deps->size <= deps->count)
     {
       asection **new_sections;
       size_t i;
       size_t new_size;
-      
+
       new_size = deps->size * 2;
       if (new_size == 0)
        new_size = 20;
-      
-      new_sections = (asection**) xmalloc (sizeof (asection*) * new_size);
-      memset (new_sections, 0, sizeof (asection*) * new_size);
-      for (i = 0; i < deps->count; i++) 
+
+      new_sections = xmalloc (sizeof (asection *) * new_size);
+      memset (new_sections, 0, sizeof (asection *) * new_size);
+      for (i = 0; i < deps->count; i++)
        {
          new_sections[i] = deps->sections[i];
        }
@@ -356,9 +299,8 @@ xtensa_append_section_deps (deps, sec)
 }
 
 
-static void 
-free_reloc_deps_graph (deps)
-     reloc_deps_graph *deps;
+static void
+free_reloc_deps_graph (reloc_deps_graph *deps)
 {
   size_t i;
   for (i = 0; i < deps->count; i++)
@@ -366,7 +308,7 @@ free_reloc_deps_graph (deps)
       asection *sec = deps->sections[i];
       reloc_deps_section *sec_deps;
       sec_deps = xtensa_get_section_deps (deps, sec);
-      if (sec_deps) 
+      if (sec_deps)
        {
          reloc_deps_e *next;
          while (sec_deps->succs != NULL)
@@ -375,7 +317,7 @@ free_reloc_deps_graph (deps)
              free (sec_deps->succs);
              sec_deps->succs = next;
            }
-         
+
          while (sec_deps->preds != NULL)
            {
              next = sec_deps->preds->next;
@@ -393,10 +335,9 @@ free_reloc_deps_graph (deps)
 }
 
 
-bfd_boolean
-section_is_source (deps, s)
-     const reloc_deps_graph *deps ATTRIBUTE_UNUSED;
-     lang_statement_union_type *s;
+static bfd_boolean
+section_is_source (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
+                  lang_statement_union_type *s)
 {
   asection *sec;
   const reloc_deps_section *sec_deps;
@@ -406,14 +347,13 @@ section_is_source (deps, s)
   sec = s->input_section.section;
 
   sec_deps = xtensa_get_section_deps (deps, sec);
-  return (sec_deps && sec_deps->succs != NULL);
+  return sec_deps && sec_deps->succs != NULL;
 }
 
 
-bfd_boolean
-section_is_target (deps, s)
-     const reloc_deps_graph *deps ATTRIBUTE_UNUSED;
-     lang_statement_union_type *s;
+static bfd_boolean
+section_is_target (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
+                  lang_statement_union_type *s)
 {
   asection *sec;
   const reloc_deps_section *sec_deps;
@@ -423,13 +363,12 @@ section_is_target (deps, s)
   sec = s->input_section.section;
 
   sec_deps = xtensa_get_section_deps (deps, sec);
-  return (sec_deps && sec_deps->preds != NULL);
+  return sec_deps && sec_deps->preds != NULL;
 }
 
-bfd_boolean
-section_is_source_or_target (deps, s)
-     const reloc_deps_graph *deps ATTRIBUTE_UNUSED;
-     lang_statement_union_type *s;
+static bfd_boolean
+section_is_source_or_target (const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
+                            lang_statement_union_type *s)
 {
   return (section_is_source (deps, s)
          || section_is_target (deps, s));
@@ -449,19 +388,14 @@ struct xtensa_ld_iter_t
 struct xtensa_ld_iter_stack_t
 {
   xtensa_ld_iter iterloc;              /* List that hold it.  */
-  
+
   xtensa_ld_iter_stack *next;          /* Next in the stack.  */
   xtensa_ld_iter_stack *prev;          /* Back pointer for stack.  */
 };
 
-static void ld_xtensa_move_section_after
-  PARAMS ((xtensa_ld_iter *, xtensa_ld_iter *));
-
 
-void 
-ld_xtensa_move_section_after (to, current)
-     xtensa_ld_iter *to;
-     xtensa_ld_iter *current;
+static void
+ld_xtensa_move_section_after (xtensa_ld_iter *to, xtensa_ld_iter *current)
 {
   lang_statement_union_type *to_next;
   lang_statement_union_type *current_next;
@@ -474,7 +408,7 @@ ld_xtensa_move_section_after (to, current)
 
   if (to == current)
     return;
-  
+
 #if EXTRA_VALIDATION
   old_to_count = ld_count_children (to->parent);
   old_current_count = ld_count_children (current->parent);
@@ -482,9 +416,9 @@ ld_xtensa_move_section_after (to, current)
 
   to_next = *(to->loc);
   current_next = (*current->loc)->header.next;
-  
+
   *(to->loc) = *(current->loc);
-  
+
   *(current->loc) = current_next;
   (*(to->loc))->header.next = to_next;
 
@@ -502,7 +436,7 @@ ld_xtensa_move_section_after (to, current)
   new_to_count = ld_count_children (to->parent);
   new_current_count = ld_count_children (current->parent);
 
-  ASSERT ((old_to_count + old_current_count) 
+  ASSERT ((old_to_count + old_current_count)
          == (new_to_count + new_current_count));
 #endif
 }
@@ -511,41 +445,21 @@ ld_xtensa_move_section_after (to, current)
 /* Can only be called with lang_statements that have lists.  Returns
    false if the list is empty.  */
 
-static bfd_boolean iter_stack_empty
-  PARAMS ((xtensa_ld_iter_stack **));
-static bfd_boolean iter_stack_push
-  PARAMS ((xtensa_ld_iter_stack **, lang_statement_union_type *));
-static void iter_stack_pop
-  PARAMS ((xtensa_ld_iter_stack **));
-static void iter_stack_update
-  PARAMS ((xtensa_ld_iter_stack **));
-static void iter_stack_next
-  PARAMS ((xtensa_ld_iter_stack **));
-static lang_statement_union_type *iter_stack_current
-  PARAMS ((xtensa_ld_iter_stack **));
-static void iter_stack_create
-  PARAMS ((xtensa_ld_iter_stack **, lang_statement_union_type *));
-static void iter_stack_copy_current
-  PARAMS ((xtensa_ld_iter_stack **, xtensa_ld_iter *));
-
-
-static bfd_boolean 
-iter_stack_empty (stack_p)
-     xtensa_ld_iter_stack **stack_p;
+static bfd_boolean
+iter_stack_empty (xtensa_ld_iter_stack **stack_p)
 {
-  return (*stack_p == NULL);
+  return *stack_p == NULL;
 }
 
 
 static bfd_boolean
-iter_stack_push (stack_p, parent)
-     xtensa_ld_iter_stack **stack_p;
-     lang_statement_union_type *parent;
+iter_stack_push (xtensa_ld_iter_stack **stack_p,
+                lang_statement_union_type *parent)
 {
   xtensa_ld_iter_stack *stack;
   lang_statement_list_type *l = NULL;
 
-  switch (parent->header.type) 
+  switch (parent->header.type)
     {
     case lang_output_section_statement_enum:
       l = &parent->output_section_statement.children;
@@ -562,10 +476,10 @@ iter_stack_push (stack_p, parent)
     }
 
   /* Empty. do not push.  */
-  if (l->tail == &l->head) 
+  if (l->tail == &l->head)
     return FALSE;
 
-  stack = (xtensa_ld_iter_stack *) xmalloc (sizeof (xtensa_ld_iter_stack));
+  stack = xmalloc (sizeof (xtensa_ld_iter_stack));
   memset (stack, 0, sizeof (xtensa_ld_iter_stack));
   stack->iterloc.parent = parent;
   stack->iterloc.l = l;
@@ -573,28 +487,27 @@ iter_stack_push (stack_p, parent)
 
   stack->next = *stack_p;
   stack->prev = NULL;
-  if (*stack_p != NULL) 
+  if (*stack_p != NULL)
     (*stack_p)->prev = stack;
   *stack_p = stack;
   return TRUE;
 }
 
 
-static void 
-iter_stack_pop (stack_p)
-     xtensa_ld_iter_stack **stack_p;
+static void
+iter_stack_pop (xtensa_ld_iter_stack **stack_p)
 {
   xtensa_ld_iter_stack *stack;
 
   stack = *stack_p;
 
-  if (stack == NULL) 
+  if (stack == NULL)
     {
       ASSERT (stack != NULL);
       return;
     }
 
-  if (stack->next != NULL) 
+  if (stack->next != NULL)
     stack->next->prev = NULL;
 
   *stack_p = stack->next;
@@ -607,11 +520,10 @@ iter_stack_pop (stack_p)
    accordingly.  */
 
 static void
-iter_stack_update (stack_p)
-     xtensa_ld_iter_stack **stack_p;
+iter_stack_update (xtensa_ld_iter_stack **stack_p)
 {
   if (!iter_stack_empty (stack_p)
-      && (*(*stack_p)->iterloc.loc) == NULL) 
+      && (*(*stack_p)->iterloc.loc) == NULL)
     {
       iter_stack_pop (stack_p);
 
@@ -626,9 +538,8 @@ iter_stack_update (stack_p)
 }
 
 
-static void 
-iter_stack_next (stack_p)
-     xtensa_ld_iter_stack **stack_p;
+static void
+iter_stack_next (xtensa_ld_iter_stack **stack_p)
 {
   xtensa_ld_iter_stack *stack;
   lang_statement_union_type *current;
@@ -636,9 +547,9 @@ iter_stack_next (stack_p)
 
   current = *stack->iterloc.loc;
   /* If we are on the first element.  */
-  if (current != NULL) 
+  if (current != NULL)
     {
-      switch (current->header.type) 
+      switch (current->header.type)
        {
        case lang_output_section_statement_enum:
        case lang_wild_statement_enum:
@@ -664,8 +575,7 @@ iter_stack_next (stack_p)
 
 
 static lang_statement_union_type *
-iter_stack_current (stack_p)
-     xtensa_ld_iter_stack **stack_p;
+iter_stack_current (xtensa_ld_iter_stack **stack_p)
 {
   return *((*stack_p)->iterloc.loc);
 }
@@ -673,28 +583,25 @@ iter_stack_current (stack_p)
 
 /* The iter stack is a preorder.  */
 
-static void 
-iter_stack_create (stack_p, parent)
-     xtensa_ld_iter_stack **stack_p;
-     lang_statement_union_type *parent;
+static void
+iter_stack_create (xtensa_ld_iter_stack **stack_p,
+                  lang_statement_union_type *parent)
 {
   iter_stack_push (stack_p, parent);
 }
 
 
-static void 
-iter_stack_copy_current (stack_p, front)
-     xtensa_ld_iter_stack **stack_p;
-     xtensa_ld_iter *front;
+static void
+iter_stack_copy_current (xtensa_ld_iter_stack **stack_p,
+                        xtensa_ld_iter *front)
 {
   *front = (*stack_p)->iterloc;
 }
 
 
-void
-xtensa_colocate_literals (deps, statement)
-     reloc_deps_graph *deps;
-     lang_statement_union_type *statement;
+static void
+xtensa_colocate_literals (reloc_deps_graph *deps,
+                         lang_statement_union_type *statement)
 {
   /* Keep a stack of pointers to control iteration through the contours.  */
   xtensa_ld_iter_stack *stack = NULL;
@@ -719,15 +626,15 @@ xtensa_colocate_literals (deps, statement)
 
   lang_for_each_statement_worker (xtensa_ldlang_clear_addresses, statement);
 #endif
-                                            
+
   iter_stack_create (stack_p, statement);
 
-  while (!iter_stack_empty (stack_p)) 
+  while (!iter_stack_empty (stack_p))
     {
       bfd_boolean skip_increment = FALSE;
       lang_statement_union_type *l = iter_stack_current (stack_p);
-    
-      switch (l->header.type) 
+
+      switch (l->header.type)
        {
        case lang_assignment_statement_enum:
          /* Any assignment statement should block reordering across it.  */
@@ -740,12 +647,12 @@ xtensa_colocate_literals (deps, statement)
            {
              in_literals = (section_is_target (deps, l)
                             && !section_is_source (deps, l));
-             if (in_literals) 
+             if (in_literals)
                {
                  front_p = &front;
                  iter_stack_copy_current (stack_p, front_p);
                }
-           } 
+           }
          else
            {
              bfd_boolean is_target;
@@ -762,15 +669,15 @@ xtensa_colocate_literals (deps, statement)
                }
              else
                {
-                 if (is_target) 
+                 if (is_target)
                    {
                      /* Try to insert in place.  */
                      ld_xtensa_move_section_after (front_p, current_p);
-                     ld_assign_relative_paged_dot (0x100000, 
+                     ld_assign_relative_paged_dot (0x100000,
                                                    statement,
                                                    deps,
                                                    xtensa_use_literal_pages);
-         
+
                      /* We use this code because it's already written.  */
                      if (!ld_local_file_relocations_fit (statement, deps))
                        {
@@ -779,7 +686,7 @@ xtensa_colocate_literals (deps, statement)
                          /* Reset the literal placement.  */
                          iter_stack_copy_current (stack_p, front_p);
                        }
-                     else 
+                     else
                        {
                          /* Move front pointer up by one.  */
                          front_p->loc = &(*front_p->loc)->header.next;
@@ -801,15 +708,14 @@ xtensa_colocate_literals (deps, statement)
        /* Be careful to update the stack_p if it now is a null.  */
        iter_stack_update (stack_p);
     }
-  
+
   lang_for_each_statement_worker (xtensa_ldlang_clear_addresses, statement);
 }
 
 
-void
-xtensa_move_dependencies_to_front (deps, w)
-     reloc_deps_graph *deps;
-     lang_wild_statement_type *w;
+static void
+xtensa_move_dependencies_to_front (reloc_deps_graph *deps,
+                                  lang_wild_statement_type *w)
 {
   /* Keep a front pointer and a current pointer.  */
   lang_statement_union_type **front;
@@ -825,7 +731,7 @@ xtensa_move_dependencies_to_front (deps, w)
     return;
 
   current = &(*front)->header.next;
-  while (*current != NULL) 
+  while (*current != NULL)
     {
       if (section_is_source_or_target (deps, *current))
        {
@@ -853,10 +759,9 @@ xtensa_move_dependencies_to_front (deps, w)
 
 
 static bfd_boolean
-deps_has_sec_edge (deps, src, tgt)
-     const reloc_deps_graph *deps;
-     asection *src;
-     asection *tgt;
+deps_has_sec_edge (const reloc_deps_graph *deps,
+                  asection *src,
+                  asection *tgt)
 {
   const reloc_deps_section *sec_deps;
   const reloc_deps_e *sec_deps_e;
@@ -864,13 +769,13 @@ deps_has_sec_edge (deps, src, tgt)
   sec_deps = xtensa_get_section_deps (deps, src);
   if (sec_deps == NULL)
     return FALSE;
-  
+
   for (sec_deps_e = sec_deps->succs;
-       sec_deps_e != NULL; 
+       sec_deps_e != NULL;
        sec_deps_e = sec_deps_e->next)
     {
       ASSERT (sec_deps_e->src == src);
-      if (sec_deps_e->tgt == tgt) 
+      if (sec_deps_e->tgt == tgt)
        return TRUE;
     }
   return FALSE;
@@ -878,10 +783,9 @@ deps_has_sec_edge (deps, src, tgt)
 
 
 static bfd_boolean
-deps_has_edge (deps, src, tgt)
-     const reloc_deps_graph *deps;
-     lang_statement_union_type *src;
-     lang_statement_union_type *tgt;
+deps_has_edge (const reloc_deps_graph *deps,
+              lang_statement_union_type *src,
+              lang_statement_union_type *tgt)
 {
   if (!section_is_source (deps, src))
     return FALSE;
@@ -892,17 +796,16 @@ deps_has_edge (deps, src, tgt)
     return FALSE;
   if (tgt->header.type != lang_input_section_enum)
     return FALSE;
-  
+
   return deps_has_sec_edge (deps, src->input_section.section,
                            tgt->input_section.section);
 }
 
 
 static void
-add_deps_edge (deps, src_sec, tgt_sec)
-     reloc_deps_graph *deps;
-     asection *src_sec;
-     asection *tgt_sec;
+add_deps_edge (reloc_deps_graph *deps,
+              asection *src_sec,
+              asection *tgt_sec)
 {
   reloc_deps_section *src_sec_deps;
   reloc_deps_section *tgt_sec_deps;
@@ -912,13 +815,12 @@ add_deps_edge (deps, src_sec, tgt_sec)
 
   if (deps_has_sec_edge (deps, src_sec, tgt_sec))
     return;
-  
+
   src_sec_deps = xtensa_get_section_deps (deps, src_sec);
   if (src_sec_deps == NULL)
     {
       /* Add a section.  */
-      src_sec_deps = (reloc_deps_section *)
-       xmalloc (sizeof (reloc_deps_section));
+      src_sec_deps = xmalloc (sizeof (reloc_deps_section));
       memset (src_sec_deps, 0, sizeof (reloc_deps_section));
       src_sec_deps->is_only_literal = 0;
       src_sec_deps->preds = NULL;
@@ -931,8 +833,7 @@ add_deps_edge (deps, src_sec, tgt_sec)
   if (tgt_sec_deps == NULL)
     {
       /* Add a section.  */
-      tgt_sec_deps = (reloc_deps_section *)
-       xmalloc (sizeof (reloc_deps_section));
+      tgt_sec_deps = xmalloc (sizeof (reloc_deps_section));
       memset (tgt_sec_deps, 0, sizeof (reloc_deps_section));
       tgt_sec_deps->is_only_literal = 0;
       tgt_sec_deps->preds = NULL;
@@ -942,14 +843,14 @@ add_deps_edge (deps, src_sec, tgt_sec)
     }
 
   /* Add the edges.  */
-  src_edge = (reloc_deps_e *) xmalloc (sizeof (reloc_deps_e));
+  src_edge = xmalloc (sizeof (reloc_deps_e));
   memset (src_edge, 0, sizeof (reloc_deps_e));
   src_edge->src = src_sec;
   src_edge->tgt = tgt_sec;
   src_edge->next = src_sec_deps->succs;
   src_sec_deps->succs = src_edge;
 
-  tgt_edge = (reloc_deps_e *) xmalloc (sizeof (reloc_deps_e));
+  tgt_edge = xmalloc (sizeof (reloc_deps_e));
   memset (tgt_edge, 0, sizeof (reloc_deps_e));
   tgt_edge->src = src_sec;
   tgt_edge->tgt = tgt_sec;
@@ -958,17 +859,14 @@ add_deps_edge (deps, src_sec, tgt_sec)
 }
 
 
-void 
-build_deps_graph_callback (src_sec, src_offset, 
-                         target_sec, target_offset, closure)
-     asection *src_sec;
-     bfd_vma src_offset ATTRIBUTE_UNUSED;
-     asection *target_sec;
-     bfd_vma target_offset ATTRIBUTE_UNUSED;
-     PTR closure;
+static void
+build_deps_graph_callback (asection *src_sec,
+                          bfd_vma src_offset ATTRIBUTE_UNUSED,
+                          asection *target_sec,
+                          bfd_vma target_offset ATTRIBUTE_UNUSED,
+                          void *closure)
 {
-  reloc_deps_graph *deps;
-  deps = (reloc_deps_graph*) closure;
+  reloc_deps_graph *deps = closure;
 
   /* If the target is defined.  */
   if (target_sec != NULL)
@@ -976,21 +874,20 @@ build_deps_graph_callback (src_sec, src_offset,
 }
 
 
-reloc_deps_graph *
-ld_build_required_section_dependence (s)
-     lang_statement_union_type *s;
+static reloc_deps_graph *
+ld_build_required_section_dependence (lang_statement_union_type *s)
 {
   reloc_deps_graph *deps;
   xtensa_ld_iter_stack *stack = NULL;
 
-  deps = (reloc_deps_graph*) xmalloc (sizeof (reloc_deps_graph));
+  deps = xmalloc (sizeof (reloc_deps_graph));
   deps->sections = NULL;
   deps->count = 0;
   deps->size = 0;
-  
+
   for (iter_stack_create (&stack, s);
        !iter_stack_empty (&stack);
-       iter_stack_next (&stack)) 
+       iter_stack_next (&stack))
     {
       lang_statement_union_type *l = iter_stack_current (&stack);
 
@@ -1003,7 +900,7 @@ ld_build_required_section_dependence (s)
                                               &link_info,
                                               /* Use the same closure.  */
                                               build_deps_graph_callback,
-                                              (PTR) deps);
+                                              deps);
        }
     }
   return deps;
@@ -1011,15 +908,14 @@ ld_build_required_section_dependence (s)
 
 
 #if EXTRA_VALIDATION
-size_t
-ld_count_children (s)
-     lang_statement_union_type *s;
+static size_t
+ld_count_children (lang_statement_union_type *s)
 {
   size_t count = 0;
   xtensa_ld_iter_stack *stack = NULL;
   for (iter_stack_create (&stack, s);
        !iter_stack_empty (&stack);
-       iter_stack_next (&stack)) 
+       iter_stack_next (&stack))
     {
       lang_statement_union_type *l = iter_stack_current (&stack);
       ASSERT (l != NULL);
@@ -1030,9 +926,8 @@ ld_count_children (s)
 #endif /* EXTRA_VALIDATION */
 
 
-void
-xtensa_wild_group_interleave_callback (statement)
-     lang_statement_union_type * statement;
+static void
+xtensa_wild_group_interleave_callback (lang_statement_union_type *statement)
 {
   lang_wild_statement_type *w;
   reloc_deps_graph *deps;
@@ -1069,13 +964,13 @@ xtensa_wild_group_interleave_callback (statement)
                  break;
                }
            }
-       }         
+       }
 
       /* Special case until the NOREORDER linker directive is supported:
-         *(.init) output sections and *(.fini) specs may NOT be reordered.  */
+        *(.init) output sections and *(.fini) specs may NOT be reordered.  */
 
       /* Check for sorting in a section list wildcard spec as well.  */
-      if (!no_reorder) 
+      if (!no_reorder)
        {
          struct wildcard_list *l;
          for (l = w->section_list; l != NULL; l = l->next)
@@ -1095,7 +990,7 @@ xtensa_wild_group_interleave_callback (statement)
 #endif
 
       /* It is now officially a target.  Build the graph of source
-         section -> target section (kept as a list of edges).  */
+        section -> target section (kept as a list of edges).  */
       deps = ld_build_required_section_dependence (statement);
 
       /* If this wildcard does not reorder....  */
@@ -1124,18 +1019,16 @@ xtensa_wild_group_interleave_callback (statement)
 }
 
 
-void 
-xtensa_wild_group_interleave (s)
-     lang_statement_union_type *s; 
+static void
+xtensa_wild_group_interleave (lang_statement_union_type *s)
 {
   lang_for_each_statement_worker (xtensa_wild_group_interleave_callback, s);
 }
 
 
-void 
-xtensa_layout_wild (deps, w)
-     const reloc_deps_graph *deps;
-     lang_wild_statement_type *w;
+static void
+xtensa_layout_wild (const reloc_deps_graph *deps,
+                   lang_wild_statement_type *w)
 {
   /* If it does not fit initially, we need to do this step.  Move all
      of the wild literal sections to a new list, then move each of
@@ -1145,7 +1038,7 @@ xtensa_layout_wild (deps, w)
   size_t old_count, new_count;
   size_t ct1, ct2;
 #endif
-  
+
   lang_wild_statement_type literal_wild;
   literal_wild.header.next = NULL;
   literal_wild.header.type = lang_wild_statement_enum;
@@ -1167,7 +1060,7 @@ xtensa_layout_wild (deps, w)
       if (l->header.type == lang_input_section_enum)
        {
          if (section_is_target (deps, l)
-             && ! section_is_source (deps, l)) 
+             && ! section_is_source (deps, l))
            {
              /* Detach.  */
              *s_p = l->header.next;
@@ -1179,7 +1072,7 @@ xtensa_layout_wild (deps, w)
              *literal_wild.children.tail = l;
              literal_wild.children.tail = &l->header.next;
              continue;
-           } 
+           }
        }
       s_p = &(*s_p)->header.next;
     }
@@ -1187,10 +1080,10 @@ xtensa_layout_wild (deps, w)
 #if EXTRA_VALIDATION
   ct1 = ld_count_children ((lang_statement_union_type*) w);
   ct2 = ld_count_children ((lang_statement_union_type*) &literal_wild);
-  
+
   ASSERT (old_count == (ct1 + ct2));
 #endif
-  
+
   /* Now place them back in front of their dependent sections.  */
 
   while (literal_wild.children.head != NULL)
@@ -1205,12 +1098,12 @@ xtensa_layout_wild (deps, w)
 
       /* Detach.  */
       literal_wild.children.head = lit->header.next;
-      if (literal_wild.children.head == NULL) 
+      if (literal_wild.children.head == NULL)
        literal_wild.children.tail = &literal_wild.children.head;
       lit->header.next = NULL;
 
       /* Find a spot to place it.  */
-      for (s_p = &w->children.head; *s_p != NULL; s_p = &(*s_p)->header.next) 
+      for (s_p = &w->children.head; *s_p != NULL; s_p = &(*s_p)->header.next)
        {
          lang_statement_union_type *src = *s_p;
          if (deps_has_edge (deps, src, lit))
@@ -1222,7 +1115,7 @@ xtensa_layout_wild (deps, w)
              break;
            }
        }
-      
+
       if (!placed)
        {
          /* Put it at the end.  */
@@ -1238,9 +1131,8 @@ xtensa_layout_wild (deps, w)
 }
 
 
-void
-xtensa_colocate_output_literals_callback (statement)
-     lang_statement_union_type * statement;
+static void
+xtensa_colocate_output_literals_callback (lang_statement_union_type *statement)
 {
   lang_output_section_statement_type *os;
   reloc_deps_graph *deps;
@@ -1271,7 +1163,7 @@ xtensa_colocate_output_literals_callback (statement)
 #endif
 
       /* It is now officially a target.  Build the graph of source
-         section -> target section (kept as a list of edges).  */
+        section -> target section (kept as a list of edges).  */
 
       deps = ld_build_required_section_dependence (statement);
 
@@ -1290,7 +1182,7 @@ xtensa_colocate_output_literals_callback (statement)
       /* Insert align/offset assignment statement.  */
       if (xtensa_use_literal_pages)
        {
-         ld_xtensa_insert_page_offsets ((bfd_vma) 0, statement, deps,
+         ld_xtensa_insert_page_offsets (0, statement, deps,
                                         xtensa_use_literal_pages);
          lang_for_each_statement_worker (xtensa_ldlang_clear_addresses,
                                          statement);
@@ -1302,21 +1194,19 @@ xtensa_colocate_output_literals_callback (statement)
 }
 
 
-void 
-xtensa_colocate_output_literals (s)
-     lang_statement_union_type *s; 
+static void
+xtensa_colocate_output_literals (lang_statement_union_type *s)
 {
   lang_for_each_statement_worker (xtensa_colocate_output_literals_callback, s);
 }
 
 
-void
-xtensa_ldlang_clear_addresses (statement)
-     lang_statement_union_type * statement;
+static void
+xtensa_ldlang_clear_addresses (lang_statement_union_type *statement)
 {
   switch (statement->header.type)
     {
-    case lang_input_section_enum: 
+    case lang_input_section_enum:
       {
        asection *bfd_section = statement->input_section.section;
        bfd_section->output_offset = 0;
@@ -1328,16 +1218,15 @@ xtensa_ldlang_clear_addresses (statement)
 }
 
 
-bfd_vma
-ld_assign_relative_paged_dot (dot, s, deps, lit_align)
-     bfd_vma dot;
-     lang_statement_union_type *s;
-     const reloc_deps_graph *deps ATTRIBUTE_UNUSED;
-     bfd_boolean lit_align;
+static bfd_vma
+ld_assign_relative_paged_dot (bfd_vma dot,
+                             lang_statement_union_type *s,
+                             const reloc_deps_graph *deps ATTRIBUTE_UNUSED,
+                             bfd_boolean lit_align)
 {
   /* Walk through all of the input statements in this wild statement
      assign dot to all of them.  */
-  
+
   xtensa_ld_iter_stack *stack = NULL;
   xtensa_ld_iter_stack **stack_p = &stack;
 
@@ -1346,18 +1235,18 @@ ld_assign_relative_paged_dot (dot, s, deps, lit_align)
 
   for (iter_stack_create (stack_p, s);
        !iter_stack_empty (stack_p);
-       iter_stack_next (stack_p)) 
+       iter_stack_next (stack_p))
     {
       lang_statement_union_type *l = iter_stack_current (stack_p);
-    
-      switch (l->header.type) 
+
+      switch (l->header.type)
        {
        case lang_input_section_enum:
          {
            asection *section = l->input_section.section;
            size_t align_pow = section->alignment_power;
            bfd_boolean do_xtensa_alignment = FALSE;
-       
+
            if (lit_align)
              {
                bfd_boolean sec_is_target = section_is_target (deps, l);
@@ -1371,7 +1260,7 @@ ld_assign_relative_paged_dot (dot, s, deps, lit_align)
                    do_xtensa_alignment = TRUE;
                  }
                first_section = FALSE;
-               if (section->_raw_size != 0) 
+               if (section->_raw_size != 0)
                  in_literals = (sec_is_target && !sec_is_source);
              }
 
@@ -1397,18 +1286,17 @@ ld_assign_relative_paged_dot (dot, s, deps, lit_align)
 }
 
 
-bfd_boolean
-ld_local_file_relocations_fit (statement, deps)
-     lang_statement_union_type *statement;
-     const reloc_deps_graph *deps ATTRIBUTE_UNUSED;
+static bfd_boolean
+ld_local_file_relocations_fit (lang_statement_union_type *statement,
+                              const reloc_deps_graph *deps ATTRIBUTE_UNUSED)
 {
   /* Walk over all of the dependencies that we identified and make
      sure that IF the source and target are here (addr != 0):
      1) target addr < source addr
-     2) (roundup(source + source_size, 4) - rounddown(target, 4)) 
+     2) (roundup(source + source_size, 4) - rounddown(target, 4))
         < (256K - (1 << bad align))
      Need a worst-case proof....  */
-  
+
   xtensa_ld_iter_stack *stack = NULL;
   xtensa_ld_iter_stack **stack_p = &stack;
   size_t max_align_power = 0;
@@ -1419,10 +1307,10 @@ ld_local_file_relocations_fit (statement, deps)
   /* Find the worst-case alignment requirement for this set of statements.  */
   for (iter_stack_create (stack_p, statement);
        !iter_stack_empty (stack_p);
-       iter_stack_next (stack_p)) 
+       iter_stack_next (stack_p))
     {
       lang_statement_union_type *l = iter_stack_current (stack_p);
-      if (l->header.type == lang_input_section_enum) 
+      if (l->header.type == lang_input_section_enum)
        {
          lang_input_section_type *input = &l->input_section;
          asection *section = input->section;
@@ -1435,21 +1323,21 @@ ld_local_file_relocations_fit (statement, deps)
   for (i = 0; i < deps->count; i++)
     {
       asection *sec = deps->sections[i];
-      const reloc_deps_section *deps_section = 
+      const reloc_deps_section *deps_section =
        xtensa_get_section_deps (deps, sec);
       if (deps_section)
        {
          /* We choose to walk through the successors.  */
          for (e = deps_section->succs; e != NULL; e = e->next)
            {
-             if ((e->src != e->tgt)
+             if (e->src != e->tgt
                  && e->src->output_section == e->tgt->output_section
                  && e->src->output_offset != 0
                  && e->tgt->output_offset != 0)
                {
-                 bfd_vma l32r_addr = 
+                 bfd_vma l32r_addr =
                    align_power (e->src->output_offset + e->src->_raw_size, 2);
-                 bfd_vma target_addr = e->tgt->output_offset & (~3);
+                 bfd_vma target_addr = e->tgt->output_offset & ~3;
                  if (l32r_addr < target_addr)
                    {
                      fprintf (stderr, "Warning: "
@@ -1457,7 +1345,7 @@ ld_local_file_relocations_fit (statement, deps)
                      return FALSE;
                    }
 
-                 if ((l32r_addr - target_addr) > (256*1024 - align_penalty)) 
+                 if (l32r_addr - target_addr > 256 * 1024 - align_penalty)
                    return FALSE;
                }
            }
@@ -1468,35 +1356,34 @@ ld_local_file_relocations_fit (statement, deps)
 }
 
 
-bfd_vma
-ld_xtensa_insert_page_offsets (dot, s, deps, lit_align)
-     bfd_vma dot;
-     lang_statement_union_type *s;
-     reloc_deps_graph *deps;
-     bfd_boolean lit_align;
+static bfd_vma
+ld_xtensa_insert_page_offsets (bfd_vma dot,
+                              lang_statement_union_type *s,
+                              reloc_deps_graph *deps,
+                              bfd_boolean lit_align)
 {
   xtensa_ld_iter_stack *stack = NULL;
   xtensa_ld_iter_stack **stack_p = &stack;
 
   bfd_boolean first_section = FALSE;
   bfd_boolean in_literals = FALSE;
-  
+
   if (!lit_align)
     return FALSE;
 
   for (iter_stack_create (stack_p, s);
        !iter_stack_empty (stack_p);
-       iter_stack_next (stack_p)) 
+       iter_stack_next (stack_p))
     {
       lang_statement_union_type *l = iter_stack_current (stack_p);
 
-      switch (l->header.type) 
-        {
+      switch (l->header.type)
+       {
        case lang_input_section_enum:
          {
            asection *section = l->input_section.section;
            bfd_boolean do_xtensa_alignment = FALSE;
-        
+
            if (lit_align)
              {
                if (section->_raw_size != 0
@@ -1507,7 +1394,7 @@ ld_xtensa_insert_page_offsets (dot, s, deps, lit_align)
                    do_xtensa_alignment = TRUE;
                  }
                first_section = FALSE;
-               if (section->_raw_size != 0) 
+               if (section->_raw_size != 0)
                  {
                    in_literals = (section_is_target (deps, l)
                                   && !section_is_source (deps, l));
@@ -1527,7 +1414,7 @@ ld_xtensa_insert_page_offsets (dot, s, deps, lit_align)
                lang_statement_union_type *assign_union;
                lang_statement_list_type tmplist;
                lang_statement_list_type *old_stat_ptr = stat_ptr;
-                 
+
                /* There is hidden state in "lang_add_assignment".  It
                   appends the new assignment statement to the stat_ptr
                   list.  Thus, we swap it before and after the call.  */
@@ -1544,12 +1431,12 @@ ld_xtensa_insert_page_offsets (dot, s, deps, lit_align)
                assign_union->header.next = l;
                *(*stack_p)->iterloc.loc = assign_union;
                iter_stack_next (stack_p);
-              }
-          }
-          break;
-        default:
-          break;
-        }
+             }
+         }
+         break;
+       default:
+         break;
+       }
     }
   return dot;
 }
This page took 0.041086 seconds and 4 git commands to generate.