From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id 48D53385828B for ; Fri, 23 Sep 2022 02:26:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 48D53385828B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1031.google.com with SMTP id fv3so11649411pjb.0 for ; Thu, 22 Sep 2022 19:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date; bh=bX0lv+fippi835M7qPFwbQV2baZJknTjcc8GSMpM0uk=; b=iK4NxtklAZKYvEXuQ96YccRJKWFN5lk6/tp5iarx2SHqSsTfGhNtAhYr9/WBj66zqe CDrgRvHIX7Eft5kXRQ4keH/EP8XcCmJn1Lt3A8OUrqDmNjtOoSlk3/Lbxmq2CQ7J50NU mHhd+Laq1ckOHwBfVKuOx58r+JSIaWmlNy8EcyHVDjos9FyWRmk447WhAcg61chJIrXi U+KMP5qRJdKoyPLtkQ3XYr6BLJ4HhhDBOl+SOlixU3HM8do4Y20uiQXLgxSYZJOF8ZTz 7JNtEmsKHRZtkNRxNyBgguVFaX0DOg/UfVboGw5mGWAb9aPItyOW5WDcxRWw+ECZ4CPh YTQQ== 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; bh=bX0lv+fippi835M7qPFwbQV2baZJknTjcc8GSMpM0uk=; b=zVekh54dYF1BIzb1Y2f6VLW2BVJwaCKi3VH+X0OAuJ2EBUcAZK5Tkpibiv4UEw7RrO I4T3OyRiv0iK7SZNnQWTYsmfjl6bfrQU9xBxneSml5bfqgqni88lsJXDXaeu6qwb3OGP hJ3FGS9GPN4BE2G0XCoTN/at0BOLA3twF+zsUyOX+qs6qURYxACt+FCik9xzrXDTZ32w 3YiDCwdb5v/ZT3AqtTSr/EoA4jy7UEvGl/aYP4oKPWdI49H27EbG1ezGu0LRJ2LhWJfw cCvARYIBrhxnvSHRPK5O+R9Iuv927FxfYzY42zzUWbJ/gn4hfx48eNUzic53fynO1f9x n48A== X-Gm-Message-State: ACrzQf3uqrldbHLElG0ySP9k/cg+5EvmdsZIEQd8Z0BnDZTPrqiAqQCG 7ByBJTLcAPyqejReiellmP9XpakOYyw+uA== X-Google-Smtp-Source: AMsMyM6C6fWlnd9LwjBQfVrROr1C5ALAZyPzaMVk/scZZdz3Xw9j4SOafztuKaLMUUIlxyc6b123LA== X-Received: by 2002:a17:90a:8909:b0:203:ab27:a41 with SMTP id u9-20020a17090a890900b00203ab270a41mr7134290pjn.163.1663900002658; Thu, 22 Sep 2022 19:26:42 -0700 (PDT) Received: from squeak.grove.modra.org ([2406:3400:51d:8cc0:a2a5:cd86:29b6:c74]) by smtp.gmail.com with ESMTPSA id a21-20020aa794b5000000b00537a8d2c2easm5076778pfl.80.2022.09.22.19.26.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 19:26:42 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 64A7E1141251; Fri, 23 Sep 2022 11:56:39 +0930 (ACST) Date: Fri, 23 Sep 2022 11:56:39 +0930 From: Alan Modra To: binutils@sourceware.org Subject: Don't attempt to compress bss sections Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3035.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 List-Id: It doesn't make sense to try to compress a section without contents since those sections take no space on disk. Compression can only increase the disk image size. * coffgen.c (make_a_section_from_file): Exclude !SEC_HAS_CONTENTS sections from compression and decompression. * elf.c (_bfd_elf_make_section_from_shdr): Likewise. diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 90fba3b8554..8eb69af2ce2 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -146,7 +146,8 @@ make_a_section_from_file (bfd *abfd, /* Compress/decompress DWARF debug sections with names: .debug_* and .zdebug_*, after the section flags is set. */ - if ((flags & SEC_DEBUGGING) + if ((flags & SEC_DEBUGGING) != 0 + && (flags & SEC_HAS_CONTENTS) != 0 && strlen (name) > 7 && ((name[1] == 'd' && name[6] == '_') || (strlen (name) > 8 && name[1] == 'z' && name[7] == '_'))) diff --git a/bfd/elf.c b/bfd/elf.c index bc433cf516c..16cea4f8aeb 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1201,7 +1201,8 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, /* Compress/decompress DWARF debug sections with names: .debug_* and .zdebug_*, after the section flags is set. */ - if ((newsect->flags & SEC_DEBUGGING) + if ((newsect->flags & SEC_DEBUGGING) != 0 + && (newsect->flags & SEC_HAS_CONTENTS) != 0 && ((name[1] == 'd' && name[6] == '_') || (name[1] == 'z' && name[7] == '_'))) { -- Alan Modra Australia Development Lab, IBM