This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix stripping of objects where empty sections preceede.dynamic


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]