This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Bug fix for gldelf_i386_place_orphan in elf32.em [version 2.20.1]
- From: "Sheng, Yongjie" <yongjie dot sheng at intel dot com>
- To: "binutils at sources dot redhat dot com" <binutils at sources dot redhat dot com>
- Date: Wed, 12 Jan 2011 15:01:15 +0800
- Subject: Bug fix for gldelf_i386_place_orphan in elf32.em [version 2.20.1]
Dear Binutils maintainer,
I caught a bug in function gldelf_i386_place_orphan, and a patch is attached at below.
My point on the patch:
for (; lookup != NULL; lookup = lookup->next)
if ((lookup->bfd_section != NULL
&& (lookup->bfd_section->flags & SEC_DEBUGGING) != 0)
|| strcmp (lookup->name, ".comment") == 0)
break;
[Yongjie] The above for loop tries to find a ".comment" or a debug section.
hold[orphan_nonalloc].os = lookup ? lookup->prev : NULL;
hold[orphan_nonalloc].name = ".comment";
[Yongjie] The above code set the hold[orphan_nonalloc] name as ".comment", but os as lookup->prev. It should be lookup itself, right?
Please help to evaluate the patch. Thanks.
Below is the patch
--- elf32.orig.em 2011-01-12 18:16:15.767198643 +0800
+++ elf32.em 2011-01-12 18:16:56.556586465 +0800
@@ -1772,7 +1772,7 @@
&& (lookup->bfd_section->flags & SEC_DEBUGGING) != 0)
|| strcmp (lookup->name, ".comment") == 0)
break;
- hold[orphan_nonalloc].os = lookup ? lookup->prev : NULL;
+ hold[orphan_nonalloc].os = lookup; /* ? lookup->prev : NULL;*/
hold[orphan_nonalloc].name = ".comment";
orphan_init_done = 1;
}
Yours sincerely,
Sheng, Yongjie (Sam)
Digital Home Group
Intel Asia-Pacific Research & Development Ltd.
Telephone: +86-21-61166516/61167853
i-net: 8821-6516/8821-7853