Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp736615pxu; Thu, 3 Dec 2020 11:16:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJykPetgi0jnCMrWa+JrW/CmLU95PPV63tVWOo+bKZV0HU+UKqbJU7avWUUMy1UKIgeE/Rat X-Received: by 2002:a17:906:85cf:: with SMTP id i15mr4011193ejy.373.1607023018065; Thu, 03 Dec 2020 11:16:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607023018; cv=none; d=google.com; s=arc-20160816; b=sf29ouxGsWaqZkMyzJiI7VyvuPvMXV0hMat9/mcqRXRmXGVQ0hxIp7DZEh0Uu7eDJA rrbosTW/546rOqLU3WZYXcaPZRMiiz+Y/njCXYOrG6Mpzvx8m5vcwcHeQSdYqeKCbvRR +dmALStQ+uEMHfXqKT5HPdDtlrXf09sYJNRDCcVi4EtVfWW9gcfS7SBBxDmkmk4kEwq+ ke8AyQ1x7Fvx2p82tJ7oj6iytft12Fa2Wy6W+HUIWI6DtoEjXPSbXKDVVTXEo9A3DHnf LX3m7XrquL2W1I1LvoQWRksIPydWdhlY3s5FSx9edi3MQ+AH4aARhz67npLl/6XSy2x3 1P6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=IbyQm/n8+pi2q0Ky7fqqHIueT8J7malorhV/m8hIHd0=; b=g6iDDSf88TdRgrjfLeVm4bnXrEV4s8sht+R1ZVr/CqNKYYFwzdvXwLqxIbtrDtMJIT Qo5LGC2SL2/azuawWPj0hmgHofjTs1d0iVweNsqcZplg1fLQovf/BanjtLgBy+LlfssE 2O2nfQKoWyvWGK7rDsUvJHnPikH0nPyQQJJ+gN74gs/8/Hfu7ms9gGoNe0QucGWbLoc8 yJtJHRtLPk3KOhrfnxvF3aforM1ylGift4f3/zQ7x9XgTJO0EbWMSK2j26le4wEuOEiT e8iSEJXEejhj3i85UlKujJnz5+uILAy5M9Ws2HrTyorm4nIcN2FdQ43eUk8vsFXGOkXd kXJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Nurb0bQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t21si1513917edq.546.2020.12.03.11.16.34; Thu, 03 Dec 2020 11:16:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Nurb0bQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731188AbgLCQEy (ORCPT + 99 others); Thu, 3 Dec 2020 11:04:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbgLCQEx (ORCPT ); Thu, 3 Dec 2020 11:04:53 -0500 Received: from mail-wm1-x34a.google.com (mail-wm1-x34a.google.com [IPv6:2a00:1450:4864:20::34a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 984DBC061A4E for ; Thu, 3 Dec 2020 08:03:34 -0800 (PST) Received: by mail-wm1-x34a.google.com with SMTP id v5so1680599wmj.0 for ; Thu, 03 Dec 2020 08:03:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=IbyQm/n8+pi2q0Ky7fqqHIueT8J7malorhV/m8hIHd0=; b=Nurb0bQUXgEwLKlH5E+dwxUOfz6ZXl/yQpQCvW3kVvQiJ2raqNbOIazSDz9hNWteRv +LvxNCxOuTAnxMk8JjZ3Qtj2MFeuGLY/cCt/E6bvMZKUtwH/Vr5zo88LCYux8jXHt9IL iP2g4OF7JFbLDleVFjYUSBewEgColqkcr4Bhr7k79rR08y33F1Su5i8Zg6eU093n9HP3 8rnyG4VwE+aTRu1+LOCCnKtEcbyaBSvkluzY+ijUltDeczBfmQSdqiBLSoF4nkXe6QQx EtbumVv2MTkwa8D38k+kIrgtW8GM2AFDu40LM8e+C89nIA5kGZK/MYSzZbUNVfnPzZOS ZLeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=IbyQm/n8+pi2q0Ky7fqqHIueT8J7malorhV/m8hIHd0=; b=gry5U6Sr1yOnF2x1NVuZLm+U1iHakdiW/JIvAuD2w/Rgl0phOJgubnVNzYomytuVpi tRLTCsIrU+WPKghHf00ToABff7/t+vEVOCOHGg1Vzj9qng3elXLGnLHpGyjX84nIMP8T dbWHEhuNFFe8Dfn+7rVMrWVwn6gyg43qfNeBBKdtd85HiInJLpo0TlOc44xm4tSaLH8R 0jDOrSpFLK5erQrmYrouUiaGjgTo/1RS/auw3UucfNuB1Tsrb97zwq13L2EVFyuct/RT V0EFkspRBQCCR92nqimNVU0uQwsA4TR8g2nvJIAjawN8VH9rBeOrDPmHty+X1Q5Rs1iU wS4Q== X-Gm-Message-State: AOAM532D6TKJVzZuYUTjCW7fE676aJPstevsxlvHdzPZ1U4cscWn3CsC mBm+VbAe7vygSqrfCm7VLycNi9WVWqCIOw== Sender: "jackmanb via sendgmr" X-Received: from beeg.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:11db]) (user=jackmanb job=sendgmr) by 2002:a1c:3d86:: with SMTP id k128mr4029962wma.66.1607011412987; Thu, 03 Dec 2020 08:03:32 -0800 (PST) Date: Thu, 3 Dec 2020 16:02:42 +0000 In-Reply-To: <20201203160245.1014867-1-jackmanb@google.com> Message-Id: <20201203160245.1014867-12-jackmanb@google.com> Mime-Version: 1.0 References: <20201203160245.1014867-1-jackmanb@google.com> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH bpf-next v3 11/14] tools build: Implement feature check for BPF atomics in Clang From: Brendan Jackman To: bpf@vger.kernel.org Cc: Alexei Starovoitov , Yonghong Song , Daniel Borkmann , KP Singh , Florent Revest , linux-kernel@vger.kernel.org, Jann Horn , Brendan Jackman , Arnaldo Carvalho de Melo , Jiri Olsa , Quentin Monnet , "Frank Ch. Eigler" , Stephane Eranian , Namhyung Kim , Thomas Hebb Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change-Id: Ia15bb76f7152fff2974e38242d7430ce2987a71e Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Quentin Monnet Cc: "Frank Ch. Eigler" Cc: Stephane Eranian Cc: Namhyung Kim Cc: Thomas Hebb Change-Id: Ie2c3832eaf050d627764071d1927c7546e7c4b4b Signed-off-by: Brendan Jackman --- tools/build/feature/Makefile | 4 ++++ tools/build/feature/test-clang-bpf-atomics.c | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 tools/build/feature/test-clang-bpf-atomics.c diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index cdde783f3018..81370d7fa193 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -70,6 +70,7 @@ FILES= \ test-libaio.bin \ test-libzstd.bin \ test-clang-bpf-co-re.bin \ + test-clang-bpf-atomics.bin \ test-file-handle.bin \ test-libpfm4.bin @@ -331,6 +332,9 @@ $(OUTPUT)test-clang-bpf-co-re.bin: $(CLANG) -S -g -target bpf -o - $(patsubst %.bin,%.c,$(@F)) | \ grep BTF_KIND_VAR +$(OUTPUT)test-clang-bpf-atomics.bin: + $(CLANG) -S -g -target bpf -mcpu=v3 -Werror=implicit-function-declaration -o - $(patsubst %.bin,%.c,$(@F)) 2>&1 + $(OUTPUT)test-file-handle.bin: $(BUILD) diff --git a/tools/build/feature/test-clang-bpf-atomics.c b/tools/build/feature/test-clang-bpf-atomics.c new file mode 100644 index 000000000000..8b5fcdd4ba6f --- /dev/null +++ b/tools/build/feature/test-clang-bpf-atomics.c @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2020 Google + +int x = 0; + +int foo(void) +{ + return __sync_val_compare_and_swap(&x, 1, 2); +} -- 2.29.2.454.gaff20da3a2-goog