From: Christian Eggers <ceggers@gmx.de>
To: binutils@sourceware.org
Cc: Christian Eggers <ceggers@gmx.de>
Subject: [PATCH] objcopy: Fix for pr19005 on machines for more than one octet per byte.
Date: Sun, 16 Feb 2020 10:00:00 -0000 [thread overview]
Message-ID: <20200216100022.14813-1-ceggers@gmx.de> (raw)
On machines with more than one octet per byte, objcopy fills only a part
of the gap between sections.
* objcopy.c (copy_object): Convert from bytes to octets for
--gap-fill.
Signed-off-by: Christian Eggers <ceggers@gmx.de>
---
binutils/objcopy.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index fd94d63773e..f8ca0843937 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3101,8 +3101,10 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
for (i = 0; i < c - 1; i++)
{
flagword flags;
- bfd_size_type size;
- bfd_vma gap_start, gap_stop;
+ bfd_size_type size; /* octets */
+ bfd_vma gap_start, gap_stop; /* octets */
+ unsigned int opb1 = bfd_octets_per_byte (obfd, osections[i]);
+ unsigned int opb2 = bfd_octets_per_byte (obfd, osections[i+1]);
flags = bfd_section_flags (osections[i]);
if ((flags & SEC_HAS_CONTENTS) == 0
@@ -3110,8 +3112,8 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
continue;
size = bfd_section_size (osections[i]);
- gap_start = bfd_section_lma (osections[i]) + size;
- gap_stop = bfd_section_lma (osections[i + 1]);
+ gap_start = bfd_section_lma (osections[i]) * opb1 + size;
+ gap_stop = bfd_section_lma (osections[i + 1]) * opb2;
if (gap_start < gap_stop)
{
if (!bfd_set_section_size (osections[i],
--
2.16.4
next reply other threads:[~2020-02-16 10:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-16 10:00 Christian Eggers [this message]
2020-02-19 9:30 ` Alan Modra
2020-03-02 21:08 ` Christian Eggers
2020-03-04 1:18 ` Alan Modra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200216100022.14813-1-ceggers@gmx.de \
--to=ceggers@gmx.de \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).