This is the mail archive of the binutils@sourceware.cygnus.com 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]

Re: powerpc-eabi linker crash w/linked binary data



On 20 Feb 2000, Ian Lance Taylor wrote:

>    From: jtc@redback.com (J.T. Conklin)
>    Date: 19 Feb 2000 16:01:00 -0800
> 
>    What's the right approach to fix this problem.  Should this loop skip
>    non ELF input BFDs?
> 
> Yes.  Any loop over all input BFDs or all input sections has to check
> the flavour.  By searching for input_bfds in elflink.h, I think there
> are several spots in the gc code which need to be fixed up.

These ones.

	* elflink.h (elf_gc_sweep, elf_gc_sections,
	elf_gc_common_finalize_got_offsets): Skip non-elf input bfds.

--- bfd/elflink.h~	Fri Feb 18 21:42:57 2000
+++ bfd/elflink.h	Sun Feb 20 17:13:50 2000
@@ -6202,6 +6202,9 @@ elf_gc_sweep (info, gc_sweep_hook)
     {
       asection *o;
 
+      if (sub->xvec->flavour != bfd_target_elf_flavour)
+	continue;
+
       for (o = sub->sections; o != NULL; o = o->next)
 	{
 	  /* Keep special sections.  Keep .debug sections.  */
@@ -6416,6 +6419,10 @@ elf_gc_sections (abfd, info)
   for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
     {
       asection *o;
+
+      if (sub->xvec->flavour != bfd_target_elf_flavour)
+	continue;
+
       for (o = sub->sections; o != NULL; o = o->next)
 	{
 	  if (o->flags & SEC_KEEP)
@@ -6571,10 +6578,14 @@ elf_gc_common_finalize_got_offsets (abfd
   /* Do the local .got entries first.  */
   for (i = info->input_bfds; i; i = i->link_next)
     {
-      bfd_signed_vma *local_got = elf_local_got_refcounts (i);
+      bfd_signed_vma *local_got;
       bfd_size_type j, locsymcount;
       Elf_Internal_Shdr *symtab_hdr;
 
+      if (i->xvec->flavour != bfd_target_elf_flavour)
+	continue;
+
+      local_got = elf_local_got_refcounts (i);
       if (!local_got)
 	continue;
 


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