From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54572 invoked by alias); 16 Feb 2020 10:00:38 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 49278 invoked by uid 89); 16 Feb 2020 10:00:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.15.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 16 Feb 2020 10:00:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1581847229; bh=3YfYSRb2BztoWX0DePVKVSzqLPSAZHRgmQQL+5SnWrA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=g5Jx+BnDM8hqz3Eh84E9lV7L3EwFKXlnn/4UVTtF4Fx1MvkXYS5guPYTkR00DKrCN 9k/l3A7mHFJg2wZHTwLvE4iEFEcLCNwDCIyB7rYYqRo5PTvX0aAReZ1SckjJ0KCcYA UqaYnjGMWeDQjq8jPMRl9q0DDApZufjH8dmMOuyw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from zbook-opensuse.wgnetz.xx ([77.7.44.64]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MCbEf-1jCNOZ3ygV-009ebk; Sun, 16 Feb 2020 11:00:29 +0100 From: Christian Eggers To: binutils@sourceware.org Cc: Christian Eggers Subject: [PATCH] objcopy: Fix for pr19005 on machines for more than one octet per byte. Date: Sun, 16 Feb 2020 10:00:00 -0000 Message-Id: <20200216100022.14813-1-ceggers@gmx.de> Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00381.txt.bz2 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 --- 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_in= fo_type *input_arch) for (i =3D 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 =3D bfd_octets_per_byte (obfd, osections[i]); + unsigned int opb2 =3D bfd_octets_per_byte (obfd, osections[i+1]); flags =3D bfd_section_flags (osections[i]); if ((flags & SEC_HAS_CONTENTS) =3D=3D 0 @@ -3110,8 +3112,8 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_inf= o_type *input_arch) continue; size =3D bfd_section_size (osections[i]); - gap_start =3D bfd_section_lma (osections[i]) + size; - gap_stop =3D bfd_section_lma (osections[i + 1]); + gap_start =3D bfd_section_lma (osections[i]) * opb1 + size; + gap_stop =3D bfd_section_lma (osections[i + 1]) * opb2; if (gap_start < gap_stop) { if (!bfd_set_section_size (osections[i], -- 2.16.4