From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id B9FE33858D3C for ; Wed, 6 Dec 2023 17:49:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B9FE33858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B9FE33858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::629 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701884945; cv=none; b=uiw/ABnqhYV20gQcDcZm2kkCf3UWlLfmzzIZ9GnDNK6WYT6zOAQZf2rD0B6c49szXOi4sWoIF2s5tGyTcAhJWwdFpLieqMGFomtiAO+KMY00X8ChIbJehloggcIUxZBxK8KIAjLnCmiyrYSDoeK2tcdov+HaU8D9p/VQwz9cM0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701884945; c=relaxed/simple; bh=ymPTc2epQ20YpkOSaTYhhLh8TjQHiZoGWObmClWve4I=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=xPDr2Fnf0PlMjC5dYMCYh3rKfolQG7QOmq4yf8f4gi11kYkhyhvv7PR64+2fTACSFoZJtLuClZkrfYPwdCiqzoLjONs9N6f+LC6oUq0/G6rxo9y9u+o6PKqC+KlpRGKhmIq+iSE9jTK65+vRJK6ujLa7c8jqzkYKpe+pnY6sG6Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1d06fffdb65so111855ad.2 for ; Wed, 06 Dec 2023 09:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701884941; x=1702489741; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=zQvFirfGNcpauCDBhq9BQSuzo1M4psYlXO+si7RL4nw=; b=DGiEBA/fhWAEC8KPZf3rPV6Dm95PlUE9SPViwLq9oAnYWAJ+ypZdVyCMicQ7/Jm4iB djecxDOUeGILrWU0k+bratRoqWsTLM0wAOlCvX6lxU5OGGjkNhPfc7CrHgLO+rcpuwaw BB2kJU0Sp9wq0rdW/ioB0NlqkXfXIvOM6NCIsHiJroc95L38Irmsd8D9M5s+bsdpv7eH Fivhwtm6ri2OcB3NjgRoGm6AS6DjII2AmZASjjYsQQwtE9iOe6smKE9qS4ueCdsNrHq8 1jaRCvYc0iomADihzp5WKye7EuDb4zvGV1uMgYRJgMzbC+3uzNy0H9pHB6GvGWgksM3U GsiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701884941; x=1702489741; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zQvFirfGNcpauCDBhq9BQSuzo1M4psYlXO+si7RL4nw=; b=CEnHx/C+sqyEdoTwE0pFxBKNHu6+A7hUtVIaUCdIOaOnzdyrjvq5G8EVsn3vBGaB/n UjFzRVmvCOqigQO5X7esgjm4BKNUiLj5JbxEiO6MLeFhZEk5uk6I64UuQjt4WmK7nHZK kU8s3nuwrWTFKXWuEoP8M6cYQ3YYvKB4Szzre1pKY7ss/ciGi8fH2OmOWN1tVJ83ZKVT 6oEH5RLweChwtYPcDetSpNcQvNMm3dDLHUFcdbmd/Vciy9HYCX7xGlXg/6c9fyYooKZV 7ZxsErnpho7YOw9cVkkyzgfc6wY7Llsi61O88vhJXI/Zgroiv7zy8u8PJs9ZrlXtb1bA 17zw== X-Gm-Message-State: AOJu0YzQw2gV5AjPWw7YF6ZmCLoZImdQDT1B5gzbKX6ny1qhi2zfrfpd wbeOIe7Aucb5cxGNer21J/5nXf1iNoY= X-Google-Smtp-Source: AGHT+IHjnXDexJ1sPs2/TL9QBQvmIe3rVi9dqbOG+PvFXOTVYY8Jsdi7HMMAqbCANnhBTw4L2lc4iw== X-Received: by 2002:a17:902:f54c:b0:1d0:401c:4f3 with SMTP id h12-20020a170902f54c00b001d0401c04f3mr1324607plf.67.1701884940778; Wed, 06 Dec 2023 09:49:00 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id jh5-20020a170903328500b001d07d83fdd0sm93007plb.238.2023.12.06.09.48.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Dec 2023 09:49:00 -0800 (PST) Message-ID: Date: Wed, 6 Dec 2023 10:48:55 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] libgcc: Avoid -Wbuiltin-declaration-mismatch warnings in emutls.c Content-Language: en-US To: Jakub Jelinek , Richard Biener Cc: gcc-patches@gcc.gnu.org References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: On 12/6/23 03:04, Jakub Jelinek wrote: > Hi! > > When libgcc is being built in --disable-tls configuration or on > a target without native TLS support, one gets annoying warnings: > ../../../../libgcc/emutls.c:61:7: warning: conflicting types for built-in function ‘__emutls_get_address’; expected ‘void *(void *)’ [-Wbuiltin-declaration-mismatch] > 61 | void *__emutls_get_address (struct __emutls_object *); > | ^~~~~~~~~~~~~~~~~~~~ > ../../../../libgcc/emutls.c:63:6: warning: conflicting types for built-in function ‘__emutls_register_common’; expected ‘void(void *, unsigned int, unsigned int, void *)’ [-Wbuiltin-declaration-mismatch] > 63 | void __emutls_register_common (struct __emutls_object *, word, word, void *); > | ^~~~~~~~~~~~~~~~~~~~~~~~ > ../../../../libgcc/emutls.c:140:1: warning: conflicting types for built-in function ‘__emutls_get_address’; expected ‘void *(void *)’ [-Wbuiltin-declaration-mismatch] > 140 | __emutls_get_address (struct __emutls_object *obj) > | ^~~~~~~~~~~~~~~~~~~~ > ../../../../libgcc/emutls.c:204:1: warning: conflicting types for built-in function ‘__emutls_register_common’; expected ‘void(void *, unsigned int, unsigned int, void *)’ [-Wbuiltin-declaration-mismatch] > 204 | __emutls_register_common (struct __emutls_object *obj, > | ^~~~~~~~~~~~~~~~~~~~~~~~ > The thing is that in that case __emutls_get_address and > __emutls_register_common are builtins, and are declared with void * > arguments rather than struct __emutls_object *. > Now, struct __emutls_object is a type private to libgcc/emutls.c and the > middle-end creates on demand when calling the builtins a similar structure > (with small differences, like not having the union in there). > > We have a precedent for this e.g. for fprintf or strftime builtins where > the builtins are created with magic fileptr_type_node or const_tm_ptr_type_node > types and then match it with user definition of pointers to some structure, > but I think for this case users should never define these functions > themselves nor call them and having special types for them in the compiler > would mean extra compile time spent during compiler initialization and more > GC data, so I think it is better to keep the compiler as is. > > On the library side, there is an option to just follow what the > compiler is doing and do > EMUTLS_ATTR void > -__emutls_register_common (struct __emutls_object *obj, > +__emutls_register_common (void *xobj, > word size, word align, void *templ) > { > + struct __emutls_object *obj = (struct __emutls_object *) xobj; > but that will make e.g. libabigail complain about ABI change in libgcc. > > So, the patch just turns the warning off. > > Tested on x86_64-linux with --disable-tls, ok for trunk? > > 2023-12-06 Thomas Schwinge > Jakub Jelinek > > PR libgcc/109289 > * emutls.c: Add GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" > pragma. OK jeff