From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WVzKCUxW9miTVAAAWB0awg (envelope-from ) for ; Mon, 20 Oct 2025 11:33:32 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dbtQC3Tu; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 14EC71E0BC; Mon, 20 Oct 2025 11:33:32 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 946651E047 for ; Mon, 20 Oct 2025 11:33:31 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 196413858406 for ; Mon, 20 Oct 2025 15:33:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 196413858406 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dbtQC3Tu Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 1CBE73858C60 for ; Mon, 20 Oct 2025 15:31:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1CBE73858C60 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1CBE73858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760974262; cv=none; b=uFjPnXvD7L2K2Bt1PwpDEVmi5Jec8Q5NCf036OQgRxSgthhKccTh8WUB3K57qHRH3qwpGhI4KSwm8DE17Lu8ny9rfKVG6/AXR3R3Pc4zodfUuc9TIiAo2JeAN7pLVUMPvmr9hl9a73wDuF/okZW9WWiOLmfy0cNUvCCU8wK7DLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760974262; c=relaxed/simple; bh=tkhWJ01JNkVGdH62JfT00c9f8F+w5WhidrULAMAqXRI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=daDplDZuSdo/Fynz7eu9ZJZqjCjl+0LeRWkZuHnC/d+0/Ok1K5MJbEjDpqfI448Uksiczv8KxVv5ZZASednLUPeQC1ln6jcFdyexHKcQu5QCPJ/6BEhhUEtuQQfYNPhMafARqpH9XewDyKD9xChqHptaaQQwU4LvseBHiJRjfzk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CBE73858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760974261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tZ6GUG/4ClGSCCb5KM1gWgoxd6xkkRI0iW/q79SU6gk=; b=dbtQC3TuG/wHZz4eFQRUTgmVohgKNXVvWYmWQsmFQWP6lWX4ts/3my0fm9y3mksZTOcrCm bc2KTzms3hULdf5QXM0iMLKQz6aD/KqPy+LQnqg24/dZavWbR1sda+4kQmRPBx3GX6D+W8 aVn7EzFUUsX6t2Ny8c/ajJExgst1ToQ= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-691-QgGaj8z8NH-uOvligYVp7Q-1; Mon, 20 Oct 2025 11:31:00 -0400 X-MC-Unique: QgGaj8z8NH-uOvligYVp7Q-1 X-Mimecast-MFC-AGG-ID: QgGaj8z8NH-uOvligYVp7Q_1760974259 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A4E4E1956095 for ; Mon, 20 Oct 2025 15:30:59 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.25]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6233318003FC; Mon, 20 Oct 2025 15:30:58 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH v2 1/8] gdb: move some stabs functions to gdb/buildsym-legacy.h Date: Mon, 20 Oct 2025 12:28:45 -0300 Message-ID: <20251020152853.28195-2-guinevere@redhat.com> In-Reply-To: <20251020152853.28195-1-guinevere@redhat.com> References: <20251020152853.28195-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: XelcwrQKZr9Si4tnFdUaQyZHJFPygf6o8CHhV8wnDiU_1760974259 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org The gdb/stabsread.h and .c files define 2 things that, while originally intended only for stabs reading, actually end up being used for coff, ecoff and maybe more debuginfo formats. That is the function "hashname", and the macro HASHSIZE. Both are used for small hashtables when reading some symbols with incomplete information. With the upcoming removal of stabs code, this code should be moved somewhere, and the location that looked most reasonable was gdb/buildsym-legacy. No change in behavior is expected after this commit. --- gdb/buildsym-legacy.h | 10 ++++++++++ gdb/stabsread.c | 8 -------- gdb/stabsread.h | 9 ++------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h index 4ae8e1a7b66..06d39e8529f 100644 --- a/gdb/buildsym-legacy.h +++ b/gdb/buildsym-legacy.h @@ -21,6 +21,16 @@ #include "buildsym.h" +/* Legacy hash for symbol names used for several debuginfo formats. */ + +#define HASHSIZE 127 + +static inline int +hashname (const char *name) +{ + return fast_hash (name, strlen (name)) % HASHSIZE; +} + /* This module provides definitions used for creating and adding to the symbol table. These routines are called from various symbol- file-reading routines. This file holds the legacy API, which diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 733fc9e6ddc..60cd5702396 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -7190,14 +7190,6 @@ find_name_end (const char *name) } } -/* See stabsread.h. */ - -int -hashname (const char *name) -{ - return fast_hash (name, strlen (name)) % HASHSIZE; -} - /* Initializer for this module. */ INIT_GDB_FILE (stabsread) diff --git a/gdb/stabsread.h b/gdb/stabsread.h index 15f73266e1c..1c9ce854dff 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -19,6 +19,8 @@ #ifndef GDB_STABSREAD_H #define GDB_STABSREAD_H +#include "buildsym-legacy.h" + struct objfile; struct legacy_psymtab; enum language; @@ -26,13 +28,6 @@ enum language; /* Definitions, prototypes, etc for stabs debugging format support functions. */ -#define HASHSIZE 127 /* Size of things hashed via - hashname(). */ - -/* Compute a small integer hash code for the given name. */ - -extern int hashname (const char *name); - /* Count symbols as they are processed, for error messages. */ extern unsigned int symnum; -- 2.51.0