From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /wBgD7T9O2qacxYAWB0awg (envelope-from ) for ; Wed, 24 Jun 2026 11:54:28 -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=FoDqdUFQ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 27E471E098; Wed, 24 Jun 2026 11:54:28 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.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 autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 465161E024 for ; Wed, 24 Jun 2026 11:54:27 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B931C4BA2E14 for ; Wed, 24 Jun 2026 15:54:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B931C4BA2E14 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=FoDqdUFQ Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 61D964BA540B for ; Wed, 24 Jun 2026 15:54:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61D964BA540B 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 61D964BA540B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782316442; cv=none; b=oNj8dh0EHzKxe9trtSF+kndQ7z/rnuqpFQsjL1PyatoTSaJYWoLW+KJB4937QSJldXmLWLVNdU8zk3w4l04NXMh+awEquv2saMn0nLzBI5wYophSWoQU0RqpQp6KIeYubaasdhU3/szSMCUbDdb3VUeJM86fJUbm4wBD2jWrLGc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1782316442; c=relaxed/simple; bh=jZYENLBzAW7Kq5T3wgkt0moHrGlJLStWimFUq7IW7/c=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=k53ehnbri5Gfv8w62kjTOR4dtbLFc51l/cJzBxLZ9mFKLaX1HGk5Vh+MGQfpvO+Ey8Q2pORMcCBcQpCx378egCxX6P9QlCvdzvPdiIOcwxpwsgeRejDxsPyBLFXS659UxiLvoZUzCui4/EqugjCEwJH6BTQozAqE2F7D2RN+2KU= ARC-Authentication-Results: i=1; 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=FoDqdUFQ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 61D964BA540B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782316442; 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: in-reply-to:in-reply-to:references:references; bh=lJuapd59DhIO60++kM3nRuBGRuWj5zw3U5osgjZSwDE=; b=FoDqdUFQKhwKcvsq7gfop14OEZp4HzQq6A/xTYToLHMP8ugnP6TbJw7VOgrafmM4SG0QYI E3H/XzfJ1ciNlEh99L/S/eYdtct2v0p5s30wJNRaxeOIAZZL2n+4YHYtlCm2kR2EpJxb4G HGlhwzBA6SccsNSAc6CwRCHUQ//af9g= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-AqX8-htYNkSAiAFEyocvKA-1; Wed, 24 Jun 2026 11:54:00 -0400 X-MC-Unique: AqX8-htYNkSAiAFEyocvKA-1 X-Mimecast-MFC-AGG-ID: AqX8-htYNkSAiAFEyocvKA_1782316440 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-49243626f15so10243605e9.1 for ; Wed, 24 Jun 2026 08:54:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782316440; x=1782921240; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lJuapd59DhIO60++kM3nRuBGRuWj5zw3U5osgjZSwDE=; b=ENf8f3eICfwG4/uJo2WqXE/Fb1st2+Tn869zi68WCPeBw/VZwshYvz39qZEcP7b1CN iIvQk97lBUjiTi/Gi3vjQiL4hpnKvvVGi07y/UCxM5xUO5TIY7Eh4svtk30ljC4Kb85w BixX1Xkt2yBjzmAobvP5M7MSNBmDIHCxHSvpXiq4Ql5Zb8aJKM1Y4X83e2t7IpLUAO+1 hFhQcbQfhpJfAc+diy6WWNRjgdyLAgInYmSMXedtqsPrJjx7JAxtFQhbv+e8qa8xFeVz 9YkriFtJAA/6sOW9DvjpBT0LzuzP+w0nZvDy6JnPlzo+VdOoBDS/2KSGNKnkvdQIEr1b OGNg== X-Forwarded-Encrypted: i=1; AFNElJ8+zl5Lga9Bz5wy95wtzNVh9gMAZuYkR99H6TEuGdmECpVxyPEwF4IeJ88qPc38JCv2FdP2mR9OxzITFw==@sourceware.org X-Gm-Message-State: AOJu0YwhNDnDvXVycs/JBNoMD4HSWtKDJAUUs/EMwZPReOXQTrDdCgIB ApMFX0xxisPvaL1t/QhfVgg3uEViL+4X/V9g+JS7qj8dqZ2GZ71Hr/fPs2eIFUt7ceIAoGtY790 Bogfo1PYCYJfo/mvQ/M2XU81UhQqaOn+Mr8o4P1QPAdeyCa9YytVWEkoOrRfmA14= X-Gm-Gg: AfdE7clDysN9sHxEoOKfNrU+UHTSbDeRLQ2CdMOxNsCEWA9wJOPnDk5aAFzL7zTtZ+h ngBMiIqjJ61DExalluzTpRsXTMWdQj9xuvyia5DRjv7VuICB7DLnbcGglX7bWxFP8wmdx6tBd/w AjaLIgDNsOAFvKgKK024oMpvWtjm+qzGKhyOyS6jvAfGTHIL2ZUW7p8CVL906EktuniS9q8WUIS NfLR9YbCYaTaz9wE6H57M5t0LJbeSiHvNyJEphn47gljjnlCVXxDUYEed4+OclpWBUZqTHpyuTb 9E75C+ZK1aKsTMsh2unNy6MlW91pnzd8F7JxJ7fvgVUQdbj1RBMwvP3O07aA5X0MMojJWa2Qgw6 6FTpNAZRqrpUbAeRTH16JArI2ySPmKA== X-Received: by 2002:a05:600c:c3cd:20b0:492:3e69:a86f with SMTP id 5b1f17b1804b1-492608400e1mr48816485e9.1.1782316439627; Wed, 24 Jun 2026 08:53:59 -0700 (PDT) X-Received: by 2002:a05:600c:c3cd:20b0:492:3e69:a86f with SMTP id 5b1f17b1804b1-492608400e1mr48815915e9.1.1782316439087; Wed, 24 Jun 2026 08:53:59 -0700 (PDT) Received: from localhost (19.81.93.209.dyn.plus.net. [209.93.81.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-46c221d93cdsm9012036f8f.18.2026.06.24.08.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2026 08:53:58 -0700 (PDT) From: Andrew Burgess To: Muhammad Kamran , gdb-patches@sourceware.org Cc: Wilco Dijkstra , Yury Khrustalev , Thiago Jung Bauermann , Adhemerval Zanella Netto , Carlos O'Donell , Muhammad Kamran Subject: Re: [PATCH 1/1] gdb: Preserve IFUNC marker when finding inferior functions In-Reply-To: <20260624095002.5247-2-muhammad.kamran@arm.com> References: <20260624095002.5247-1-muhammad.kamran@arm.com> <20260624095002.5247-2-muhammad.kamran@arm.com> Date: Wed, 24 Jun 2026 16:53:57 +0100 Message-ID: <87o6h0ndd6.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: CITP6yA86yeYjmJINS7tKM59SroQPIIpZr89sgbH09A_1782316440 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Muhammad Kamran writes: > GDB calls find_function_in_inferior ("malloc") when expression > evaluation needs to allocate memory in the inferior, e.g. for string > literal arguments. > > The minimal-symbol fallback created a synthetic ordinary function > pointer from msymbol.value_address (). If the symbol was a GNU IFUNC, > this discarded the IFUNC marker, so call_function_by_hand did not > resolve the symbol before calling it. > > Use find_minsym_type_and_address to classify the minimal symbol and > propagate the GNU IFUNC marker to the synthetic function type. This > keeps the existing fallback return type while allowing inferior calls > through IFUNC symbols to be resolved correctly. > --- > gdb/valops.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) Is it possible to create a test for this issue that would fail on other targets? There's gdb.base/gnu-ifunc.exp, from the patch I'm wondering if all that would be needed is to place an ifunc function in a library, and compile the library without debug information? It's not super clear from your description the exact steps that are needed to trigger this bug. > > diff --git a/gdb/valops.c b/gdb/valops.c > index ab6fd5079e1..7d305871efc 100644 > --- a/gdb/valops.c > +++ b/gdb/valops.c > @@ -133,11 +133,15 @@ find_function_in_inferior (const char *name, struct objfile **objf_p) > struct gdbarch *gdbarch = objfile->arch (); > > struct type *type; > + struct type *resolved_type; > CORE_ADDR maddr; > type = lookup_pointer_type (builtin_type (gdbarch)->builtin_char); > type = lookup_function_type (type); > type = lookup_pointer_type (type); > - maddr = msymbol.value_address (); > + resolved_type = find_minsym_type_and_address (msymbol.minsym, objfile, > + &maddr); > + if (resolved_type->is_gnu_ifunc ()) > + type->target_type ()->set_is_gnu_ifunc (true); There are other places in GDB where we use lookup_function_type, could these also run into this issue? It would be nice if the description explained why other similar places in GDB don't need changing if that's the case. Thanks, Andrew > > if (objf_p) > *objf_p = objfile; > -- > 2.43.0