aboutsummaryrefslogtreecommitdiff
path: root/bfd/peXXigen.c
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2011-04-09 16:06:00 +0000
committerKai Tietz <kai.tietz@onevision.com>2011-04-09 16:06:00 +0000
commit21e68916eff030cf3afb94dbf2e9962ceca25000 (patch)
tree1e6e9fe2a7338d28161ef7b9a3e2986489055ea8 /bfd/peXXigen.c
parentbb95161d33dc43843fd502a4ea7448ff40d7d355 (diff)
downloadgdb-21e68916eff030cf3afb94dbf2e9962ceca25000.zip
gdb-21e68916eff030cf3afb94dbf2e9962ceca25000.tar.gz
gdb-21e68916eff030cf3afb94dbf2e9962ceca25000.tar.bz2
2011-04-09 Kai Tietz <ktietz@redhat.com>
* 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.
Diffstat (limited to 'bfd/peXXigen.c')
-rw-r--r--bfd/peXXigen.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 322c5ea..e506546 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 <x ? sec->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);
}
}
}