This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch x64 SEH]: Sort pdata section ascending
> +#if !defined(COFF_WITH_pep) && defined(COFF_WITH_pex64)
> + asection *sec;
> +#endif
>
...
> +/* If there is a .pdata section and we have linked pdata finally, we
> + need to sort the entries ascending. */
> +#if !defined(COFF_WITH_pep) && defined(COFF_WITH_pex64)
> + sec = bfd_get_section_by_name (abfd, ".pdata");
> + if (sec)
It's better to merge this into the ifdef code block below.
I.e.
#if foo
{
asection *sec;
sec = bfd_get...
}
#endif
Watch your indentation; it's incorrect for both the comment
and the code. Although the code indentation will be correct
once you wrap the new { } around it.
> + bfd_size_type x = sec->rawsize ? sec->rawsize : sec->size;
...
> + qsort (contents, (size_t) ((sec->size <x ? sec->size : x) / 12), 12, sort_x64_pdata);
I wonder if some sort of error/warning should be generated
for section size incorrect. When is rawsize != size here?
> + if (!x || !bfd_get_section_contents (abfd, sec, pfinfo->contents, 0, x))
...
> + if (contents && x != 0)
Merge this into a single IF statement.
r~