From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by sourceware.org (Postfix) with ESMTPS id 751703896C09 for ; Mon, 14 Dec 2020 21:14:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 751703896C09 Received: by mail-qv1-xf31.google.com with SMTP id 4so8506545qvh.1 for ; Mon, 14 Dec 2020 13:14:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5f6MbzMS1AYUHWx2y4T/TE0uixQGO7cdlupZZpVKi74=; b=sY5W5iCtM11grq7Pt93ucnfyoFYhuQ11EwlZpgk0bWc5CZOomTAYmAfvotNFiZXVIE u3Mb1h1yA1Vb3QHSjL1GzHy1PXoT+BcmSbGONypRkDq0tKg3qbCPkfBHPV9SRpUGb+Pn aSL/5b+5/oNjaj8kLTGRG2w8Awg/8PgKRcb5PghA+bRoQrpgkO0f5iLtFzdAIu4E4Iix yLg2UaXrpqnqNfWi5fuIixHKzPk/0WKb/9Gin/JTjqQgoFYUq7qvprCDXIlfQ8bTZ5uZ oFDLz1ZRFU5unnH9Ssd1OIovwlp1eAlqKjfysty13coE0OFx0agXeBRn77v2NAVaZ3TU 47fA== X-Gm-Message-State: AOAM530uuhnJUUUqvm2sQscYznQUIEF4L9neUbm2dAol2JNpx3vNzW1E +Vd9pIDT3Dfb5wXZc1MfsLBg8du5wfQ= X-Google-Smtp-Source: ABdhPJxyKmFhLXYHFwbTsPgsChlxQYU/mChM3ozwDPvg4CjVkX7nP6ukSGkFjgZn55IGaFGwz9Ut4A== X-Received: by 2002:ad4:45a9:: with SMTP id y9mr34688031qvu.15.1607980440850; Mon, 14 Dec 2020 13:14:00 -0800 (PST) Received: from [192.168.0.41] (174-16-97-231.hlrn.qwest.net. [174.16.97.231]) by smtp.gmail.com with ESMTPSA id j124sm15825817qkf.113.2020.12.14.13.13.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Dec 2020 13:14:00 -0800 (PST) Subject: Re: cacheflush.2 To: "Alejandro Colomar (man-pages)" , Heinrich Schuchardt , "Michael Kerrisk (man-pages)" Cc: linux-man@vger.kernel.org, Dave Martin , cfe-users@lists.llvm.org, gcc@gcc.gnu.org References: <794cf0d1-d528-4b5a-3ce0-b1b5f588dc6d@gmx.de> <5257a883-29f0-6eaa-5708-d1f47356a57a@gmx.de> <90152ea6-f2eb-b08f-7269-f8266ffb15d1@gmail.com> From: Martin Sebor Message-ID: <52a37c46-3488-957c-fc50-6caca177cb3c@gmail.com> Date: Mon, 14 Dec 2020 14:13:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, KAM_SHORT, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Dec 2020 21:14:02 -0000 On 12/11/20 11:14 AM, Alejandro Colomar (man-pages) via Gcc wrote: > It looks like GCC recently moved from 'char *' to 'void *'. > This SO question[1] (4 years ago) quotes the GCC docs > and they had 'char *'. __builtin___clear_cache in GCC has always been declared to take void*. The signature in the manual was recently corrected to match the implementation, i.e., from char* to void*, in r269082. Martin > Maybe Clang hasn't noticed the change. > I'll report a bug. > > [1]: https://stackoverflow.com/q/35741814/6872717 > > On 12/9/20 8:15 PM, Alejandro Colomar (man-pages) wrote: >> Hi Heinrich, >> >> It looks like a bug (or at least an undocumented divergence from GCC) in >> Clang/LLVM. Or I couldn't find the documentation for it. >> >> Clang uses 'char *': >> https://github.com/llvm/llvm-project/blob/7faf62a80bfc3a9dfe34133681fcc31f8e8d658b/clang/include/clang/Basic/Builtins.def#L583 >> >> GCC uses 'void *': >> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html >> >> I CCd Clang and GCC lists; maybe they know about that divergence. >> >> Cheers, >> >> Alex >> >> On 12/9/20 7:48 PM, Heinrich Schuchardt wrote: >>> On 12/9/20 7:34 PM, Alejandro Colomar (man-pages) wrote: >>>> Hi Heinrich & Michael, >>>> >>>> What about the following?: >>>> >>>> [ >>>> NOTES >>>>         GCC provides a similar function, which may be useful on  archi‐ >>>>         tectures that lack this system call: >>>> >>>>             void __builtin___clear_cache(void *begin, void *end); >>>> ] >>> >>> I just checked building with Clang/LLVM. There the arguments are of type >>> (char *). See the following error output: >>> >>> +arch/sandbox/cpu/cache.c:19:26: error: passing 'uint8_t *' (aka >>> 'unsigned char *') to parameter of type 'char *' converts between >>> pointers to integer types with different sign [-Werror,-Wpointer-sign] >>> +        __builtin___clear_cache(state->ram_buf, >>> +                                ^~~~~~~~~~~~~~ >>> +arch/sandbox/cpu/cache.c:20:12: error: passing 'uint8_t *' (aka >>> 'unsigned char *') to parameter of type 'char *' converts between >>> pointers to integer types with different sign [-Werror,-Wpointer-sign] >>> +                                state->ram_buf + state->ram_size); >>> +                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> >>> Best regards >>> >>> Heinrich >>> >>>> >>>> Cheers, >>>> >>>> Alex >>>> >>>> On 12/9/20 7:04 PM, Heinrich Schuchardt wrote: >>>>> Hello Michael, >>>>> >>>>> function cacheflush() does not exist on many architectures. >>>>> >>>>> It would have saved me a lot of time if the man-page had referenced >>>>> GCC's >>>>> >>>>> void __builtin___clear_cache(void *begin, void *end) >>>>> >>>>> Maybe you can add it to NOTES. >>>>> >>>>> Best regards >>>>> >>>>> heirnich >>>> >>> >> >