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]

[PATCH] Fix setting of sh_link for SHF_LINK_ORDER sections


When stripping a section with objcopy (like --strip-debug) the sh_link
pointers are not properly set up, because the elf_linked_to_section was
pointing to the input section.  On the other hand, for an output section
the output_section pointer should always point to itself, so following
this link should always do the right thing.  Tested on ia64-suse-linux.

Andreas.

2005-12-07  Andreas Schwab  <schwab@suse.de>

	PR binutils/1991
	* elf.c (assign_section_numbers): Always use the output section
	when setting up sh_link for SHF_LINK_ORDER.

--- bfd/elf.c.~1.318.~	2005-11-03 11:24:25.000000000 +0100
+++ bfd/elf.c	2005-12-07 18:17:02.000000000 +0100
@@ -3074,9 +3074,9 @@ assign_section_numbers (bfd *abfd, struc
 			}
 		      s = kept;
 		    }
-		  s = s->output_section;
-		  BFD_ASSERT (s != NULL);
 		}
+	      s = s->output_section;
+	      BFD_ASSERT (s != NULL);
 	      d->this_hdr.sh_link = elf_section_data (s)->this_idx;
 	    }
 	  else

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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