From 1cafbaf10ee11d9e9eb6c3bd92fd9bcbc29001bf Mon Sep 17 00:00:00 2001 From: Kai Tietz Date: Sat, 9 Apr 2011 16:05:58 +0000 Subject: 2011-04-09 Kai Tietz * peXXigen.c (_bfd_XXi_final_link_postscripte): Sort pdata in temporary buffer and use rawsize for sorting. * coffcode.h (coff_compute_section_file_positions): Set rawsize before doing alignment. --- bfd/peXXigen.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'bfd/peXXigen.c') diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 322c5ea8e4..e5065464c0 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -2458,15 +2458,23 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo) if (sec) { - bfd_size_type x = sec->rawsize ? sec->rawsize : sec->size; + bfd_size_type x = sec->rawsize; + bfd_byte *tmp_data = NULL; - if (x && bfd_get_section_contents (abfd, sec, pfinfo->contents, 0, x)) + if (x) + tmp_data = bfd_malloc (x); + + if (tmp_data != NULL) { - qsort (pfinfo->contents, - (size_t) ((sec->size size : x) / 12), - 12, sort_x64_pdata); - bfd_set_section_contents (pfinfo->output_bfd, sec, - pfinfo->contents, 0, x); + if (bfd_get_section_contents (abfd, sec, tmp_data, 0, x)) + { + qsort (tmp_data, + (size_t) (x / 12), + 12, sort_x64_pdata); + bfd_set_section_contents (pfinfo->output_bfd, sec, + tmp_data, 0, x); + } + free (tmp_data); } } } -- cgit v1.2.1