From owner-freebsd-toolchain@freebsd.org Wed Dec 9 11:44:45 2020 Return-Path: Delivered-To: freebsd-toolchain@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11B53479596 for ; Wed, 9 Dec 2020 11:44:45 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4CrZwD5yDNz4nj3 for ; Wed, 9 Dec 2020 11:44:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by mailman.nyi.freebsd.org (Postfix) id CC34F479595; Wed, 9 Dec 2020 11:44:44 +0000 (UTC) Delivered-To: toolchain@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA73F47934E; Wed, 9 Dec 2020 11:44:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CrZwD254gz4nj2; Wed, 9 Dec 2020 11:44:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 2106329D88; Wed, 9 Dec 2020 11:44:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id CFC814E18F; Wed, 9 Dec 2020 12:44:42 +0100 (CET) From: "Kristof Provost" To: "Dimitry Andric" Cc: freebsd-riscv@freebsd.org, toolchain@freebsd.org Subject: Re: devel/glib20 build issue Date: Wed, 09 Dec 2020 12:44:42 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: <3BC510E6-F7FC-4341-B715-66472F3640BF@FreeBSD.org> References: <54177870-E411-4DF1-901E-94FE7E5F553F@FreeBSD.org> <3BC510E6-F7FC-4341-B715-66472F3640BF@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2020 11:44:45 -0000 On 19 Nov 2020, at 11:59, Dimitry Andric wrote: > On 19 Nov 2020, at 11:57, Kristof Provost wrote: >> >> While trying to build assorted ports on RISC-V I found that >> devel/glib20 doesn’t build. >> It turns out to be due to a missing >> __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 define. That define is implicitly >> set by the toolchain. Or, at least, it is on other platforms (ARM, >> MIPS, x86, …), but not on RISC-V. >> >> That’s likely just been forgotten. The following toolchain patch >> fixes that for me: >> >> diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp >> b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp >> index 4ba703c8dd1..73f1b5bc446 100644 >> --- a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp >> +++ b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp >> @@ -115,8 +115,14 @@ void RISCVTargetInfo::getTargetDefines(const >> LangOptions &Opts, >> Builder.defineMacro("__riscv_muldiv"); >> } >> >> - if (HasA) >> + if (HasA) { >> Builder.defineMacro("__riscv_atomic"); >> + Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); >> + Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); >> + Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4"); >> + if (Is64Bit) >> + >> Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8"); >> + } >> >> if (HasF || HasD) { >> Builder.defineMacro("__riscv_flen", HasD ? "64" : "32"); > > Hi Kristof, > > Can you please submit this upstream? We already have way too many > gratuitous RISC-V differences that haven't been upstreamed. > This https://reviews.llvm.org/D91784 got merged upstream. How do you feel about cherry-picking that into our tree? (I can do it, or you can, I don’t have feelings either way). It’d fix building glib20 on RISC-V and unblock a bunch of ports. We’ll get it eventually though the next LLVM update, but I’m impatient. Best regards, Kristof