diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-09-29 09:35:47 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-09-29 13:31:57 -0700 |
commit | cbd44e247ede49688e1e1fa42e57d390ad141967 (patch) | |
tree | 7296da5e95dea5f24228fc3499a8ffc84c861b3e /bfd | |
parent | 0bcf3dd6905d67936815411b42dab6fd4c47b4db (diff) | |
download | gdb-cbd44e247ede49688e1e1fa42e57d390ad141967.zip gdb-cbd44e247ede49688e1e1fa42e57d390ad141967.tar.gz gdb-cbd44e247ede49688e1e1fa42e57d390ad141967.tar.bz2 |
Don't use the output section size to copy input section
We can't use the output section size to copy input section since
--interleave will shrink the output section. Instead, we change
bfd_convert_section_contents to return the updated input section
size. When we do that, we don't need to adjust the output section
size to skip gap fills.
bfd/
PR binutils/19020
* bfd.c (bfd_convert_section_contents): Add ptr_size parameter.
* bfd-in2.h: Regenerated.
binutils/
PR binutils/19020
* objcopy.c (copy_object): Don't adjust the output section size
when copying from input sections.
(copy_section): Use input section size for the copy. Get the
updated section size from bfd_convert_section_contents.
binutils/testsuite/
PR binutils/19020
* binutils-all/objcopy.exp: Run pr19020a and pr19020b.
* lib/utils-lib.exp (run_dump_test): Support binary input.
* binutils-all/pr19020.in: New file.
* binutils-all/pr19020a.d: Likewise.
* binutils-all/pr19020b.d: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 3 | ||||
-rw-r--r-- | bfd/bfd.c | 8 |
3 files changed, 14 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d8068c4..bcbe0e1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2015-09-29 Andrew Stubbs <ams@codesourcery.com> + H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/19020 + * bfd.c (bfd_convert_section_contents): Add ptr_size parameter. + * bfd-in2.h: Regenerated. + 2015-08-11 Peter Zotov <whitequark@whitequark.org> PR ld/18759 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index f06d76e..0d096f9 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -6933,7 +6933,8 @@ bfd_size_type bfd_convert_section_size (bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size); bfd_boolean bfd_convert_section_contents - (bfd *ibfd, asection *isec, bfd *obfd, bfd_byte **ptr); + (bfd *ibfd, asection *isec, bfd *obfd, + bfd_byte **ptr, bfd_size_type *ptr_size); /* Extracted from archive.c. */ symindex bfd_get_next_mapent @@ -2165,19 +2165,20 @@ FUNCTION SYNOPSIS bfd_boolean bfd_convert_section_contents - (bfd *ibfd, asection *isec, bfd *obfd, bfd_byte **ptr); + (bfd *ibfd, asection *isec, bfd *obfd, + bfd_byte **ptr, bfd_size_type *ptr_size); DESCRIPTION Convert the contents, stored in @var{*ptr}, of the section @var{isec} in input BFD @var{ibfd} to output BFD @var{obfd} if needed. The original buffer pointed to by @var{*ptr} may be freed and @var{*ptr} is returned with memory malloc'd by this - function. + function, and the new size written to @var{ptr_size}. */ bfd_boolean bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd, - bfd_byte **ptr) + bfd_byte **ptr, bfd_size_type *ptr_size) { bfd_byte *contents; bfd_size_type ihdr_size, ohdr_size, size; @@ -2264,5 +2265,6 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd, *ptr = contents; } + *ptr_size = size; return TRUE; } |