From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7AFE4385841A for ; Fri, 16 Feb 2024 07:45:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7AFE4385841A Authentication-Results: sourceware.org; dmarc=pass (p=none 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 7AFE4385841A 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=1708069511; cv=none; b=otLBvDqGpM7gCDMcftjMVu2XwkM5jAcv6+bUQshXRiUXeAiR7X1zreWiL4hk52vGrnrGd8lEJB30EQVKU5ucKYZv7F0rgGrJ7i3oThiCFXghiyNKJrgW89xEpBvrslt5mrxTU7Z+TUOZevHTRX7jMsTlVNNx1GwykxRczvNe2sU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708069511; c=relaxed/simple; bh=QMhbNwZmqf4b+zeBqvmfGn75s45I/MXf0B3ka/B02jQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=XW1b0L0lyECn57XsUdOtPc6Ch4Uf6Rct7P9knlNeza9SBlJ3Yo13cjwwSUgPjgZf9f7+EJIpI2dzPzhZdpyKMaTuLccTfk6jTxOHuMFl7DkfHTuSZTRWHLlIJwMFdBwo9V4jYl9hO+GhACA8asOB438hxJSFzFztLehDf35vbgw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708069509; 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=6TLKunAtclXW63BXBu8laQFM/evh22z9TediytXdMmM=; b=MFOyJvLPzp45yVxbtOQ7kb3p1T/ns8rZdXwMxksv28nmFaYNFgOLGDq4lpwFxNWKX+cHBD bjGylu0Yz81wpJUKbJ1Qb8kYeMYQrtrT8n1karwE9NEjJFZ9QzQvGclBqR2TAOMd6Hu9IT OTB23KeWv2iZq1eVYsJVfkkvxf52qLY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-153-39cK4D3uOPCllUIzdSeHXg-1; Fri, 16 Feb 2024 02:45:05 -0500 X-MC-Unique: 39cK4D3uOPCllUIzdSeHXg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1691B86302D; Fri, 16 Feb 2024 07:45:05 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C5F72C1596E; Fri, 16 Feb 2024 07:45:03 +0000 (UTC) From: Florian Weimer To: Evan Green Cc: libc-alpha@sourceware.org, vineetg@rivosinc.com, slewis@rivosinc.com, palmer@rivosinc.com Subject: Re: [PATCH v12 5/7] riscv: Enable multi-arg ifunc resolvers References: <20240214143159.2951158-1-evan@rivosinc.com> <20240214143159.2951158-6-evan@rivosinc.com> Date: Fri, 16 Feb 2024 08:45:01 +0100 In-Reply-To: <20240214143159.2951158-6-evan@rivosinc.com> (Evan Green's message of "Wed, 14 Feb 2024 06:31:56 -0800") Message-ID: <8734ts7szm.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_BLACK 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: * Evan Green: > diff --git a/include/libc-symbols.h b/include/libc-symbols.h > index e21bb599b3..4367aa6740 100644 > --- a/include/libc-symbols.h > +++ b/include/libc-symbols.h > @@ -667,9 +667,9 @@ for linking") > #endif > > /* Helper / base macros for indirect function symbols. */ > -#define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \ > +#define __ifunc_resolver(type_name, name, expr, init, classifier, ...) \ > classifier inhibit_stack_protector \ > - __typeof (type_name) *name##_ifunc (arg) \ > + __typeof (type_name) *name##_ifunc (__VA_ARGS__) \ > { \ > init (); \ > __typeof (type_name) *res = expr; \ > @@ -677,13 +677,13 @@ for linking") > } > > #ifdef HAVE_GCC_IFUNC > -# define __ifunc(type_name, name, expr, arg, init) \ > +# define __ifunc_args(type_name, name, expr, init, ...) \ > extern __typeof (type_name) name __attribute__ \ > ((ifunc (#name "_ifunc"))); \ > - __ifunc_resolver (type_name, name, expr, arg, init, static) > + __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__) > > -# define __ifunc_hidden(type_name, name, expr, arg, init) \ > - __ifunc (type_name, name, expr, arg, init) > +# define __ifunc_args_hidden(type_name, name, expr, init, ...) \ > + __ifunc_args (type_name, name, expr, init, __VA_ARGS__) > #else > /* Gcc does not support __attribute__ ((ifunc (...))). Use the old behaviour > as fallback. But keep in mind that the debug information for the ifunc > @@ -694,18 +694,24 @@ for linking") > different signatures. (Gcc support is disabled at least on a ppc64le > Ubuntu 14.04 system.) */ > > -# define __ifunc(type_name, name, expr, arg, init) \ > +# define __ifunc_args(type_name, name, expr, init, ...) \ > extern __typeof (type_name) name; \ > - __typeof (type_name) *name##_ifunc (arg) __asm__ (#name); \ > - __ifunc_resolver (type_name, name, expr, arg, init,) \ > + __typeof (type_name) *name##_ifunc (__VA_ARGS__) __asm__ (#name); \ > + __ifunc_resolver (type_name, name, expr, init, , __VA_ARGS__) \ > __asm__ (".type " #name ", %gnu_indirect_function"); > > -# define __ifunc_hidden(type_name, name, expr, arg, init) \ > +# define __ifunc_args_hidden(type_name, name, expr, init, ...) \ > extern __typeof (type_name) __libc_##name; \ > - __ifunc (type_name, __libc_##name, expr, arg, init) \ > + __ifunc (type_name, __libc_##name, expr, __VA_ARGS__, init) \ > strong_alias (__libc_##name, name); > #endif /* !HAVE_GCC_IFUNC */ > > +#define __ifunc(type_name, name, expr, arg, init) \ > + __ifunc_args (type_name, name, expr, init, arg) > + > +#define __ifunc_hidden(type_name, name, expr, arg, init) \ > + __ifunc_args_hidden (type_name, name, expr, init, arg) > + > /* The following macros are used for indirect function symbols in libc.so. > First of all, you need to have the function prototyped somewhere, > say in foo.h: The generic parts look good to me. Reviewed-by: Florian Weimer Thanks, Florian