This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: Fix for elf_getdata/elf_flagdata on empty section
- From: Roland McGrath <roland at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Mon, 05 Apr 2010 23:52:37 -0700
- Subject: Re: Fix for elf_getdata/elf_flagdata on empty section
> ... sits on the branch "pmachata/576283", commits b6b942 and 3fdd54
> (testcase and fix).
>
> The problem appears ta be that the backlink from data to section,
> data.s, is not initialized for bitless sections (NODATA or zero size).
> The link should be initialized in convert_data, but that's not called
> for these sections.
The fix is good. Thanks for tracking that down.
I just have a few nits about the test.
We don't have any other tests named for bug numbers, so let's not start
that now. Give it a meaningful name like bug-flagdata-nobits.
+int
+main (__attribute__ ((unused)) int argc,
+ __attribute__ ((unused)) char **argv)
main can just take (void) instead when they are unused.
(Those two prototypes are both kosher in ISO C.)
+ int fd = open64 ("/proc/self/exe", O_RDONLY);
Bletch. I don't like either relying on Linux /proc magic here, or assuming
that the binary will tickle the case. Of the many existing test files,
some have a SHT_NOBITS section and so should tickle the bug. So just pick
one and do a run-bug-flagdata-nobits.sh that uses it.
When you've cleaned up those nits with the test, please push both changes
to master.
Thanks,
Roland