From patchwork Thu Dec 3 16:02:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan Jackman X-Patchwork-Id: 11949065 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB320C1B0D8 for ; Thu, 3 Dec 2020 16:05:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5CB5207A9 for ; Thu, 3 Dec 2020 16:05:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731180AbgLCQEs (ORCPT ); Thu, 3 Dec 2020 11:04:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbgLCQEr (ORCPT ); Thu, 3 Dec 2020 11:04:47 -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 B0A8AC09424B for ; Thu, 3 Dec 2020 08:03:34 -0800 (PST) Received: by mail-wm1-x34a.google.com with SMTP id o203so1479063wmo.3 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=EQvYVAg9bX6CzKl93dYE/YIHzUjE5ZCirc5DfmcddZH+9Ve88dVeUqnNRd1+sBN9tu K//LO2eRxjaTWmMhwBNiPzbV6al7kj0skc5lJsMHWzT5v5hcmDjpsWHoBvBx74i6jICG umDLD83H4vbwPL7X7oVliB2r+ByBhTBL03eqfwZUEGbVGAi5cHO3guh31dJOqWbZpqJ3 33RLrqY+Mo7tfISbVytpGwgOugr5yOEbu/QkHx+toirZKVP0JLE6uVj6Q3QviwDoyJGc FCVTcVCVJEXgVALcE3fVNyGLV5FqBliXaxUQXn32oFGsbFTjCoBosLP3wRwCRE1SR/CX JbJA== X-Gm-Message-State: AOAM531W0ngIUeylEKkdFiUN2sLlVF+tp2Jwq82EyfaXfoSlaBRwIhO0 PGSUnXKH1oBsa6UeJL4wdfDUNjGSpB3YwIIFfGo9WOZR/2FSG6dioFMQftvBXsMjGxgNEvUEhGO 9rllfBS/e+qfXrfDEsnWJcsiq+YSsp0p+QCx4QtGihP3bUBixKp/CUCKMXHg9QbU= X-Google-Smtp-Source: ABdhPJwODx9KkTc4wAZ00voMZnuvUvFetzDzkNineD7k8tCokZqHIMO8OE449/1wHAHd88n53eCq7kCl9djk9A== 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 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net 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); +}