From patchwork Thu Feb 23 03:49:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 60775 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp102369wrd; Wed, 22 Feb 2023 19:49:45 -0800 (PST) X-Google-Smtp-Source: AK7set+6EcMQEOTOIvpSjlytpU/ztD5h3aGUpSe65VvlNZnI+iFc8GlILXqbkmnoCmx7lGzBNVNy X-Received: by 2002:a05:6402:5484:b0:4ac:d951:560d with SMTP id fg4-20020a056402548400b004acd951560dmr9946317edb.0.1677124185132; Wed, 22 Feb 2023 19:49:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677124185; cv=none; d=google.com; s=arc-20160816; b=eXGtQODWLVEZxyBDlohqydMx+InvwawIEuA/TBwWwK7uf0xHkzHDlfDh7ls7DxT7hO xjmgLBWLJmTM/qNGg25lQLade09sm+NdUG8AXRUlzyWEg/RhXbJ0YtBBU+EKckQ7CJIz AkmG5x+HTU9tMyr6JsxxVHzTPf/msy24dmo0hS1p3Sa1h4goOrB706hECPokQi0hUy62 M91gv00L7BHwp2cfHShXEhoDAs6Q60LbUSWahkx7mdgCXMkLM7st3MkJzX4Zvbez1M3w 9NEmyBNCVcSHH8BZ/bhevP33uEBD5/uyFVIFijUnyVnHk8IUOBemAr62pPeJbfLxMgGY 111w== 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=LIHvsRHdpuQIOfn3D4bhkd1VMaO6412gAU96iIo/X+k=; b=ih73f6ZXInaus4gmqyzq97UMZsH+AYomnY3Sj/zLsRUoXBToZKmW7hau2hX2lSb8xh xsTVNW1chsD/HcAaXncM1qc7GdR1yZGO0nHRm9Dl5PB2ROALC2zpqKsHEOzHxhyU+oxg jT6x4Ow2+pUWe8KkM3wUwfYl45wXPQ70alc5D8m4czu7mmw/Ukq7pa+VP6qSjsxTVnxj X8j3gIXgtVAwqTEG/Ax/bqPNjeV74HvWDyAKgsyTyP9e97LiKDw5unaIJNIVZlsD1AlP oFDSGpTFwzqEWzdvo0OHI1sU5ITuXYRm2uo4O0s4a/1t4Ettc6YnUc6dGiGh7wOYWsZt QuMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=eIYGvvvr; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id k16-20020aa7c390000000b004ab4bb27f21si6048347edq.435.2023.02.22.19.49.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 19:49:45 -0800 (PST) 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=eIYGvvvr; 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 9FCD13858039 for ; Thu, 23 Feb 2023 03:49:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9FCD13858039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677124182; bh=LIHvsRHdpuQIOfn3D4bhkd1VMaO6412gAU96iIo/X+k=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=eIYGvvvrghPhIrnB+iT2f7bjmKWfBD6iygpuby/2Xr6t5X7R1dljrlQgt1vT2+QUx VSckSBc1tRiv7PhaFDnj95HhR2jg8Pcxg2pE3kOZO3hyJ87T+RQt/81SmoVcKwvNCp T5X152rfiyQk4lqSjiD98UdZ6iST8O2++WEKNoZo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 31EDB3858C5E for ; Thu, 23 Feb 2023 03:49:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 31EDB3858C5E Received: by mail-pl1-x62f.google.com with SMTP id ky4so12528032plb.3 for ; Wed, 22 Feb 2023 19:49:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=LIHvsRHdpuQIOfn3D4bhkd1VMaO6412gAU96iIo/X+k=; b=zidL5yTsqB9oPCnm/GdimGTwuazq0TlzFseULIjn2U7wQzgr5+KQz5KaATzEFuMT5B /aNBqgQbJuwq28bR+0D0j7M8TbKl3Wb707+OLOthNqOIsCFYgzxu57sdvsgFibVSd+ua 7JYJbIgmCxWPHroAXIM13oUC2nj7Sohiu3TUs3fWB+GiIkR1cbTR9805qL4It/UBvxrj edFnCX83R39PnhQG2i40aUOj0N9RJWyZFY5m4/E2CkgOj4HnSk0ov/Bj3WT17Pa11WC5 Wn5rfclopUJODQB3ayBI6oH628AmgWUi9+QvdHm2dOxfkB54FrqyTxVvTKcnrILFuSQg xw8g== X-Gm-Message-State: AO0yUKX2QuGuzGLMYeEFWOflVnJ2Zzw7bByes6Fs4iyvo5C82VLsAYlW 6iaEgKSdSHLdqJO3mqfNSuOFFGGmmuw= X-Received: by 2002:a17:902:e888:b0:19a:95ab:6b2b with SMTP id w8-20020a170902e88800b0019a95ab6b2bmr13805219plg.69.1677124171724; Wed, 22 Feb 2023 19:49:31 -0800 (PST) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:8e1e:cc42:da50:5c93]) by smtp.gmail.com with ESMTPSA id 6-20020a170902c24600b001946a3f4d9csm6376202plg.38.2023.02.22.19.49.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 19:49:31 -0800 (PST) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id BB1361142D15; Thu, 23 Feb 2023 14:19:28 +1030 (ACDT) Date: Thu, 23 Feb 2023 14:19:28 +1030 To: binutils@sourceware.org Subject: Test SEC_HAS_CONTENTS in relax routines Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-3034.8 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 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?1758592169737450704?= X-GMAIL-MSGID: =?utf-8?q?1758592169737450704?= More places that generally expect instructions, so not zeros. * coff-sh.c (sh_relax_section, sh_relax_delete_bytes): Exclude sections without SEC_HAS_CONTENTS set. * elf-m10200.c (mn10200_elf_relax_section): Likewise. * elf32-arc.c (arc_elf_relax_section): Likewise. * elf32-avr.c (elf32_avr_relax_section): Likewise. * elf32-cr16.c (elf32_cr16_relax_section): Likewise. * elf32-crx.c (elf32_crx_relax_section): Likewise. * elf32-epiphany.c (epiphany_elf_relax_section): Likewise. * elf32-ft32.c (ft32_elf_relax_section): Likewise. * elf32-h8300.c (elf32_h8_relax_section): Likewise. * elf32-ip2k.c (ip2k_elf_relax_section): Likewise. * elf32-m32c.c (m32c_elf_relax_section): Likewise. * elf32-m68hc11.c (m68hc11_elf_relax_section): Likewise. * elf32-msp430.c (msp430_elf_relax_section): Likewise. * elf32-pru.c (pru_elf32_relax_section): Likewise. * elf32-rl78.c (rl78_elf_relax_section): Likewise. * elf32-rx.c (elf32_rx_relax_section): Likewise. * elf32-sh.c (sh_elf_relax_section): Likewise. (sh_elf_relax_delete_bytes): Likewise. * elf32-v850.c (v850_elf_relax_section): Likewise. * elf64-alpha.c (elf64_alpha_relax_section): Likewise. * elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise. * elfnn-ia64.c (elfNN_ia64_relax_section): Likewise. * elfnn-riscv.c (_bfd_riscv_relax_section): Likewise. * elfxx-mips.c (_bfd_mips_elf_relax_section): Likewise. diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index 314b796ac8b..50e9043993b 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -717,6 +717,7 @@ sh_relax_section (bfd *abfd, *again = false; if (bfd_link_relocatable (link_info) + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) return true; @@ -1364,6 +1365,7 @@ sh_relax_delete_bytes (bfd *abfd, bfd_byte *ocontents; if (o == sec + || (o->flags & SEC_HAS_CONTENTS) == 0 || (o->flags & SEC_RELOC) == 0 || o->reloc_count == 0) continue; diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index 24be1cb4d20..d7376cb2cf6 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -577,8 +577,9 @@ mn10200_elf_relax_section (bfd *abfd, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index c5331ed8a61..78dfd6eebbd 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -2972,8 +2972,9 @@ arc_elf_relax_section (bfd *abfd, asection *sec, section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index c01355ac5b7..702719136d0 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -2522,8 +2522,9 @@ elf32_avr_relax_section (bfd *abfd, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 32507dabe3f..caaf3bdbfe0 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -1718,8 +1718,9 @@ elf32_cr16_relax_section (bfd *abfd, asection *sec, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c index f041e4828ef..811440d124a 100644 --- a/bfd/elf32-crx.c +++ b/bfd/elf32-crx.c @@ -973,8 +973,9 @@ elf32_crx_relax_section (bfd *abfd, asection *sec, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-epiphany.c b/bfd/elf32-epiphany.c index f05ef1497fa..da874dadd0b 100644 --- a/bfd/elf32-epiphany.c +++ b/bfd/elf32-epiphany.c @@ -213,8 +213,9 @@ epiphany_elf_relax_section (bfd *abfd, asection *sec, if this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-ft32.c b/bfd/elf32-ft32.c index 07036b3b140..ce4946aef27 100644 --- a/bfd/elf32-ft32.c +++ b/bfd/elf32-ft32.c @@ -1092,8 +1092,9 @@ ft32_elf_relax_section (bfd *abfd, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index f08ab3f52ed..3039b824fa5 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -706,8 +706,9 @@ elf32_h8_relax_section (bfd *abfd, asection *sec, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index 5f63d910c4d..cb1ab0e12e5 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -1096,8 +1096,9 @@ ip2k_elf_relax_section (bfd *abfd, if this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index e9308ff8684..129d6a92c02 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -1459,8 +1459,9 @@ m32c_elf_relax_section (bfd *abfd, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c index 11a58f02298..67a8dad0965 100644 --- a/bfd/elf32-m68hc11.c +++ b/bfd/elf32-m68hc11.c @@ -709,8 +709,9 @@ m68hc11_elf_relax_section (bfd *abfd, asection *sec, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index 4475bafe8c2..e77ca392fe3 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -2014,8 +2014,10 @@ msp430_elf_relax_section (bfd * abfd, asection * sec, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0) + || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 + || (sec->flags & SEC_CODE) == 0) return true; if (debug_relocs) diff --git a/bfd/elf32-pru.c b/bfd/elf32-pru.c index d7bbbe18830..2bb4cb7a8cd 100644 --- a/bfd/elf32-pru.c +++ b/bfd/elf32-pru.c @@ -1354,8 +1354,10 @@ pru_elf32_relax_section (bfd *abfd, asection *sec, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0 || (sec->flags & SEC_CODE) == 0) + || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 + || (sec->flags & SEC_CODE) == 0) return true; symtab_hdr = & elf_tdata (abfd)->symtab_hdr; diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index 6adc495115f..c7a94f2a280 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -2106,8 +2106,9 @@ rl78_elf_relax_section (bfd *abfd, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index e3dde13fea4..d14c23831bd 100644 --- a/bfd/elf32-rx.c +++ b/bfd/elf32-rx.c @@ -2038,8 +2038,9 @@ elf32_rx_relax_section (bfd *abfd, this section does not have relocs, or if this is not a code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true; diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 246f9f56188..fdcc5870890 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -468,6 +468,7 @@ sh_elf_relax_section (bfd *abfd, asection *sec, *again = false; if (bfd_link_relocatable (link_info) + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) return true; @@ -1154,6 +1155,7 @@ sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, bfd_byte *ocontents; if (o == sec + || (o->flags & SEC_HAS_CONTENTS) == 0 || (o->flags & SEC_RELOC) == 0 || o->reloc_count == 0) continue; diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 681526c20c9..4ce54990e30 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -3440,6 +3440,7 @@ v850_elf_relax_section (bfd *abfd, *again = false; if (bfd_link_relocatable (link_info) + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0) return true; diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 875bf69519a..81d58c8cbc1 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -3726,8 +3726,8 @@ elf64_alpha_relax_section (bfd *abfd, asection *sec, *again = false; if (bfd_link_relocatable (link_info) - || ((sec->flags & (SEC_CODE | SEC_RELOC | SEC_ALLOC)) - != (SEC_CODE | SEC_RELOC | SEC_ALLOC)) + || ((sec->flags & (SEC_CODE | SEC_RELOC | SEC_ALLOC | SEC_HAS_CONTENTS)) + != (SEC_CODE | SEC_RELOC | SEC_ALLOC | SEC_HAS_CONTENTS)) || sec->reloc_count == 0) return true; diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index 9fb1a93bf67..1866a5798fa 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -370,8 +370,9 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec, /* Nothing to do if there are no relocations or there is no need for the current pass. */ - if ((sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0 + if (sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (link_info->relax_pass == 0 && sec->skip_relax_pass_0) || (link_info->relax_pass == 1 && sec->skip_relax_pass_1)) return true; diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index c1f49bd07d6..a2d60e7e67f 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -370,8 +370,9 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec, /* Nothing to do if there are no relocations or there is no need for the current pass. */ - if ((sec->flags & SEC_RELOC) == 0 - || sec->reloc_count == 0 + if (sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (link_info->relax_pass == 0 && sec->skip_relax_pass_0) || (link_info->relax_pass == 1 && sec->skip_relax_pass_1)) return true; diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index c2604de0050..355ddb22566 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -4776,8 +4776,9 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec, if (bfd_link_relocatable (info) || sec->sec_flg0 - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (info->disable_target_specific_optimizations && info->relax_pass == 0) /* The exp_seg_relro_adjust is enum phase_enum (0x4), diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 5b66cb81c1b..74a4d0d382b 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -13975,8 +13975,9 @@ _bfd_mips_elf_relax_section (bfd *abfd, asection *sec, code section. */ if (bfd_link_relocatable (link_info) - || (sec->flags & SEC_RELOC) == 0 || sec->reloc_count == 0 + || (sec->flags & SEC_RELOC) == 0 + || (sec->flags & SEC_HAS_CONTENTS) == 0 || (sec->flags & SEC_CODE) == 0) return true;