This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

trim a much used linker struct


Removes one pointer from the most used lang_statement_union_type
variant, lang_input_section_type.  As a bonus, lang_add_section and
all the place_orphan functions lose a parameter.  On the negative side,
access to just_syms_flag requires one more indirection.  I suppose I
could fix that by always setting sec->sec_info_type and using that.
Maybe later.

	* ldlang.h (lang_input_section_type): Remove "ifile" field.
	(lang_insert_orphan, lang_add_section): Update prototypes.
	* ldlang.c (lang_insert_orphan): Remove "file" param.
	(lang_add_section): Likewise.  Update all callers.
	(wild_sort): Get an input section's bfd via "section->owner".
	(size_input_section): Access just_syms_flag via bfd usrdata.
	(lang_place_orphans): Update ldemul_place_orphan call.
	* ldemul.h (ldemul_place_orphan): Remove input_statement param.
	(struct ld_emulation_xfer_struct <place_orphan>): Likewise.
	* ldemul.c (ldemul_place_orphan): Likewise.
	* ldwrite.c (build_link_order): Access just_syms_flag via bfd usrdata.
	* emultempl/armelf.em (arm_elf_set_bfd_for_interworking): Likewise.
	* emultempl/beos.em (sort_by_file_name): Access bfd by section->owner.
	(sort_sections): Likewise.
	(place_orphan): Remove "file" param.  Adjust lang_add_section call.
	* emultempl/elf32.em (place_orphan): Remove "file" param.  Adjust
	lang_add_section and lang_insert_orphan calls.
	* emultempl/hppaelf.em (hppaelf_add_stub_section): Adjust
	lang_add_section call.
	(build_section_lists): Access just_syms_flag via bfd usrdata.
	* emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Adjust
	lang_add_section call.
	* emultempl/mmo.em (mmo_place_orphan): Remove "file" param.  Adjust
	lang_add_section and lang_insert_orphan calls.
	* emultempl/pe.em (place_orphan): Likewise.  Access bfd via section
	owner.
	* emultempl/ppc64elf.em (ppc_add_stub_section): Adjust
	lang_add_section call.
	(build_toc_list): Access just_syms_flag via bfd usrdata.
	(build_section_lists): Likewise.
	* emultempl/xtensaelf.em (elf_xtensa_place_orphan): Remove "file"
	param.  Adjust place_orphan call.
	(ld_build_required_section_dependence): Access bfd via section owner.

Index: ld/ldlang.h
===================================================================
RCS file: /cvs/src/src/ld/ldlang.h,v
retrieving revision 1.56
diff -u -p -r1.56 ldlang.h
--- ld/ldlang.h	16 Nov 2005 08:32:54 -0000	1.56
+++ ld/ldlang.h	16 Nov 2005 12:02:29 -0000
@@ -285,8 +285,6 @@ typedef struct
 {
   lang_statement_header_type header;
   asection *section;
-  lang_input_statement_type *ifile;
-
 } lang_input_section_type;
 
 typedef struct
@@ -525,9 +523,8 @@ extern lang_output_section_statement_typ
 extern lang_output_section_statement_type *lang_output_section_find_by_flags
   (const asection *, lang_output_section_statement_type **exact);
 extern lang_output_section_statement_type *lang_insert_orphan
-  (lang_input_statement_type *, asection *, const char *,
-   lang_output_section_statement_type *, struct orphan_save *,
-   etree_type *, lang_statement_list_type *);
+  (asection *, const char *, lang_output_section_statement_type *,
+   struct orphan_save *, etree_type *, lang_statement_list_type *);
 extern lang_input_statement_type *lang_add_input_file
   (const char *, lang_input_file_enum_type, const char *);
 extern void lang_add_keepsyms_file
@@ -564,7 +561,7 @@ extern void lang_leave_group
   (void);
 extern void lang_add_section
   (lang_statement_list_type *, asection *,
-   lang_output_section_statement_type *, lang_input_statement_type *);
+   lang_output_section_statement_type *);
 extern void lang_new_phdr
   (const char *, etree_type *, bfd_boolean, bfd_boolean, etree_type *,
    etree_type *);
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.206
diff -u -p -r1.206 ldlang.c
--- ld/ldlang.c	16 Nov 2005 08:32:54 -0000	1.206
+++ ld/ldlang.c	16 Nov 2005 12:02:29 -0000
@@ -1313,8 +1313,7 @@ output_prev_sec_find (lang_output_sectio
 }
 
 lang_output_section_statement_type *
-lang_insert_orphan (lang_input_statement_type *file,
-		    asection *s,
+lang_insert_orphan (asection *s,
 		    const char *secname,
 		    lang_output_section_statement_type *after,
 		    struct orphan_save *place,
@@ -1385,7 +1384,7 @@ lang_insert_orphan (lang_input_statement
 
   if (add_child == NULL)
     add_child = &os->children;
-  lang_add_section (add_child, s, os, file);
+  lang_add_section (add_child, s, os);
 
   lang_leave_output_section_statement (0, "*default*", NULL, NULL);
 
@@ -1811,8 +1810,7 @@ section_already_linked (bfd *abfd, asect
 void
 lang_add_section (lang_statement_list_type *ptr,
 		  asection *section,
-		  lang_output_section_statement_type *output,
-		  lang_input_statement_type *file)
+		  lang_output_section_statement_type *output)
 {
   flagword flags = section->flags;
   bfd_boolean discard;
@@ -1870,7 +1868,6 @@ lang_add_section (lang_statement_list_ty
       new = new_stat (lang_input_section, ptr);
 
       new->section = section;
-      new->ifile = file;
       section->output_section = output->bfd_section;
 
       flags = section->flags;
@@ -2046,15 +2043,14 @@ wild_sort (lang_wild_statement_type *wil
 	      fa = FALSE;
 	    }
 
-	  if (ls->ifile->the_bfd != NULL
-	      && bfd_my_archive (ls->ifile->the_bfd) != NULL)
+	  if (bfd_my_archive (ls->section->owner) != NULL)
 	    {
-	      ln = bfd_get_filename (bfd_my_archive (ls->ifile->the_bfd));
+	      ln = bfd_get_filename (bfd_my_archive (ls->section->owner));
 	      la = TRUE;
 	    }
 	  else
 	    {
-	      ln = ls->ifile->filename;
+	      ln = ls->section->owner->filename;
 	      la = FALSE;
 	    }
 
@@ -2069,7 +2065,7 @@ wild_sort (lang_wild_statement_type *wil
 	      if (fa)
 		fn = file->filename;
 	      if (la)
-		ln = ls->ifile->filename;
+		ln = ls->section->owner->filename;
 
 	      i = strcmp (fn, ln);
 	      if (i > 0)
@@ -2115,8 +2111,7 @@ output_section_callback (lang_wild_state
 
   if (before == NULL)
     lang_add_section (&ptr->children, section,
-		      (lang_output_section_statement_type *) output,
-		      file);
+		      (lang_output_section_statement_type *) output);
   else
     {
       lang_statement_list_type list;
@@ -2124,8 +2119,7 @@ output_section_callback (lang_wild_state
 
       lang_list_init (&list);
       lang_add_section (&list, section,
-			(lang_output_section_statement_type *) output,
-			file);
+			(lang_output_section_statement_type *) output);
 
       /* If we are discarding the section, LIST.HEAD will
 	 be NULL.  */
@@ -3903,7 +3897,8 @@ size_input_section
   lang_input_section_type *is = &((*this_ptr)->input_section);
   asection *i = is->section;
 
-  if (!is->ifile->just_syms_flag && (i->flags & SEC_EXCLUDE) == 0)
+  if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+      && (i->flags & SEC_EXCLUDE) == 0)
     {
       unsigned int alignment_needed;
       asection *o;
@@ -5061,17 +5056,17 @@ lang_place_orphans (void)
 
 			}
 		      lang_add_section (&default_common_section->children, s,
-					default_common_section, file);
+					default_common_section);
 		    }
 		}
-	      else if (ldemul_place_orphan (file, s))
+	      else if (ldemul_place_orphan (s))
 		;
 	      else
 		{
 		  lang_output_section_statement_type *os;
 
 		  os = lang_output_section_statement_lookup (s->name);
-		  lang_add_section (&os->children, s, os, file);
+		  lang_add_section (&os->children, s, os);
 		}
 	    }
 	}
Index: ld/ldemul.h
===================================================================
RCS file: /cvs/src/src/ld/ldemul.h,v
retrieving revision 1.17
diff -u -p -r1.17 ldemul.h
--- ld/ldemul.h	4 Aug 2005 06:22:12 -0000	1.17
+++ ld/ldemul.h	16 Nov 2005 12:02:26 -0000
@@ -54,7 +54,7 @@ extern void ldemul_set_symbols
 extern void ldemul_create_output_section_statements
   (void);
 extern bfd_boolean ldemul_place_orphan
-  (struct lang_input_statement_struct *, asection *);
+  (asection *);
 extern bfd_boolean ldemul_parse_args
   (int, char **);
 extern void ldemul_add_options
@@ -147,7 +147,7 @@ typedef struct ld_emulation_xfer_struct 
      the default action should be taken.  This field may be NULL, in
      which case the default action will always be taken.  */
   bfd_boolean (*place_orphan)
-    (struct lang_input_statement_struct *, asection *);
+    (asection *);
 
   /* Run after assigning parsing with the args, but before
      reading the script.  Used to initialize symbols used in the script.  */
Index: ld/ldemul.c
===================================================================
RCS file: /cvs/src/src/ld/ldemul.c,v
retrieving revision 1.23
diff -u -p -r1.23 ldemul.c
--- ld/ldemul.c	4 Aug 2005 06:22:11 -0000	1.23
+++ ld/ldemul.c	16 Nov 2005 12:02:25 -0000
@@ -121,10 +121,10 @@ ldemul_open_dynamic_archive (const char 
 }
 
 bfd_boolean
-ldemul_place_orphan (lang_input_statement_type *file, asection *s)
+ldemul_place_orphan (asection *s)
 {
   if (ld_emulation->place_orphan)
-    return (*ld_emulation->place_orphan) (file, s);
+    return (*ld_emulation->place_orphan) (s);
   return FALSE;
 }
 
Index: ld/ldwrite.c
===================================================================
RCS file: /cvs/src/src/ld/ldwrite.c,v
retrieving revision 1.22
diff -u -p -r1.22 ldwrite.c
--- ld/ldwrite.c	3 Nov 2005 02:54:10 -0000	1.22
+++ ld/ldwrite.c	16 Nov 2005 12:02:30 -0000
@@ -218,43 +218,46 @@ build_link_order (lang_statement_union_t
       break;
 
     case lang_input_section_enum:
-      /* Create a new link_order in the output section with this
-	 attached */
-      if (!statement->input_section.ifile->just_syms_flag
-	  && (statement->input_section.section->flags & SEC_EXCLUDE) == 0)
-	{
-	  asection *i = statement->input_section.section;
-	  asection *output_section = i->output_section;
-
-	  ASSERT (output_section->owner == output_bfd);
+      {
+	/* Create a new link_order in the output section with this
+	   attached */
+	asection *i = statement->input_section.section;
 
-	  if ((output_section->flags & SEC_HAS_CONTENTS) != 0
-	      || ((output_section->flags & SEC_LOAD) != 0
-		  && (output_section->flags & SEC_THREAD_LOCAL)))
-	    {
-	      struct bfd_link_order *link_order;
+	if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+	    && (i->flags & SEC_EXCLUDE) == 0)
+	  {
+	    asection *output_section = i->output_section;
 
-	      link_order = bfd_new_link_order (output_bfd, output_section);
+	    ASSERT (output_section->owner == output_bfd);
 
-	      if (i->flags & SEC_NEVER_LOAD)
-		{
-		  /* We've got a never load section inside one which
-		     is going to be output, we'll change it into a
-		     fill.  */
-		  link_order->type = bfd_data_link_order;
-		  link_order->u.data.contents = (unsigned char *) "";
-		  link_order->u.data.size = 1;
-		}
-	      else
-		{
-		  link_order->type = bfd_indirect_link_order;
-		  link_order->u.indirect.section = i;
-		  ASSERT (i->output_section == output_section);
-		}
-	      link_order->size = i->size;
-	      link_order->offset = i->output_offset;
-	    }
-	}
+	    if ((output_section->flags & SEC_HAS_CONTENTS) != 0
+		|| ((output_section->flags & SEC_LOAD) != 0
+		    && (output_section->flags & SEC_THREAD_LOCAL)))
+	      {
+		struct bfd_link_order *link_order;
+
+		link_order = bfd_new_link_order (output_bfd, output_section);
+
+		if (i->flags & SEC_NEVER_LOAD)
+		  {
+		    /* We've got a never load section inside one which
+		       is going to be output, we'll change it into a
+		       fill.  */
+		    link_order->type = bfd_data_link_order;
+		    link_order->u.data.contents = (unsigned char *) "";
+		    link_order->u.data.size = 1;
+		  }
+		else
+		  {
+		    link_order->type = bfd_indirect_link_order;
+		    link_order->u.indirect.section = i;
+		    ASSERT (i->output_section == output_section);
+		  }
+		link_order->size = i->size;
+		link_order->offset = i->output_offset;
+	      }
+	  }
+      }
       break;
 
     case lang_padding_statement_enum:
Index: ld/emultempl/armelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/armelf.em,v
retrieving revision 1.47
diff -u -p -r1.47 armelf.em
--- ld/emultempl/armelf.em	16 Jun 2005 09:46:10 -0000	1.47
+++ ld/emultempl/armelf.em	16 Nov 2005 12:02:30 -0000
@@ -71,24 +71,27 @@ arm_elf_after_open (void)
 static void
 arm_elf_set_bfd_for_interworking (lang_statement_union_type *statement)
 {
-  if (statement->header.type == lang_input_section_enum
-      && !statement->input_section.ifile->just_syms_flag
-      && (statement->input_section.section->flags & SEC_EXCLUDE) == 0)
+  if (statement->header.type == lang_input_section_enum)
     {
       asection *i = statement->input_section.section;
-      asection *output_section = i->output_section;
 
-      ASSERT (output_section->owner == output_bfd);
-
-      /* Don't attach the interworking stubs to a dynamic object, to
-	 an empty section, etc.  */
-      if ((output_section->flags & SEC_HAS_CONTENTS) != 0
-	  && (i->flags & SEC_NEVER_LOAD) == 0
-	  && ! (i->owner->flags & DYNAMIC)
-	  && ! i->owner->output_has_begun)
+      if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+	  && (i->flags & SEC_EXCLUDE) == 0)
 	{
-	  bfd_for_interwork = i->owner;
-	  bfd_for_interwork->output_has_begun = TRUE;
+	  asection *output_section = i->output_section;
+
+	  ASSERT (output_section->owner == output_bfd);
+
+	  /* Don't attach the interworking stubs to a dynamic object, to
+	     an empty section, etc.  */
+	  if ((output_section->flags & SEC_HAS_CONTENTS) != 0
+	      && (i->flags & SEC_NEVER_LOAD) == 0
+	      && ! (i->owner->flags & DYNAMIC)
+	      && ! i->owner->output_has_begun)
+	    {
+	      bfd_for_interwork = i->owner;
+	      bfd_for_interwork->output_has_begun = TRUE;
+	    }
 	}
     }
 }
Index: ld/emultempl/beos.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/beos.em,v
retrieving revision 1.33
diff -u -p -r1.33 beos.em
--- ld/emultempl/beos.em	4 Aug 2005 06:22:13 -0000	1.33
+++ ld/emultempl/beos.em	16 Nov 2005 12:02:30 -0000
@@ -397,13 +397,13 @@ sort_by_file_name (const void *a, const 
   const lang_statement_union_type *const *rb = b;
   int i, a_sec, b_sec;
 
-  i = strcmp ((*ra)->input_section.ifile->the_bfd->my_archive->filename,
-	      (*rb)->input_section.ifile->the_bfd->my_archive->filename);
+  i = strcmp ((*ra)->input_section.section->owner->my_archive->filename,
+	      (*rb)->input_section.section->owner->my_archive->filename);
   if (i != 0)
     return i;
 
-  i = strcmp ((*ra)->input_section.ifile->filename,
-		 (*rb)->input_section.ifile->filename);
+  i = strcmp ((*ra)->input_section.section->owner->filename,
+		 (*rb)->input_section.section->owner->filename);
   if (i != 0)
     return i;
   /* the tail idata4/5 are the only ones without relocs to an
@@ -427,15 +427,15 @@ sort_by_file_name (const void *a, const 
        if ( (strcmp( (*ra)->input_section.section->name, ".idata$6") == 0) )
           return 0; /* don't sort .idata$6 or .idata$7 FIXME dlltool eliminate .idata$7 */
 
-       if (! bfd_get_section_contents ((*ra)->input_section.ifile->the_bfd,
+       if (! bfd_get_section_contents ((*ra)->input_section.section->owner,
          (*ra)->input_section.section, &a_sec, (file_ptr) 0, (bfd_size_type)sizeof(a_sec)))
             einfo ("%F%B: Can't read contents of section .idata: %E\n",
-                 (*ra)->input_section.ifile->the_bfd);
+                 (*ra)->input_section.section->owner);
 
-       if (! bfd_get_section_contents ((*rb)->input_section.ifile->the_bfd,
+       if (! bfd_get_section_contents ((*rb)->input_section.section->owner,
         (*rb)->input_section.section, &b_sec, (file_ptr) 0, (bfd_size_type)sizeof(b_sec) ))
            einfo ("%F%B: Can't read contents of section .idata: %E\n",
-                (*rb)->input_section.ifile->the_bfd);
+                (*rb)->input_section.section->owner);
 
       i =  ((a_sec < b_sec) ? -1 : 0);
       if ( i != 0)
@@ -547,7 +547,7 @@ sort_sections (lang_statement_union_type
 		    {
 		      lang_statement_union_type *start = *p;
 		      if (start->header.type != lang_input_section_enum
-			  || !start->input_section.ifile->the_bfd->my_archive)
+			  || !start->input_section.section->owner->my_archive)
 			p = &(start->header.next);
 		      else
 			{
@@ -662,7 +662,7 @@ gld_${EMULATION_NAME}_before_allocation 
    which are not mentioned in the linker script.  */
 
 static bfd_boolean
-gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
+gld${EMULATION_NAME}_place_orphan (asection *s)
 {
   const char *secname;
   char *output_secname, *ps;
@@ -722,7 +722,7 @@ gld${EMULATION_NAME}_place_orphan (lang_
      The sections still have to be sorted, but that has to wait until
      all such sections have been processed by us.  The sorting is done by
      sort_sections.  */
-  lang_add_section (&l->wild_statement.children, s, os, file);
+  lang_add_section (&l->wild_statement.children, s, os);
 
   return TRUE;
 }
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.158
diff -u -p -r1.158 elf32.em
--- ld/emultempl/elf32.em	24 Oct 2005 01:40:58 -0000	1.158
+++ ld/emultempl/elf32.em	16 Nov 2005 12:02:31 -0000
@@ -59,8 +59,7 @@ Foundation, Inc., 51 Franklin Street - F
 static void gld${EMULATION_NAME}_before_parse (void);
 static void gld${EMULATION_NAME}_after_open (void);
 static void gld${EMULATION_NAME}_before_allocation (void);
-static bfd_boolean gld${EMULATION_NAME}_place_orphan
-  (lang_input_statement_type *file, asection *s);
+static bfd_boolean gld${EMULATION_NAME}_place_orphan (asection *s);
 static void gld${EMULATION_NAME}_layout_sections_again (void);
 static void gld${EMULATION_NAME}_finish (void) ATTRIBUTE_UNUSED;
 
@@ -1283,7 +1282,7 @@ output_rel_find (asection *sec, int isdy
    sections in the right segment.  */
 
 static bfd_boolean
-gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
+gld${EMULATION_NAME}_place_orphan (asection *s)
 {
   static struct orphan_save hold[] =
     {
@@ -1374,7 +1373,7 @@ gld${EMULATION_NAME}_place_orphan (lang_
 	     If the section already exists but does not have any flags
 	     set, then it has been created by the linker, probably as a
 	     result of a --section-start command line switch.  */
-	  lang_add_section (&os->children, s, os, file);
+	  lang_add_section (&os->children, s, os);
 	  return TRUE;
 	}
     }
@@ -1400,7 +1399,7 @@ gld${EMULATION_NAME}_place_orphan (lang_
       && hold[orphan_text].os != NULL)
     {
       lang_add_section (&hold[orphan_text].os->children, s,
-			hold[orphan_text].os, file);
+			hold[orphan_text].os);
       return TRUE;
     }
 
@@ -1461,7 +1460,7 @@ gld${EMULATION_NAME}_place_orphan (lang_
 	einfo ("%F%P: place_orphan failed: %E\n");
     }
 
-  lang_insert_orphan (file, s, secname, after, place, NULL, NULL);
+  lang_insert_orphan (s, secname, after, place, NULL, NULL);
 
   return TRUE;
 }
Index: ld/emultempl/hppaelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/hppaelf.em,v
retrieving revision 1.44
diff -u -p -r1.44 hppaelf.em
--- ld/emultempl/hppaelf.em	4 Aug 2005 01:19:10 -0000	1.44
+++ ld/emultempl/hppaelf.em	16 Nov 2005 12:02:32 -0000
@@ -198,7 +198,7 @@ hppaelf_add_stub_section (const char *st
 
   info.input_section = input_section;
   lang_list_init (&info.add);
-  lang_add_section (&info.add, stub_sec, os, stub_file);
+  lang_add_section (&info.add, stub_sec, os);
 
   if (info.add.head == NULL)
     goto err_ret;
@@ -229,14 +229,17 @@ hppaelf_layout_sections_again (void)
 static void
 build_section_lists (lang_statement_union_type *statement)
 {
-  if (statement->header.type == lang_input_section_enum
-      && !statement->input_section.ifile->just_syms_flag
-      && (statement->input_section.section->flags & SEC_EXCLUDE) == 0
-      && statement->input_section.section->output_section != NULL
-      && statement->input_section.section->output_section->owner == output_bfd)
+  if (statement->header.type == lang_input_section_enum)
     {
-      elf32_hppa_next_input_section (&link_info,
-				     statement->input_section.section);
+      asection *i = statement->input_section.section;
+
+      if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+	  && (i->flags & SEC_EXCLUDE) == 0
+	  && i->output_section != NULL
+	  && i->output_section->owner == output_bfd)
+	{
+	  elf32_hppa_next_input_section (&link_info, i);
+	}
     }
 }
 
Index: ld/emultempl/m68hc1xelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/m68hc1xelf.em,v
retrieving revision 1.6
diff -u -p -r1.6 m68hc1xelf.em
--- ld/emultempl/m68hc1xelf.em	12 May 2005 07:32:03 -0000	1.6
+++ ld/emultempl/m68hc1xelf.em	16 Nov 2005 12:02:32 -0000
@@ -272,7 +272,7 @@ m68hc11elf_add_stub_section (const char 
      at the correct place.  */
   info.input_section = tramp_section;
   lang_list_init (&info.add);
-  lang_add_section (&info.add, stub_sec, os, stub_file);
+  lang_add_section (&info.add, stub_sec, os);
 
   if (info.add.head == NULL)
     goto err_ret;
Index: ld/emultempl/mmo.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/mmo.em,v
retrieving revision 1.16
diff -u -p -r1.16 mmo.em
--- ld/emultempl/mmo.em	4 Aug 2005 01:19:10 -0000	1.16
+++ ld/emultempl/mmo.em	16 Nov 2005 12:02:32 -0000
@@ -37,7 +37,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
    from elf32.em.  */
 
 static bfd_boolean
-mmo_place_orphan (lang_input_statement_type *file, asection *s)
+mmo_place_orphan (asection *s)
 {
   static struct orphan_save hold_text =
     {
@@ -63,7 +63,7 @@ mmo_place_orphan (lang_input_statement_t
      (regardless of whether the linker script lists it as input).  */
   if (os != NULL)
     {
-      lang_add_section (&os->children, s, os, file);
+      lang_add_section (&os->children, s, os);
       return TRUE;
     }
 
@@ -83,7 +83,7 @@ mmo_place_orphan (lang_input_statement_t
 
   /* If there's an output section by this name, we'll use it, regardless
      of section flags, in contrast to what's done in elf32.em.  */
-  os = lang_insert_orphan (file, s, secname, after, place, NULL, NULL);
+  os = lang_insert_orphan (s, secname, after, place, NULL, NULL);
 
   /* We need an output section for .text as a root, so if there was none
      (might happen with a peculiar linker script such as in "map
Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.111
diff -u -p -r1.111 pe.em
--- ld/emultempl/pe.em	5 Oct 2005 08:07:51 -0000	1.111
+++ ld/emultempl/pe.em	16 Nov 2005 12:02:33 -0000
@@ -1518,7 +1518,7 @@ gld_${EMULATION_NAME}_finish (void)
    sort_sections.  */
 
 static bfd_boolean
-gld_${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s)
+gld_${EMULATION_NAME}_place_orphan (asection *s)
 {
   const char *secname;
   const char *orig_secname;
@@ -1555,7 +1555,7 @@ gld_${EMULATION_NAME}_place_orphan (lang
 	 If the section already exists but does not have any flags set,
 	 then it has been created by the linker, probably as a result of
 	 a --section-start command line switch.  */
-      lang_add_section (&add_child, s, os, file);
+      lang_add_section (&add_child, s, os);
     }
   else
     {
@@ -1641,8 +1641,7 @@ gld_${EMULATION_NAME}_place_orphan (lang
 
       /* All sections in an executable must be aligned to a page boundary.  */
       address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__"));
-      os = lang_insert_orphan (file, s, secname, after, place, address,
-			       &add_child);
+      os = lang_insert_orphan (s, secname, after, place, address, &add_child);
     }
 
   {
@@ -1665,7 +1664,7 @@ gld_${EMULATION_NAME}_place_orphan (lang
 
 	    ls = &(*pl)->input_section;
 
-	    lname = bfd_get_section_name (ls->ifile->the_bfd, ls->section);
+	    lname = bfd_get_section_name (ls->section->owner, ls->section);
 	    if (strchr (lname, '$') == NULL)
 	      {
 		if (found_dollar)
Index: ld/emultempl/ppc64elf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/ppc64elf.em,v
retrieving revision 1.48
diff -u -p -r1.48 ppc64elf.em
--- ld/emultempl/ppc64elf.em	4 Aug 2005 01:19:10 -0000	1.48
+++ ld/emultempl/ppc64elf.em	16 Nov 2005 12:02:33 -0000
@@ -235,7 +235,7 @@ ppc_add_stub_section (const char *stub_s
 
   info.input_section = input_section;
   lang_list_init (&info.add);
-  lang_add_section (&info.add, stub_sec, os, stub_file);
+  lang_add_section (&info.add, stub_sec, os);
 
   if (info.add.head == NULL)
     goto err_ret;
@@ -277,26 +277,33 @@ gld${EMULATION_NAME}_after_allocation (v
 static void
 build_toc_list (lang_statement_union_type *statement)
 {
-  if (statement->header.type == lang_input_section_enum
-      && !statement->input_section.ifile->just_syms_flag
-      && (statement->input_section.section->flags & SEC_EXCLUDE) == 0
-      && statement->input_section.section->output_section == toc_section)
-    ppc64_elf_next_toc_section (&link_info, statement->input_section.section);
+  if (statement->header.type == lang_input_section_enum)
+    {
+      asection *i = statement->input_section.section;
+
+      if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+	  && (i->flags & SEC_EXCLUDE) == 0
+	  && i->output_section == toc_section)
+	ppc64_elf_next_toc_section (&link_info, i);
+    }
 }
 
 
 static void
 build_section_lists (lang_statement_union_type *statement)
 {
-  if (statement->header.type == lang_input_section_enum
-      && !statement->input_section.ifile->just_syms_flag
-      && (statement->input_section.section->flags & SEC_EXCLUDE) == 0
-      && statement->input_section.section->output_section != NULL
-      && statement->input_section.section->output_section->owner == output_bfd)
+  if (statement->header.type == lang_input_section_enum)
     {
-      if (!ppc64_elf_next_input_section (&link_info,
-					 statement->input_section.section))
-	einfo ("%X%P: can not size stub section: %E\n");
+      asection *i = statement->input_section.section;
+
+      if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
+	  && (i->flags & SEC_EXCLUDE) == 0
+	  && i->output_section != NULL
+	  && i->output_section->owner == output_bfd)
+	{
+	  if (!ppc64_elf_next_input_section (&link_info, i))
+	    einfo ("%X%P: can not size stub section: %E\n");
+	}
     }
 }
 
Index: ld/emultempl/xtensaelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/xtensaelf.em,v
retrieving revision 1.9
diff -u -p -r1.9 xtensaelf.em
--- ld/emultempl/xtensaelf.em	12 May 2005 07:32:04 -0000	1.9
+++ ld/emultempl/xtensaelf.em	16 Nov 2005 12:02:34 -0000
@@ -59,13 +59,13 @@ elf_xtensa_choose_target (int argc ATTRI
 
 
 static bfd_boolean
-elf_xtensa_place_orphan (lang_input_statement_type *file, asection *s)
+elf_xtensa_place_orphan (asection *s)
 {
   /* Early exit for relocatable links.  */
   if (link_info.relocatable)
     return FALSE;
 
-  return gld${EMULATION_NAME}_place_orphan (file, s);
+  return gld${EMULATION_NAME}_place_orphan (s);
 }
 
 
@@ -1137,7 +1137,7 @@ ld_build_required_section_dependence (la
 	{
 	  lang_input_section_type *input;
 	  input = &l->input_section;
-	  xtensa_callback_required_dependence (input->ifile->the_bfd,
+	  xtensa_callback_required_dependence (input->section->owner,
 					       input->section,
 					       &link_info,
 					       /* Use the same closure.  */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]