Bug fix for gldelf_i386_place_orphan in elf32.em [version 2.20.1]
Sheng, Yongjie
yongjie.sheng@intel.com
Wed Jan 12 07:01:00 GMT 2011
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
More information about the Binutils
mailing list