From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id A8FAD3858C50; Fri, 2 Jun 2023 00:12:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8FAD3858C50 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Minor objcopy optimisation for copy_relocations_in_section X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: cf6522cb2f6ef5f278fe700699b80d0433324ab3 X-Git-Newrev: 56e4ccc924d47c30e7446efe771397d2de141762 Message-Id: <20230602001209.A8FAD3858C50@sourceware.org> Date: Fri, 2 Jun 2023 00:12:09 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jun 2023 00:12:09 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D56e4ccc924d4= 7c30e7446efe771397d2de141762 commit 56e4ccc924d47c30e7446efe771397d2de141762 Author: Alan Modra Date: Thu Jun 1 17:00:53 2023 +0930 Minor objcopy optimisation for copy_relocations_in_section =20 * objcopy (copy_relocations_in_section): Don't read the relocs for STRIP_ALL if keep_specific_htab is empty. Diff: --- binutils/objcopy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 49d54bff9b2..ac40da87018 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -4343,6 +4343,8 @@ copy_relocations_in_section (bfd *ibfd, sec_ptr isect= ion, void *obfdarg) /* Core files and DWO files do not need to be relocated. */ if (bfd_get_format (obfd) =3D=3D bfd_core || strip_symbols =3D=3D STRIP_NONDWO + || (strip_symbols =3D=3D STRIP_ALL + && htab_elements (keep_specific_htab) =3D=3D 0) || discard_relocations (ibfd, isection)) relsize =3D 0; else