From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gMk9LdOgrV+ZWAAAWB0awg (envelope-from ) for ; Thu, 12 Nov 2020 15:53:39 -0500 Received: by simark.ca (Postfix, from userid 112) id B50F81F08B; Thu, 12 Nov 2020 15:53:39 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4AAC81E552 for ; Thu, 12 Nov 2020 15:53:39 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6D69B39FF076; Thu, 12 Nov 2020 20:53:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D69B39FF076 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605214418; bh=CKnN243afTO/a63GyaYWsocuOkS3S1Dg+HO7E+h40Uk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=iyGQ0vo663r+iwJUcUT8XBok5VJnAwkZaB1SGLbtayMORv1bhu/jWU+3bxbLr8/a+ BEY9Ceno9yOz2Ta3WtHRvi2Yy+nZoXQIiqeDkGSUQkNN2zSMj3xuLYlOiHO97cj1oU e5B2ZcXt1bBWuSVb3q3SLITI5P2HUynxQePCyGY8= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id CF0313858005 for ; Thu, 12 Nov 2020 20:53:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CF0313858005 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-199-uxWWAwJHPt6_w9m8bnPZPg-1; Thu, 12 Nov 2020 15:53:30 -0500 X-MC-Unique: uxWWAwJHPt6_w9m8bnPZPg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 407B164081 for ; Thu, 12 Nov 2020 20:53:29 +0000 (UTC) Received: from theo.uglyboxes.com.com (ovpn-113-189.phx2.redhat.com [10.3.113.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1766255784 for ; Thu, 12 Nov 2020 20:53:29 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH 2/2] Exclude debuginfo files from "outside of ELF segments" warning Date: Thu, 12 Nov 2020 12:53:27 -0800 Message-Id: <20201112205327.2733425-2-keiths@redhat.com> In-Reply-To: <20201112205327.2733425-1-keiths@redhat.com> References: <20201112205327.2733425-1-keiths@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Keith Seitz via Gdb-patches Reply-To: Keith Seitz Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" When GDB loads an ELF file, it will warn when a section is not located in an ELF segment: $ ./gdb -q -iex "set build-id-verbose 0" --ex "b systemctl_main" -ex "r" -batch --args systemctl kexec Breakpoint 1 at 0xc24d: file ../src/systemctl/systemctl.c, line 8752. warning: Loadable section ".note.gnu.property" outside of ELF segments in .gnu_debugdata for /lib64/libgcc_s.so.1 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". warning: Loadable section ".note.gnu.property" outside of ELF segments in .gnu_debugdata for /lib64/libcap.so.2 warning: Loadable section ".note.gnu.property" outside of ELF segments in .gnu_debugdata for /lib64/libacl.so.1 warning: Loadable section ".note.gnu.property" outside of ELF segments in .gnu_debugdata for /lib64/libcryptsetup.so.12 warning: Loadable section ".note.gnu.property" outside of ELF segments in .gnu_debugdata for /lib64/libgcrypt.so.20 warning: Loadable section ".note.gnu.property" outside of ELF segments in .gnu_debugdata for /lib64/libip4tc.so.2 [snip] This has feature has also been reported by various users, most notably the Fedora-EOL'd bug 1553086. Mark Wielaard explains the issue quite nicely in https://sourceware.org/bugzilla/show_bug.cgi?id=24717#c2 The short of it is, the ELF program headers for debuginfo files are not suited to this particular use case. Consequently, the warning generated above really is useless and should be ignored. This patch follows the same heuristic that BFD itself uses. gdb/ChangeLog 2020-11-12 Keith Seitz https://bugzilla.redhat.com/show_bug.cgi?id=1553086 * elfread.c (elf_symfile_segments): Omit "Loadable section ... outside of ELF segments" warning for debugin --- gdb/ChangeLog | 6 ++++++ gdb/elfread.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/elfread.c b/gdb/elfread.c index 7915dcdcce..ccd7ce50d5 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -147,7 +147,12 @@ elf_symfile_segments (bfd *abfd) RealView) use SHT_NOBITS for uninitialized data. Since it is uninitialized, it doesn't need a program header. Such binaries are not relocatable. */ - if (bfd_section_size (sect) > 0 && j == num_segments + + /* Exclude debuginfo files from this warning, too, since those + are often not strictly compliant with the standard. See, e.g., + ld/24717 for more discussion. */ + if (!is_debuginfo_file (abfd) + && bfd_section_size (sect) > 0 && j == num_segments && (bfd_section_flags (sect) & SEC_LOAD) != 0) warning (_("Loadable section \"%s\" outside of ELF segments\n in %s"), bfd_section_name (sect), bfd_get_filename (abfd)); -- 2.26.2