From patchwork Tue May 14 10:55:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 90108 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 987AB387540F for ; Tue, 14 May 2024 10:55:08 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 27652385842A for ; Tue, 14 May 2024 10:54:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 27652385842A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 27652385842A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715684072; cv=none; b=iAIzETBlAzdKTKKakbOGThkHm40ICjX23DHv4OonyyvCCJ56l9okSr7QJi4rvNQNc3RBHI/OPZnKL4cBveCd9b4XzuDu6OrSceGoDqGvTF3k5mzVmOt/10EkQfnOcNltnvmUYjzs6RFOYVcWpzc8ddkyOq8fGEFsn/gbi+9giN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715684072; c=relaxed/simple; bh=WvGDK+f/a4GU+lmpR/dRI0pyfbgE4RZBOl3p8gFkMcc=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=uuiBp6/q6iPXtFwlL9tCXWLdnyLVgVmAgi0JgbelTwpQHhqylsVgO7rlFRIVhItjmu5HWJor1fRInfUOBfUIc7FfdhpVGfWk3/PAwIgUwLvbOt3oWBW4sunccwW3lqXfNJHx9pqCn2Oh0xviSG+Wft3YqCSj7N7ZWomEkx41jgU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2D8E760921 for ; Tue, 14 May 2024 10:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715684068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sy4pBNdZSv+g+msZe5qhKnzV0XzBhbFRDL5UOQqBiTk=; b=TGZn2ppACBRP8n6KEf9yF5+U6eDBBvxeAbs6tvtmYybwZz/5EfJoa+8s0wP4+rW+SJ8rd7 vW9q5piZvAtVNqJ8bSl75nnhBVkzgtWedN5nimpr4xTTf5y6LFl/8phzvt1lymL3C4a1nU cox1ZneWdO4y8fhGbpaaaL4jtZcNXK8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715684068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sy4pBNdZSv+g+msZe5qhKnzV0XzBhbFRDL5UOQqBiTk=; b=TXshkJgHC0dOdoOKFM5xZUXwEcnRcpidwAbImoeXEON+qIAd4YLwrO4bV9PustsPf6dj0x KGJYwHaKcoyDRzCw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715684068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sy4pBNdZSv+g+msZe5qhKnzV0XzBhbFRDL5UOQqBiTk=; b=TGZn2ppACBRP8n6KEf9yF5+U6eDBBvxeAbs6tvtmYybwZz/5EfJoa+8s0wP4+rW+SJ8rd7 vW9q5piZvAtVNqJ8bSl75nnhBVkzgtWedN5nimpr4xTTf5y6LFl/8phzvt1lymL3C4a1nU cox1ZneWdO4y8fhGbpaaaL4jtZcNXK8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715684068; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sy4pBNdZSv+g+msZe5qhKnzV0XzBhbFRDL5UOQqBiTk=; b=TXshkJgHC0dOdoOKFM5xZUXwEcnRcpidwAbImoeXEON+qIAd4YLwrO4bV9PustsPf6dj0x KGJYwHaKcoyDRzCw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 1668A13A61 for ; Tue, 14 May 2024 10:54:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id OEY8BORCQ2YOewAAD6G6ig (envelope-from ) for ; Tue, 14 May 2024 10:54:28 +0000 From: Tom de Vries To: binutils@sourceware.org Subject: [PATCH 2/3] [binutils/readelf] Add fixme in display_debug_str_offsets Date: Tue, 14 May 2024 12:55:21 +0200 Message-Id: <20240514105522.10107-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240514105522.10107-1-tdevries@suse.de> References: <20240514105522.10107-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-2.41 / 50.00]; BAYES_HAM(-2.61)[98.27%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[gnu.org:url]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[binutils@sourceware.org]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.41 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org While reading display_debug_str_offsets, I realized that the v4 split dwarf handling bit doesn't assign entry_length, so it can be either 4 (32-bit dwarf) or 8 (64-bit dwarf). However, I think the cases for which it'll be 8 are rare and odd enough to conclude that in practise we default to 32-bit dwarf. As mentioned in the fission documentation [1], whether a .debug_str_offsets section is 32-bit or 64-bit dwarf depends on the compilation unit header in the .debug_info.dwo section, which is currently not inspected. For now: - make an explicit choice for 32-bit dwarf by assiging 4 to entry_length, and - add a fixme comment. [1] https://gcc.gnu.org/wiki/DebugFission --- binutils/dwarf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 8125c64e1b6..f49989dc536 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -7971,6 +7971,14 @@ display_debug_str_offsets (struct dwarf_section *section, entries_end = end; debug_str_offsets_hdr_len = 0; + /* FIXME: We assume 32-bit dwarf here. According to + https://gcc.gnu.org/wiki/DebugFission: + The size of each entry is 4 bytes for DWARF-32 compilation units, + or 8 bytes for DWARF-64 compilation units, as determined by the + unit_length field of the compilation unit header in the + .debug_info.dwo section. */ + entry_length = 4; + printf (_(" Length: %#" PRIx64 "\n"), length); printf (_(" Index Offset [String]\n")); }