From patchwork Mon Jun 24 16:22:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 11013771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3024313B4 for ; Mon, 24 Jun 2019 16:23:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21B3E28B01 for ; Mon, 24 Jun 2019 16:23:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1550028B3E; Mon, 24 Jun 2019 16:23:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3DC1228B01 for ; Mon, 24 Jun 2019 16:23:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 624F489CF1; Mon, 24 Jun 2019 16:23:24 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 323FA89CE0; Mon, 24 Jun 2019 16:23:23 +0000 (UTC) Received: from submarine.cbg.collabora.co.uk (unknown [IPv6:2a00:5f00:102:0:6dae:eb08:2e0f:5281]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: gtucker) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id E6A6A287B1F; Mon, 24 Jun 2019 17:23:21 +0100 (BST) From: Guillaume Tucker To: Arkadiusz Hiler , Petri Latvala , "Ser, Simon" Date: Mon, 24 Jun 2019 17:22:33 +0100 Message-Id: <23b863385d39309b9294684d8156647901a4e1d3.1561393147.git.guillaume.tucker@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v4 1/4] meson: add libatomic dependency X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Add conditional dependency on GCC's libatomic in order to be able to use the __atomic_* functions instead of the older __sync_* ones. The libatomic library is only needed when there aren't any native support on the current architecture, so a linker test is used for this purpose. This makes atomic operations available on a wider number of architectures including MIPS. Signed-off-by: Guillaume Tucker Reviewed-by: Simon Ser --- Notes: v2: add linker test for libatomic v3: use null_dep v4: fix sentence in commit message meson.build | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/meson.build b/meson.build index b1028ee6aaaf..f0cb2543ca64 100644 --- a/meson.build +++ b/meson.build @@ -180,6 +180,20 @@ realtime = cc.find_library('rt') dlsym = cc.find_library('dl') zlib = cc.find_library('z') +if cc.links(''' +#include +int main(void) { + uint32_t x32 = 0; + uint64_t x64 = 0; + __atomic_load_n(&x32, __ATOMIC_SEQ_CST); + __atomic_load_n(&x64, __ATOMIC_SEQ_CST); + return 0; +}''', name : 'built-in atomics') + libatomic = null_dep +else + libatomic = cc.find_library('atomic') +endif + if cc.has_header('linux/kd.h') config.set('HAVE_LINUX_KD_H', 1) endif