From patchwork Fri Jun 2 00:00:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 102244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp689843vqr; Thu, 1 Jun 2023 17:00:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4BWcxZQVpz5eFedLpxcKCo6gJPnEAeRn9UzdnzmzvGYsrIEw6N2VqHKQ2TweMrH2bgxpnX X-Received: by 2002:a05:6402:2551:b0:514:a21b:f137 with SMTP id l17-20020a056402255100b00514a21bf137mr1356825edb.6.1685664037191; Thu, 01 Jun 2023 17:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685664037; cv=none; d=google.com; s=arc-20160816; b=SO++K5zUgSemIw7S6iGVMUfcrkPEQKg793KpY1frTB1h061YtHl2T8fqhhLcbVzjMF x12VQKXs5qyT4FUnLyCP3EQz8uu8cI2bbe+bHJVujcQ1kOnom/2PBmgTFz6vvR7n5t5E 96AWy2HtlJOrw64SKjWpYCkaFYZJDKof5LrHKs7Hi/MtAcUVgjh5HhXk4hPeqPFF444r Gca6v34bFGA/9DoIIg9sz1aU0Xs8np+PaFgQI2vnWkX+aeJEP5tgjC3AmNHEW1Ru/qYJ WGehUwuHaHCmD6TfhxQASOcBKZsE6p04isVVS8Xi/a2u344+q5ArFYX7HUWI5gOS5y1e lxpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=LYGCDmD+tKhEPcqEtBIyvzZYsKYpZBmZfYx2WhSW7zk=; b=ThPeLgsk9NFE02ywMvBk/IE9ng0zQ0kXmujDeKelzv5XVVsvQQuFgy32JKpfafNqAd /9tP6KLtqbMh7Mbv1jRT9NzB4id/4DG5dOJqc9TB7S6MwnLWtEp6ihbHMROq4zMrvwIV 7aifrVA2uG6NzY45NRmiZE/uSBKGyyOIQR6PRof59bXktTTA2hX1fzMke5t1/tLsmLPB rR7VP7tiHw4UIggHJ/4Q+kEAIb+1taUxExiA1quWkqUKNn7jVHaRmUqA4+8gTi3hbqL1 OH3bzITwExI7Vho3Ot3JuQBNNNSXusujf8EPbhjyjHex9+j7B1dVh3aWRJdx6/4yvJUY TXYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=bHhPsiti; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d6-20020a50ea86000000b00516325fd5b4si35064edo.114.2023.06.01.17.00.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 17:00:37 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=bHhPsiti; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B04043858C2C for ; Fri, 2 Jun 2023 00:00:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B04043858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1685664035; bh=LYGCDmD+tKhEPcqEtBIyvzZYsKYpZBmZfYx2WhSW7zk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=bHhPsitiwC4KMwsLg3f39GbQQfqEBcYQEY6c/p7d7Kx6yEFtBT16fJ9aJn/NzndQ9 eFh754BS76G4Ak56Hyl2JVb+mjh7dYT/BCqdOi/Xd7qbk85V24PN+q7MAqZzbtyPbJ 3BYA5n0GVpul+Jpod9vXy1URk+3gmGEb8MdGYdkQ= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id F3B7C3858C50 for ; Fri, 2 Jun 2023 00:00:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F3B7C3858C50 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1b02085bf8dso8465105ad.0 for ; Thu, 01 Jun 2023 17:00:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685664018; x=1688256018; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LYGCDmD+tKhEPcqEtBIyvzZYsKYpZBmZfYx2WhSW7zk=; b=kse+LkIO2dNNK1VQOf8vjbCgEXTq/y4eJzxK/Kj4+dDMeuv2XX3zd27shIy02dtq99 8no1Mw4vnNzYj2AF4Tt3+68j6997xJoUe6y4pQyMVfsHzydcFzdwuhQsTops66sAlw+8 NFZR8UMFEHvUWOzwd1hQuN9Z7fcnw3q2epqkKFMkh3HSs5DzIv9I1XII5W9UCmpj2ect 3qyAuJ5/lek8Dnh5gwvYx/rV2ZQHsZwtHDYnjGh44rDHJGdaoYuVRuPJzdc8t1eUnfTT 7ucBXlJ/xPod43x4560WZsxxJxGQ/KtdX9XRYRQpMelLQjuydWivylmQSElB9yl2QMdP jCHA== X-Gm-Message-State: AC+VfDwnzdaLs3IqD/I+fpgbAeLXjfEr/kb6FB3Wsxc3UbMLuE18z3Xf B9ucq+/WhEvoPGkvyzIaHl4vgfIbGo0= X-Received: by 2002:a17:902:c703:b0:1b0:4baa:ba92 with SMTP id p3-20020a170902c70300b001b04baaba92mr742005plp.1.1685664018206; Thu, 01 Jun 2023 17:00:18 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id u9-20020a170902e80900b001ab0669d84csm4106594plg.26.2023.06.01.17.00.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 17:00:17 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id DF5561140913; Fri, 2 Jun 2023 09:30:13 +0930 (ACST) Date: Fri, 2 Jun 2023 09:30:13 +0930 To: binutils@sourceware.org Subject: Minor objcopy optimisation for copy_relocations_in_section Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3034.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alan Modra via Binutils From: Alan Modra Reply-To: Alan Modra Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767546853516401538?= X-GMAIL-MSGID: =?utf-8?q?1767546853516401538?= * objcopy (copy_relocations_in_section): Don't read the relocs for STRIP_ALL if keep_specific_htab is empty. 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 isection, void *obfdarg) /* Core files and DWO files do not need to be relocated. */ if (bfd_get_format (obfd) == bfd_core || strip_symbols == STRIP_NONDWO + || (strip_symbols == STRIP_ALL + && htab_elements (keep_specific_htab) == 0) || discard_relocations (ibfd, isection)) relsize = 0; else