diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2011-04-09 16:06:00 +0000 |
---|---|---|
committer | Kai Tietz <kai.tietz@onevision.com> | 2011-04-09 16:06:00 +0000 |
commit | 21e68916eff030cf3afb94dbf2e9962ceca25000 (patch) | |
tree | 1e6e9fe2a7338d28161ef7b9a3e2986489055ea8 | |
parent | bb95161d33dc43843fd502a4ea7448ff40d7d355 (diff) | |
download | gdb-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.
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/coffcode.h | 4 | ||||
-rw-r--r-- | bfd/libbfd.h | 2 | ||||
-rw-r--r-- | bfd/peXXigen.c | 22 |
4 files changed, 26 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a724277..5c29370 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +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. + 2011-04-09 H.J. Lu <hongjiu.lu@intel.com> * elf32-i386.c (elf_i386_relocate_section): Return relocation diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 6ee3db9..9db86b5 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -3297,6 +3297,8 @@ coff_compute_section_file_positions (bfd * abfd) if (!(current->flags & SEC_HAS_CONTENTS)) continue; + current->rawsize = current->size; + #ifdef COFF_IMAGE_WITH_PE /* Make sure we skip empty sections in a PE image. */ if (current->size == 0) @@ -3363,7 +3365,7 @@ coff_compute_section_file_positions (bfd * abfd) #ifdef COFF_IMAGE_WITH_PE /* Set the padded size. */ - current->size = (current->size + page_size -1) & -page_size; + current->size = (current->size + page_size - 1) & -page_size; #endif sofar += current->size; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 2e7df4f..e171771 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -2289,7 +2289,7 @@ bfd_boolean bfd_generic_merge_sections bfd_byte *bfd_generic_get_relocated_section_contents (bfd *abfd, - struct bfd_link_info *link_info, + struct bfd_link_info *alink_info, struct bfd_link_order *link_order, bfd_byte *data, bfd_boolean relocatable, 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); } } } |