From patchwork Sun Aug 18 16:29:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerald Pfeifer X-Patchwork-Id: 1148868 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507193-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=pfeifer.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="S5kz3acQ"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46BMv86mSBz9s3Z for ; Mon, 19 Aug 2019 02:28:50 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; q=dns; s=default; b=k1xHZldgOVP0zgAZ dTT3ccEkwnU1DNElXCu06uwACqJscGIE0kYFU5FtQ8BYHuI6giIqiHjt2oudbzta QZJZxOpywyLFLd+JHD4+AZpkJa0l1riGU+iJJFECcD4saZuj0TE0vh5pvr6H57/3 Lc1ZkYAul/ziN7UhHG4p3b1JzUI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; s=default; bh=i/Pv2DkwOlwPWxnjNE1Eoy Ycdm8=; b=S5kz3acQVC/5rIz4p+ZvJ89K4Fo+WGKb+8B6b6IxqlKBHOIiQ6nWOx RZJe8m3ZWLRyKk9hEU0iT24vWRzwIJUDGtRFo7EO/WEuwjci6nYTLt+mi/ddbYtb v1rWt7BYMfEpRrC8AdpvqGujbmXOebDcUcv0qMbj8rAPmDKxHZXCE= Received: (qmail 96708 invoked by alias); 18 Aug 2019 16:28:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 96654 invoked by uid 89); 18 Aug 2019 16:28:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*Ad:U*andreast, unconditionally, jakub, you! X-HELO: hamza.pair.com Received: from hamza.pair.com (HELO hamza.pair.com) (209.68.5.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 18 Aug 2019 16:28:40 +0000 Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id EB1E333DE7; Sun, 18 Aug 2019 12:28:37 -0400 (EDT) Received: from anthias (unknown [178.114.243.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id 33F9C33DE4; Sun, 18 Aug 2019 12:28:37 -0400 (EDT) Date: Sun, 18 Aug 2019 18:29:01 +0200 (CEST) From: Gerald Pfeifer To: Jakub Jelinek cc: gcc-patches@gcc.gnu.org, Andreas Tobler , Alexander Kabaev Subject: [PATCH, i386] Don't use errno when freestanding (was: config/i386/xmmintrin.h: Only #include if __STDC_HOSTED__) In-Reply-To: <20171209184549.GE2353@tucnak> Message-ID: References: <20171209184549.GE2353@tucnak> MIME-Version: 1.0 X-IsSubscribed: yes On Sat, 9 Dec 2017, Jakub Jelinek wrote: >> Some users on FreeBSD noticed a problem when trying to use GCC to >> build things in a standalone environment that manifests itself as >> >> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/xmmintrin.h:34 from >> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/immintrin.h:29 from >> /workspace/src/sys/crypto/aesni/intel_sha256.c:62 >> In function '_mm_malloc': >> /usr/local/lib/gcc/x86_64-unknown-freebsd11.0/6.3.0/include/mm_malloc.h:39: >> error: 'errno' undeclared (first use in this function) >> >> It turns out the clang version of xmmintrin.h does not include mm_malloc.h >> if !__STDC_HOSTED__ whereas ours unconditionally does so. > > Wouldn't it be better to just ifdef out parts of gmm_malloc.h (pmm_malloc.h > should be ok)? Very good point, Jakub. Thank you! Somehow I thought I had submitted this updated patch, but apparently not so. :-( (This has been on my autotester for ages.) Okay? And if so, okay for GCC 9 after a while? Gerald 2019-08-18 Gerald Pfeifer * config/i386/gmm_malloc.h: Only include errno.h and use errno if __STDC_HOSTED__. Index: config/i386/gmm_malloc.h =================================================================== --- config/i386/gmm_malloc.h (revision 274618) +++ config/i386/gmm_malloc.h (working copy) @@ -25,7 +25,9 @@ #define _MM_MALLOC_H_INCLUDED #include +#if __STDC_HOSTED__ #include +#endif static __inline__ void * _mm_malloc (size_t __size, size_t __align) @@ -36,7 +38,9 @@ _mm_malloc (size_t __size, size_t __align) /* Error if align is not a power of two. */ if (__align & (__align - 1)) { +#if __STDC_HOSTED__ errno = EINVAL; +#endif return ((void *) 0); }