From patchwork Wed Jan 31 12:04:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1893465 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MumuFDLU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TQ1283v7Kz23g7 for ; Wed, 31 Jan 2024 23:05:20 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 800E23858C78 for ; Wed, 31 Jan 2024 12:05:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 C13443858014 for ; Wed, 31 Jan 2024 12:04:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C13443858014 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 C13443858014 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=1706702671; cv=none; b=rwTekDKSdyojR6zljPPIU29by+0ynxRZmr6Ntpj3mNZ95tcRRBeCdLp4jcfxYrDOVyXMlUukt+G8gvX/xhPxRU2XreWBbM2w3zKpe+lKSNXBonJfMEdOg8XDVCE3ZqJXhVqhS2xhwGYg6X+e4JVfyCCa8ZMOfiUhw5Px/YSrkP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706702671; c=relaxed/simple; bh=dUn32fF/GFgPAw/rsYuHNoFMpL9jCZa6CW3li2WqtLE=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=fqspNCXqwT3YdHad2V2v+WFiyBr8pz8sCcX6ynB3UIwl0lYo5iqT5jPQWtWponDpGZRWc6FUuekMj97+7diKgYB/zFg63OFvl12SGKOBkJBwXM1D55+pYLJYZrUs/EUT01kmQYSKfnSa0Jh/BZYGYLL/wBDmQWFo1epPzfoXiKI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706702667; h=from:from:reply-to: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=yyBgfon5gLvEFzACelDOfbi4jrYsAA/PnhPD3NcT8as=; b=MumuFDLUheM78bsh33Md2PdJzPjd0mq8YKokqYsyHkIKZfuJvmB+/ZIrIhmfe0TlnDfll3 FbqHWt9bFtcoDbMqrWjTPGkT7mvBgzVSxSVazbneCEoZYDTOg5pC2WyfWdHWoKj8chOhCy jBi2UJf8jq5LDJmsi37WohblTqymn5c= 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-501-dBMdapCdMYm_8m0Y6Z6JpQ-1; Wed, 31 Jan 2024 07:04:24 -0500 X-MC-Unique: dBMdapCdMYm_8m0Y6Z6JpQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 01B3A10C04E4; Wed, 31 Jan 2024 12:04:24 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B941C1121312; Wed, 31 Jan 2024 12:04:23 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 40VC4Lpr286618 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 31 Jan 2024 13:04:21 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40VC4K8t286617; Wed, 31 Jan 2024 13:04:20 +0100 Date: Wed, 31 Jan 2024 13:04:20 +0100 From: Jakub Jelinek To: Iain Sandoe Cc: GCC Patches Subject: [PATCH] libgcc: Avoid warnings on __gcc_nested_func_ptr_created [PR113402] Message-ID: References: <20240118145923.25112-1-iain@sandoe.co.uk> <147CA2E9-770F-48EA-9408-18C7090D05A6@sandoe.co.uk> MIME-Version: 1.0 In-Reply-To: <147CA2E9-770F-48EA-9408-18C7090D05A6@sandoe.co.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org On Sun, Jan 28, 2024 at 11:02:33AM +0000, Iain Sandoe wrote: > * config/aarch64/heap-trampoline.c: Rename > __builtin_nested_func_ptr_created to __gcc_nested_func_ptr_created and > __builtin_nested_func_ptr_deleted to __gcc_nested_func_ptr_deleted. > * config/i386/heap-trampoline.c: Likewise. > * libgcc2.h: Likewise. I'm seeing hundreds of In file included from ../../../libgcc/libgcc2.c:56: ../../../libgcc/libgcc2.h:32:13: warning: conflicting types for built-in function ‘__gcc_nested_func_ptr_created’; expected ‘void(void *, void *, void *)’ [-Wbuiltin-declaration-mismatch] 32 | extern void __gcc_nested_func_ptr_created (void *, void *, void **); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warnings. Either we need to add like in r14-6218 #pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" (but in that case because of the libgcc2.h prototype (why is it there?) it would need to be also with #pragma GCC diagnostic push/pop around), or we could go with just following how the builtins are prototyped on the compiler side and only cast to void ** when dereferencing (which is in a single spot in each TU). 2024-01-31 Jakub Jelinek * libgcc2.h (__gcc_nested_func_ptr_created): Change type of last argument from void ** to void *. * config/i386/heap-trampoline.c (__gcc_nested_func_ptr_created): Change type of dst from void ** to void * and cast dst to void ** before dereferencing it. * config/aarch64/heap-trampoline.c (__gcc_nested_func_ptr_created): Likewise. Jakub --- libgcc/libgcc2.h.jj 2024-01-29 09:41:20.096387494 +0100 +++ libgcc/libgcc2.h 2024-01-31 12:43:22.702694509 +0100 @@ -29,7 +29,7 @@ see the files COPYING3 and COPYING.RUNTI #pragma GCC visibility push(default) #endif -extern void __gcc_nested_func_ptr_created (void *, void *, void **); +extern void __gcc_nested_func_ptr_created (void *, void *, void *); extern void __gcc_nested_func_ptr_deleted (void); extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t); --- libgcc/config/i386/heap-trampoline.c.jj 2024-01-31 10:46:36.491743132 +0100 +++ libgcc/config/i386/heap-trampoline.c 2024-01-31 12:44:44.449550698 +0100 @@ -26,7 +26,7 @@ int get_trampolines_per_page (void); struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent); void *allocate_trampoline_page (void); -void __gcc_nested_func_ptr_created (void *chain, void *func, void **dst); +void __gcc_nested_func_ptr_created (void *chain, void *func, void *dst); void __gcc_nested_func_ptr_deleted (void); static const uint8_t trampoline_insns[] = { @@ -115,7 +115,7 @@ allocate_tramp_ctrl (struct tramp_ctrl_d HEAP_T_ATTR void -__gcc_nested_func_ptr_created (void *chain, void *func, void **dst) +__gcc_nested_func_ptr_created (void *chain, void *func, void *dst) { if (tramp_ctrl_curr == NULL) { @@ -158,7 +158,7 @@ __gcc_nested_func_ptr_created (void *cha __builtin___clear_cache ((void *)trampoline->insns, ((void *)trampoline->insns + sizeof(trampoline->insns))); - *dst = &trampoline->insns; + *(void **) dst = &trampoline->insns; } HEAP_T_ATTR --- libgcc/config/aarch64/heap-trampoline.c.jj 2024-01-31 10:46:36.491743132 +0100 +++ libgcc/config/aarch64/heap-trampoline.c 2024-01-31 12:45:11.282175257 +0100 @@ -26,7 +26,7 @@ int get_trampolines_per_page (void); struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent); void *allocate_trampoline_page (void); -void __gcc_nested_func_ptr_created (void *chain, void *func, void **dst); +void __gcc_nested_func_ptr_created (void *chain, void *func, void *dst); void __gcc_nested_func_ptr_deleted (void); #if defined(__gnu_linux__) @@ -115,7 +115,7 @@ allocate_tramp_ctrl (struct tramp_ctrl_d HEAP_T_ATTR void -__gcc_nested_func_ptr_created (void *chain, void *func, void **dst) +__gcc_nested_func_ptr_created (void *chain, void *func, void *dst) { if (tramp_ctrl_curr == NULL) { @@ -158,7 +158,7 @@ __gcc_nested_func_ptr_created (void *cha __builtin___clear_cache ((void *)trampoline->insns, ((void *)trampoline->insns + sizeof(trampoline->insns))); - *dst = &trampoline->insns; + *(void **) dst = &trampoline->insns; } HEAP_T_ATTR