public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Properly handle zero group count
@ 2005-04-16 22:06 H. J. Lu
  2005-04-18  2:27 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: H. J. Lu @ 2005-04-16 22:06 UTC (permalink / raw)
  To: binutils

objcopy may create a .o file with SHF_GROUP sections without section
group. objdump will fail to work on the bad .o file. This patch fixes
the bug in setup_group to properly handle zero group count.


H.J.
----
2005-04-16  H.J. Lu  <hongjiu.lu@intel.com>

	PR 855
	* elf.c (setup_group): Properly handle zero group count.

--- bfd/elf.c.bad	2005-04-16 15:00:57.000000000 -0700
+++ bfd/elf.c	2005-04-16 14:55:12.000000000 -0700
@@ -481,14 +481,18 @@ setup_group (bfd *abfd, Elf_Internal_Shd
 	}
 
       if (num_group == 0)
-	num_group = (unsigned) -1;
-      elf_tdata (abfd)->num_group = num_group;
-
-      if (num_group > 0)
+	{
+	  num_group = (unsigned) -1;
+	  elf_tdata (abfd)->num_group = num_group;
+	}
+      else
 	{
 	  /* We keep a list of elf section headers for group sections,
 	     so we can find them quickly.  */
-	  bfd_size_type amt = num_group * sizeof (Elf_Internal_Shdr *);
+	  bfd_size_type amt;
+	  
+	  elf_tdata (abfd)->num_group = num_group;
+	  amt = num_group * sizeof (Elf_Internal_Shdr *);
 	  elf_tdata (abfd)->group_sect_ptr = bfd_alloc (abfd, amt);
 	  if (elf_tdata (abfd)->group_sect_ptr == NULL)
 	    return FALSE;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: Properly handle zero group count
  2005-04-16 22:06 PATCH: Properly handle zero group count H. J. Lu
@ 2005-04-18  2:27 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2005-04-18  2:27 UTC (permalink / raw)
  To: H. J. Lu; +Cc: binutils

On Sat, Apr 16, 2005 at 03:06:33PM -0700, H. J. Lu wrote:
> 	PR 855
> 	* elf.c (setup_group): Properly handle zero group count.

OK.  Thanks!

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-18  2:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-16 22:06 PATCH: Properly handle zero group count H. J. Lu
2005-04-18  2:27 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).