[PATCH] Fix stripping of objects where empty sections preceede .dynamic
Nick Clifton
nickc@redhat.com
Wed Jan 5 13:23:00 GMT 2005
Hi Jakub,
> The following patch cures this. I didn't want to hardcode .dynamic section
> name always, so the test just puts into the segment all non-empty sections
> that fall into PT_DYNAMIC's bounds. Not sure if it is possible to create
> empty PT_DYNAMIC, so just in case it also adds .dynamic section by name
> if it is empty.
>
> Ok?
Approved, but ...
> + && (segment->p_type != PT_DYNAMIC \
> + || SECTION_SIZE (section, segment) \
> + || !strcmp (bfd_get_section_name (ibfd, section), ".dynamic")) \
Personally I would suggest that the second test should be:
|| SECTION_SIZE (section, segment) > 0
Just to make it clear that this is a test for non-empty sections.
Also I prefer strcmp()'s that explicitly test their result, rather than
converting a trinary value into a boolean one. ie:
|| strcmp (bfd_get_section_name (ibfd, section), ".dynamic") != 0)
In fact I much prefer using an alias called "streq" which makes the code
easier to read, but that would involve changing lots of source files... :-)
Cheers
Nick
More information about the Binutils
mailing list