From patchwork Fri Aug 30 00:50:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155601 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kCLWWa8C"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLWD2VHTz9sN6 for ; Fri, 30 Aug 2019 10:50:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbfH3Auq (ORCPT ); Thu, 29 Aug 2019 20:50:46 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:43629 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727139AbfH3Auo (ORCPT ); Thu, 29 Aug 2019 20:50:44 -0400 Received: by mail-lj1-f195.google.com with SMTP id h15so4785557ljg.10 for ; Thu, 29 Aug 2019 17:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Uyna4IYOJol121SLmRwAZvx/NaOoPDVjYK6GTYbGUpc=; b=kCLWWa8CrxMwJCc3us4OMb8Z4KxeYvEnIDyQFEEyN+J2uzU3tej/3tlqELGg51s510 Hx6FevFLPM/rW9mn0TSPGLrFyZdU6GgtFt0G6VlDwBwg2z9T4kV5uiNUBxi6zOGGGkJi EM8Wepqm3ulk4jB04e2UspjIt0F9jNtMphdz7dcZNmhdaQOLOKo4Ib3a8U488jLM5PK4 f+21fUenLBmLcDN/uGf5mOGRC8y6460M/FviJOCMebLC2pF4tXTUBvvZhDmDPVSv28Mk BI73jiSk0NojKt3fQTjexjSwQHhZf+i/x5gkVDbVmTy1jSWDE1mgCJu/E1vKe4LXDflk cS6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Uyna4IYOJol121SLmRwAZvx/NaOoPDVjYK6GTYbGUpc=; b=SD6LhS6Td8TSBr/dV4EdJ1LzcsxdMUWIjrxjKejqYB+Wq809HmyundYDBSyfYJbzt4 2QO9PixYzhclctPJ2mdPlbioIDHjw8o7bNqFVcIhxNB1DR7tpEqqqOEL1FaRrBOqHULc 8ksUJjjOsp3U9OJhqT2BImpa7R4oJh4A78Es58aDYQUe3Hpiwla9awIx9/TcR11dsXdz dhPQN5lLrOMD2zOu5K3ododV2WXpd9TfwRGsEUq1oxF4/on1oQFf7Hi0pr8P0shnisEi UaF1oqxY5MjFSij4eVUt6uXJYUt2+8jC5/QQWuhl6/Uv8uieSOgmkA9nq2+azqHq20bn If1A== X-Gm-Message-State: APjAAAW8gTsRsEuh5N7WF/34BqSAUEfd4fJm3BcIESht0oRSal2xZOkt zSTwN/c6Z/sqCeFeK1ux4TWyHg== X-Google-Smtp-Source: APXvYqwczd6nt8u3EfpPxDPMTye3gjY7N3FR/dqe8OYgFULHyQXUnfqd7PQD/tD94qNCi+yyNnGlYQ== X-Received: by 2002:a2e:8455:: with SMTP id u21mr6903469ljh.20.1567126243059; Thu, 29 Aug 2019 17:50:43 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:42 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 01/10] samples: bpf: Makefile: use --target from cross-compile Date: Fri, 30 Aug 2019 03:50:28 +0300 Message-Id: <20190830005037.24004-2-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For cross compiling the target triple can be inherited from cross-compile prefix as it's done in CLANG_FLAGS from kernel makefile. So copy-paste this decision from kernel Makefile. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 1d9be26b4edd..61b7394b811e 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -196,6 +196,8 @@ BTF_PAHOLE ?= pahole # Detect that we're cross compiling and use the cross compiler ifdef CROSS_COMPILE HOSTCC = $(CROSS_COMPILE)gcc +CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%)) +else CLANG_ARCH_ARGS = -target $(ARCH) endif From patchwork Fri Aug 30 00:50:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155615 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FCvja2RR"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLX94619z9sNk for ; Fri, 30 Aug 2019 10:51:37 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727717AbfH3Aut (ORCPT ); Thu, 29 Aug 2019 20:50:49 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:40680 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727486AbfH3Auq (ORCPT ); Thu, 29 Aug 2019 20:50:46 -0400 Received: by mail-lj1-f195.google.com with SMTP id e27so4793814ljb.7 for ; Thu, 29 Aug 2019 17:50:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LKaVdiULHZHeM3qmwqXGbS3W/6JSevNYH66TL2VqMJs=; b=FCvja2RR0Kl7bYsDQOOUQUjMRFvKXGR7eNe2NgdFDmbxw/n8dJHTjUoGSI+mau6Y+4 Nur0MR6ogMXxJ5zfyi7m9Wy9jxTs0li83IAoNnO3od01GnS9Hqlng6pvxCjHf6xEnMyr augAVWdm8PjLCzmGgLHygy3NIRgFB7JySVZRBQN0s3ZKjzbUAEdFIJqIzM5lHjreRvGG snI7tdFTUKcqaa8IwauSlZkbGJE8QEkzS8ZNg5oOiKBIMrKDtwadtIdeZ6JwNYKeJIn3 tKv1ox5CdWMtkIaJu0sJl+tRU4qXmxLrhXLswctpqbwRgon6CnOE9jLR+4q5IXCY6JhA KYLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LKaVdiULHZHeM3qmwqXGbS3W/6JSevNYH66TL2VqMJs=; b=dqrKHqr/6mlnL75y1zFoVvpQEL/UDazVaFFq1EJk0V5WyfI+OveYRV0lAn18DLi1bA scRxh4ukuAOoDYGUkchDrLl5tBU6W1DUTG+9y88EdqOm7lRqjOS53FD/BMnS8q1j+V7M aS/k5l5y3QaiHB/SgONK3iBJ7C2EpMP9UrNs5Zf9CH/ydmZf+IdNJMnNchmp8GXA/MEs NFaNqJP9Oyq4cb0XUqki+OfED4mioAjpEyONyUb1FCSPe0lmb6nqZCmoKOGg7KiGpDzC z4jZsNlUfl9a2k9QIJSho9I12YPiFmQo8n7oMX6GmqR8sH2WbMttL4RIJFj0+WnqVKvQ g4VA== X-Gm-Message-State: APjAAAW5lJUaeDGTize8XvIYc/pgUiuoLZGj2ouzSemVDjuLeyfft2Rf HxQYYZ3RNx8exYIHUzoN9DTtuQ== X-Google-Smtp-Source: APXvYqwr9VPhPuNlVvj3eJbScYt62A3rntuEmrXbOlRiE2Zq78tGV5NynWDZnJoUv/97mud2fxSftg== X-Received: by 2002:a2e:970e:: with SMTP id r14mr6839936lji.204.1567126244471; Thu, 29 Aug 2019 17:50:44 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:43 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 02/10] samples: bpf: Makefile: remove target for native build Date: Fri, 30 Aug 2019 03:50:29 +0300 Message-Id: <20190830005037.24004-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org No need to set --target for native build, at least for arm, the default target will be used anyway. In case of arm, for at least clang 5 - 10 it causes error like: clang: warning: unknown platform, assuming -mfloat-abi=soft LLVM ERROR: Unsupported calling convention make[2]: *** [/home/root/snapshot/samples/bpf/Makefile:299: /home/root/snapshot/samples/bpf/sockex1_kern.o] Error 1 To make the platform to be known, only set to real triple helps: --target=arm-linux-gnueabihf or just drop the target key to use default one. Decision to just drop it and thus default target will be used, looks better. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 61b7394b811e..a2953357927e 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -197,8 +197,6 @@ BTF_PAHOLE ?= pahole ifdef CROSS_COMPILE HOSTCC = $(CROSS_COMPILE)gcc CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%)) -else -CLANG_ARCH_ARGS = -target $(ARCH) endif # Don't evaluate probes and warnings if we need to run make recursively From patchwork Fri Aug 30 00:50:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155617 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="biPM7KPd"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLXC4lcnz9sN6 for ; Fri, 30 Aug 2019 10:51:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727664AbfH3Aut (ORCPT ); Thu, 29 Aug 2019 20:50:49 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34878 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727563AbfH3Aur (ORCPT ); Thu, 29 Aug 2019 20:50:47 -0400 Received: by mail-lj1-f196.google.com with SMTP id l14so4830541lje.2 for ; Thu, 29 Aug 2019 17:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=baF6/BEW5KEVo2LOFkZZTRTkQs3Veu82MyQ6XaftpOU=; b=biPM7KPdLtnr+xQRNp5xESVEeouLUJKehD24Gd9ioxx2OUh6OIbrndSWFIo+qFylSI kWdpwF+J69U+3pO4IuT7c63y1CwY11q0cXDK5OXsQnG4N+5QSF0rdTNyreizSd4oQ8ux Am84VUumVDcjZ1RoEaa413ZVsTrv4I2GuzRZa59p3t9MedXqHlG7BxfFeXGP1smCN1Rm pj+FEwpD4ZadSIML4/3wTI9ldsdEy1/4SBL2pH8rHBRmKHSJVdGhBCPlnrs46hM1tr7p VF5+0TZbcNTyjM8g81MSG9ZbEwNHniA392B0IqMVwrg9G2ma9dMcEqh7oNjuVlu+1z81 Z/3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=baF6/BEW5KEVo2LOFkZZTRTkQs3Veu82MyQ6XaftpOU=; b=g7HhPFI1b4QshDOw/qYhCvK6A1jv30eoP2dKMol2EeJO3QObqwp0QoIlsaDPpvlV49 6tQufRi03ZFKq9FSl47O0qyyBma9SND64oj2pB33UClvhU2wh2oh4m46j3riKCA2ARkN JfShXz9pxbrHsRzhekwb7dMV3n9uGzTFUjh0Cv0InNA7vXxM8MF+XIJR2y09drXf7wDR CR2rZaw0zp9azZIG6kwAm6Sp+tDuE90jXovjbAqIdVhE72AdUGR1hDHadZFZv8ztsaCG xAlKd/ggrvSHOekHjrRvkvTxUAdDUhu93q0QR7rEpxo6H6f660CsMX3PXhmASOWdz1jk 7QUg== X-Gm-Message-State: APjAAAUF5ZM+/pKSFxcPWpxLuykEknC+W8TQ3CMt6N1EAZSJfj+I1qhA QDUfQCwnQv+sLw+N9597g7B0fw== X-Google-Smtp-Source: APXvYqwlf7D/N+8AETmyrADFpsR/4uDHEHGgehGXXJJxn9PraZ2fAYxITTtvWqzPcr0SP5k+C+brcg== X-Received: by 2002:a2e:900c:: with SMTP id h12mr6901426ljg.151.1567126245707; Thu, 29 Aug 2019 17:50:45 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:45 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 03/10] libbpf: Makefile: add C/CXX/LDFLAGS to libbpf.so and test_libpf targets Date: Fri, 30 Aug 2019 03:50:30 +0300 Message-Id: <20190830005037.24004-4-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In case of LDFLAGS and EXTRA_CC flags there is no way to pass them correctly to build command, for instance when --sysroot is used or external libraries are used, like -lelf. In follow patches this is used for samples/bpf cross-compiling. Signed-off-by: Ivan Khoronzhuk --- tools/lib/bpf/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile index 844f6cd79c03..d606d249e334 100644 --- a/tools/lib/bpf/Makefile +++ b/tools/lib/bpf/Makefile @@ -99,6 +99,10 @@ else CFLAGS := -g -Wall endif +ifdef EXTRA_CXXFLAGS + CXXFLAGS := $(EXTRA_CXXFLAGS) +endif + ifeq ($(feature-libelf-mmap), 1) override CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT endif @@ -179,8 +183,9 @@ $(BPF_IN): force elfdep bpfdep $(OUTPUT)libbpf.so: $(OUTPUT)libbpf.so.$(LIBBPF_VERSION) $(OUTPUT)libbpf.so.$(LIBBPF_VERSION): $(BPF_IN) - $(QUIET_LINK)$(CC) --shared -Wl,-soname,libbpf.so.$(VERSION) \ - -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@ + $(QUIET_LINK)$(CC) $(LDFLAGS) \ + --shared -Wl,-soname,libbpf.so.$(VERSION) \ + -Wl,--version-script=$(VERSION_SCRIPT) $^ -lelf -o $@ @ln -sf $(@F) $(OUTPUT)libbpf.so @ln -sf $(@F) $(OUTPUT)libbpf.so.$(VERSION) @@ -188,7 +193,7 @@ $(OUTPUT)libbpf.a: $(BPF_IN) $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ $(OUTPUT)test_libbpf: test_libbpf.cpp $(OUTPUT)libbpf.a - $(QUIET_LINK)$(CXX) $(INCLUDES) $^ -lelf -o $@ + $(QUIET_LINK)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDES) $^ -lelf -o $@ $(OUTPUT)libbpf.pc: $(QUIET_GEN)sed -e "s|@PREFIX@|$(prefix)|" \ From patchwork Fri Aug 30 00:50:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155613 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="LEYfqXzZ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLX13fRXz9sNk for ; Fri, 30 Aug 2019 10:51:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727741AbfH3Auu (ORCPT ); Thu, 29 Aug 2019 20:50:50 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:43574 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727595AbfH3Aut (ORCPT ); Thu, 29 Aug 2019 20:50:49 -0400 Received: by mail-lf1-f68.google.com with SMTP id q27so3951350lfo.10 for ; Thu, 29 Aug 2019 17:50:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Q+vZM4cZektdF572TqWkVl3QkOoJAXjpmJXjWwwbKzE=; b=LEYfqXzZUPeIuy93SH8GAssQsvlBou/hIWteBhvmXq1F9JVWj2wTkzeZdfRJclvOXa Ml9kVrTIeDyM2A/3eaEvzVK9/pGt5qEqzLTWvJqdBmLcHkvvh07Ut09wAvSKXrIMNobx r2RNchETr9Z4KWTcRDbMNJ6rLBGv3sDWxx1Z8Z5O54FYC/zPoXMdoQJR1eWto+H3GBER DlMphrpkhbPZGMzNxrWnt0/mC94HVFKOY0k+/6wVxcaRK9ftaqDrp/Dypqjz3DpeV74s 5LHndEkamECTgyLl93XSkTDSnp9E79AvMzRJuicO+St87f2BsjM+kyYugZH0KcXkbFhW G9ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Q+vZM4cZektdF572TqWkVl3QkOoJAXjpmJXjWwwbKzE=; b=t2nmsx6qJdNPFxGlMdD7G0n/iSQVDSW38DUp3XGFLiXuPTqA9miS7UgAeiXT9d+nmE y5EOEMnhPyCJfEvNORIrjwyF0SGUm3RInhV4rF2f3xGEzHeKcR4cldjX0bONvMGpx/2Q OaNSwJk7TS/pdWNZJ62EQNpbYCVqQnkCLdQrm+zw3LXHk21stHTZ3mkibVpHByomcL2A 7ZHhPUA2Z0rpy70pkIIVH14mMEzI+iAkVR7TgXNuONytqs/HuP+b2AMyhTWlOS2LWp/A 7RVK/KzA4Efy8XGpr5gFqx5tRFmVjdLSfLdgeCjq0eltHBapNWF602qfxjFGhMPCKcNi Y+Aw== X-Gm-Message-State: APjAAAW1EmhNI18Qjf8FeTA2dfvPAqIZN0KqjXqK0u3tv0FUbkTtl5PV s10ZK+sw6raDVkIQ45guHpjPmg== X-Google-Smtp-Source: APXvYqyihXTROPMaQ2wywc9lmAKFZbgnRCz1760bakTi1cPbibvD2WXzoa2W4G39kM/s/BUv/T280g== X-Received: by 2002:a19:ae0b:: with SMTP id f11mr2637945lfc.28.1567126246924; Thu, 29 Aug 2019 17:50:46 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:46 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 04/10] samples: bpf: use own EXTRA_CFLAGS for clang commands Date: Fri, 30 Aug 2019 03:50:31 +0300 Message-Id: <20190830005037.24004-5-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It can overlap with CFLAGS used for libraries built with gcc if not now then in following patches. Correct it here for simplicity. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index a2953357927e..cdd742c05200 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -219,10 +219,10 @@ BTF_LLVM_PROBE := $(shell echo "int main() { return 0; }" | \ /bin/rm -f ./llvm_btf_verify.o) ifneq ($(BTF_LLVM_PROBE),) - EXTRA_CFLAGS += -g + CLANG_EXTRA_CFLAGS += -g else ifneq ($(and $(BTF_LLC_PROBE),$(BTF_PAHOLE_PROBE),$(BTF_OBJCOPY_PROBE)),) - EXTRA_CFLAGS += -g + CLANG_EXTRA_CFLAGS += -g LLC_FLAGS += -mattr=dwarfris DWARF2BTF = y endif @@ -281,8 +281,8 @@ $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h # useless for BPF samples. $(obj)/%.o: $(src)/%.c @echo " CLANG-bpf " $@ - $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \ - -I$(srctree)/tools/testing/selftests/bpf/ \ + $(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(CLANG_EXTRA_CFLAGS) \ + -I$(obj) -I$(srctree)/tools/testing/selftests/bpf/ \ -D__KERNEL__ -D__BPF_TRACING__ -Wno-unused-value -Wno-pointer-sign \ -D__TARGET_ARCH_$(SRCARCH) -Wno-compare-distinct-pointer-types \ -Wno-gnu-variable-sized-type-not-at-end \ From patchwork Fri Aug 30 00:50:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155614 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OmaVkDBx"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLX23mhlz9sNp for ; Fri, 30 Aug 2019 10:51:30 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728099AbfH3Av3 (ORCPT ); Thu, 29 Aug 2019 20:51:29 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:43631 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727639AbfH3Auu (ORCPT ); Thu, 29 Aug 2019 20:50:50 -0400 Received: by mail-lj1-f193.google.com with SMTP id h15so4785690ljg.10 for ; Thu, 29 Aug 2019 17:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XM+El1wyypVfaXfQc7FxTfECR5DYv9zUGiXmgC/VC5g=; b=OmaVkDBxJbEbiNuH6B/lkHNi7X3Ced5VCYrN4v0FOemALIxV7B1RR9GTxi+wIA+o7S SBNyfehZvn7LwSQMr71oX1EDAOy9VvdgFs/9kHugoMQYd2qS/DSS2mvw8yXRcG/xHDV5 0mJnXZcKmURGOdcozYB23tdigAAVVt6MHRP2J5RqtdSKEIJwvommRUF3YZCu8WcJ+ZRQ 9xYKzJ+pyiAczzLTKz6YMx84NzIkCgZakeJ1s58kckrg9aSB/Vdpg5FlpqJZCT257v3w UK5VqvNfJ4lXH3Sy/1qHZ5bEXEsMC6tIogRp0+fgccQf0ld0ru8mbbg+8L8dATJfDqle zUkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XM+El1wyypVfaXfQc7FxTfECR5DYv9zUGiXmgC/VC5g=; b=JIVFoBSBURh3O7fRCJXts75J5+ovSoFxkptnh7OtrhZk8fHpyOUSUj+dBIrb91lPiV 4Wh0k0i81e9leAA/p1mAB9Qkfq1xkR/7lvJSChcKMRfplptHQFgH1r5d5wMKnHoouJui TYTOhLYhb2ZlscLDwPutQLA3cvARqW0h8ivAslR8ab0n5hqm/tAkiAPek07P4gXU6JBU O3iwjOGC/WUxr00233iWFPHbqHHaeFYV6STY5RuPKWnt4HKY+U30lOkye7kU6fLC9NaT 7Oc/EqIRfMsyNoKWMK8Hjgo0PrnKD6WS101d5Imd1T1vhwpGd7XFDnbheqSd5TC/v/+j 9Q1w== X-Gm-Message-State: APjAAAXh73NALWOXC8pp9wUfIKJaqXMk/fTLwpQ3CL0KyCPmfttqRq09 XJrX7VTvfA/qU0mzobBbm41gfQ== X-Google-Smtp-Source: APXvYqzmBCVvXKFOXoBDuj58+fjrCfnA51PDqBxjQDtiM9x+Qz3HalHYI72Y8f2Nsv+B0cm1QW0ySg== X-Received: by 2002:a2e:85d4:: with SMTP id h20mr7058874ljj.134.1567126248121; Thu, 29 Aug 2019 17:50:48 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:47 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 05/10] samples: bpf: Makefile: use vars from KBUILD_CFLAGS to handle linux headers Date: Fri, 30 Aug 2019 03:50:32 +0300 Message-Id: <20190830005037.24004-6-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The kernel headers are reused from samples bpf, and autoconf.h is not enough to reflect complete configuration for clang. One of such configurations is __LINUX_ARM_ARCH__ min version used as instruction set selector. In another case an error like "SMP is not supported" for arm and others errors are issued and final object is not correct. --- samples/bpf/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index cdd742c05200..9232efa2b1b3 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -186,6 +186,13 @@ HOSTLDLIBS_map_perf_test += -lrt HOSTLDLIBS_test_overhead += -lrt HOSTLDLIBS_xdpsock += -pthread +# Strip all expet -D options needed to handle linux headers +# for arm it's __LINUX_ARM_ARCH__ and potentially others fork vars +D_OPTIONS = $(shell echo "$(KBUILD_CFLAGS) " | sed 's/[[:blank:]]/\n/g' | \ + sed '/^-D/!d' | tr '\n' ' ') + +CLANG_EXTRA_CFLAGS += $(D_OPTIONS) + # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang LLC ?= llc From patchwork Fri Aug 30 00:50:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155611 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="pWeUz6Fu"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLWq3RqWz9sNC for ; Fri, 30 Aug 2019 10:51:19 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727809AbfH3Auw (ORCPT ); Thu, 29 Aug 2019 20:50:52 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39195 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727487AbfH3Auv (ORCPT ); Thu, 29 Aug 2019 20:50:51 -0400 Received: by mail-lj1-f194.google.com with SMTP id x4so4816013ljj.6 for ; Thu, 29 Aug 2019 17:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jGmbuQhjfybpgV20Mr6h/vZA852gJhY9ROLsc2sx8l8=; b=pWeUz6Fu6QfaqIpkcQ5NkN8S1IH2Rw5H5SVVq3jN6Pe8GO4Z0AVQ8kjAJ1nWq/suUY iy5IGz6OJY/dKJgiOzw4G0pKMu1jIKXgSEsnZrYt8T+GOll/c7PoRUL0YOgbZSy9nloJ xQxd5OltyxyzW8UXtE9De6EMr0kC0GBlbZxjYBn+ldgJ4QDJW8JzaEcfhzz1wiSK9Dz5 oXvnGjkb0/kodZDij7wbzY6bjZCsk+fZ1wdt4Hs8Okzlc+qRp1IHk7T8NLEWCvIR0xTc MloaK1lal5Wj6DiZQlLT3eOYVu3I68zMpgnlI+8rf0f0TnmBXaCq/zCKadOxwP6syzE7 hEMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jGmbuQhjfybpgV20Mr6h/vZA852gJhY9ROLsc2sx8l8=; b=YznbkmBVBRZH8/9xgD50/E+QCH41oUv8s0OmyxT2UMILH0ycHKVzD283iqaaMMep5I AB/r+DtW2eg0VXHouzIv4H4Th40lhRHa+WAU9Qey7PRnLVNuWuAR4qSeGu5L7xYnH2jW W1KBtULAICT0Gr/XiXUaPcKK0SFoACUgSr6+6rKRQ2K7gwEukg14QI6lB5NH2G7bufW7 8ni/faMCPwzoLlq3o8BHQcPq5viD/lEUPYjCGZe/CTTRBAVEaDFHlAAoUMHiO8SfR/HX 7Ktk68ivllNx4bWkHie2dglUeBU/qKzDs54vSSnXPWbSb5wFUxjlME1OBniAstByjv0h ZBtg== X-Gm-Message-State: APjAAAVeSJ9lZBnC464/7xKoe96KfS1i4ia0H6q4ciCfHUKsmzZsOOas 9B687deRnDzhpaxUr/e86IjlEQ== X-Google-Smtp-Source: APXvYqzI74aR/DPSKUQJi5BEbDzth7mLHwQxtSOpKT4d/woWDnrSZxBkUNITdgyD5sT4M1zqAQ6tfw== X-Received: by 2002:a2e:b004:: with SMTP id y4mr6683248ljk.124.1567126249466; Thu, 29 Aug 2019 17:50:49 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:48 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 06/10] samples: bpf: makefile: fix HDR_PROBE Date: Fri, 30 Aug 2019 03:50:33 +0300 Message-Id: <20190830005037.24004-7-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org echo should be replace on echo -e to handle \n correctly, but instead, replace it on printf as some systems can't handle echo -e. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 9232efa2b1b3..043f9cc14cdd 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -208,7 +208,7 @@ endif # Don't evaluate probes and warnings if we need to run make recursively ifneq ($(src),) -HDR_PROBE := $(shell echo "\#include \n struct list_head { int a; }; int main() { return 0; }" | \ +HDR_PROBE := $(shell printf "\#include \n struct list_head { int a; }; int main() { return 0; }" | \ $(HOSTCC) $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \ echo okay) From patchwork Fri Aug 30 00:50:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155609 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nauxkLeh"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLWn3X3Dz9sNC for ; Fri, 30 Aug 2019 10:51:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727883AbfH3AvQ (ORCPT ); Thu, 29 Aug 2019 20:51:16 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:34862 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727764AbfH3Aux (ORCPT ); Thu, 29 Aug 2019 20:50:53 -0400 Received: by mail-lf1-f67.google.com with SMTP id h27so3995576lfp.2 for ; Thu, 29 Aug 2019 17:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ia9Iohgefzn/RbnoIHs2aN928PonhCPU+GJ0mIg1xw0=; b=nauxkLeh1ZIxd8fP3xfh92I409w8DtNf/fnJmlw8/s9VqlgjubltPx0An1YWZH63Gp /TU66tFs3h09+jwh0GQFAkphSKeFfuTA4fyRKiDv+BGn8HEGJ0GQ8uWN5KtYMp4+0+Wt yeefhppCuIPIX3qDij/rrFlPldmQRE59HGCtjQQbAIwZDsunfz9iBC10S7GurulzO27V lVzBOobQwYJfYUmGpSLW5FCPoxlnTesIic63c8f9+TL2Fa3O+RTzLMrhS7+qwAGYHToD NhKirRP5II5myOl4O26T3M66TxYAY2Bdx9hqZThpHbkaBfucoIK/qhsrs16aksO8dxvB f0pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ia9Iohgefzn/RbnoIHs2aN928PonhCPU+GJ0mIg1xw0=; b=a9I+s4RNnfRt/fHHEoiLVz0mxfcJaoMvamcsBvSikx3HRaCdIgjfl6W7PZyv9kuBVc Hjx7CFSNrKJXcs7Snoiv4xRHuKIL1svArhf+Bc0qHyL9CdedXDN3odTSOgeUz4KT1X92 cDOpgoBsWCNQ4ZvGizE0SxoiRgC/bFtyT3k4FmFBFyqQ32OIvvSYEqknJbXQa+BaMZkj 8fzEKqz9IZCWUDS1mcQCAcz3fq1MINft6QQN7Awnoq88h+pdQqTlYo/OXEupgm+kJas3 DDuxAKQbpSvXFZNhFkZPcaFaiP/ARGIoweEco+/TOyplrLS5FFb9D7V08UM8C77/ZfdK QU2w== X-Gm-Message-State: APjAAAUwQKxHKq1hre2WDdodsACY1NIL+778yJgqINT4o3RlXcVxou/k i7D1jIEqEes6uXA2l2QXOZejlw== X-Google-Smtp-Source: APXvYqy1+wbSVRXaVz0I1Wy246SkFUj+yZxpo8NGJNvbTRSJX75MH0Q94N5wXdG//lglqP0UWSKwdg== X-Received: by 2002:ac2:5608:: with SMTP id v8mr7690120lfd.95.1567126250684; Thu, 29 Aug 2019 17:50:50 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:50 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 07/10] samples: bpf: add makefile.prog for separate CC build Date: Fri, 30 Aug 2019 03:50:34 +0300 Message-Id: <20190830005037.24004-8-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org The HOSTCC is supposed to build binaries and tools running on the host afterwards, in order to simplify build or so, like "fixdep" or else. In case of cross compiling "fixdep" is executed on host when the rest samples should run on target arch. In order to build binaries for target arch with CC and tools running on host with HOSTCC, lets add Makefile.prog for simplicity, having definition and routines similar to ones, used in script/Makefile.host. That allows later add cross-compilation to samples/bpf with minimum changes. Makefile.prog contains only stuff needed for samples/bpf, potentially can be reused and sophisticated for other prog sets later and now needed only for unblocking tricky samples/bpf cross compilation. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile.prog | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 samples/bpf/Makefile.prog diff --git a/samples/bpf/Makefile.prog b/samples/bpf/Makefile.prog new file mode 100644 index 000000000000..d5d02fbb5e6e --- /dev/null +++ b/samples/bpf/Makefile.prog @@ -0,0 +1,77 @@ +# SPDX-License-Identifier: GPL-2.0 +# ========================================================================== +# Building binaries on the host system +# Binaries are not used during the compilation of the kernel, and intendent to +# be build for target board, target board can be host ofc. Added to build +# binaries to run not on host system. +# +# Both C and C++ are supported, but preferred language is C for such utilities. +# +# Sample syntax (see Documentation/kbuild/makefiles.rst for reference) +# progs-y := xdpsock_example +# Will compile xdpsock_example.c and create an executable named xdpsock_example +# +# progs-y := xdpsock +# xdpsock-objs := xdpsock_user.o xdpsock_user2.o +# Will compile xdpsock.c and xdpsock.c, and then link the executable +# xdpsock, based on xdpsock_user.o and xdpsock_user2.o +# +# Inherited from scripts/Makefile.host +# +__progs := $(sort $(progs-y)) + +# C code +# Executables compiled from a single .c file +prog-csingle := $(foreach m,$(__progs), \ + $(if $($(m)-objs)$($(m)-cxxobjs),,$(m))) + +# C executables linked based on several .o files +prog-cmulti := $(foreach m,$(__progs),\ + $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m)))) + +# Object (.o) files compiled from .c files +prog-cobjs := $(sort $(foreach m,$(__progs),$($(m)-objs))) + +prog-csingle := $(addprefix $(obj)/,$(prog-csingle)) +prog-cmulti := $(addprefix $(obj)/,$(prog-cmulti)) +prog-cobjs := $(addprefix $(obj)/,$(prog-cobjs)) + +##### +# Handle options to gcc. Support building with separate output directory + +_progc_flags = $(PROGS_CFLAGS) \ + $(PROGCFLAGS_$(basetarget).o) + +# $(objtree)/$(obj) for including generated headers from checkin source files +ifeq ($(KBUILD_EXTMOD),) +ifdef building_out_of_srctree +_progc_flags += -I $(objtree)/$(obj) +endif +endif + +progc_flags = -Wp,-MD,$(depfile) $(_progc_flags) + +# Create executable from a single .c file +# prog-csingle -> Executable +quiet_cmd_prog-csingle = CC $@ + cmd_prog-csingle = $(CC) $(progc_flags) $(PROGS_LDFLAGS) -o $@ $< \ + $(PROGS_LDLIBS) $(PROGLDLIBS_$(@F)) +$(prog-csingle): $(obj)/%: $(src)/%.c FORCE + $(call if_changed_dep,prog-csingle) + +# Link an executable based on list of .o files, all plain c +# prog-cmulti -> executable +quiet_cmd_prog-cmulti = LD $@ + cmd_prog-cmulti = $(CC) $(progc_flags) $(PROGS_LDFLAGS) -o $@ \ + $(addprefix $(obj)/,$($(@F)-objs)) \ + $(PROGS_LDLIBS) $(PROGLDLIBS_$(@F)) +$(prog-cmulti): $(prog-cobjs) FORCE + $(call if_changed,prog-cmulti) +$(call multi_depend, $(prog-cmulti), , -objs) + +# Create .o file from a single .c file +# prog-cobjs -> .o +quiet_cmd_prog-cobjs = CC $@ + cmd_prog-cobjs = $(CC) $(progc_flags) -c -o $@ $< +$(prog-cobjs): $(obj)/%.o: $(src)/%.c FORCE + $(call if_changed_dep,prog-cobjs) From patchwork Fri Aug 30 00:50:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155606 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="aGgIzR5s"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLWj6m92z9sNC for ; Fri, 30 Aug 2019 10:51:13 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727992AbfH3AvI (ORCPT ); Thu, 29 Aug 2019 20:51:08 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38013 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727824AbfH3Auz (ORCPT ); Thu, 29 Aug 2019 20:50:55 -0400 Received: by mail-lj1-f193.google.com with SMTP id x3so4817820lji.5 for ; Thu, 29 Aug 2019 17:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eRu74lcVO6wVz56irfReRFgKKrKVWSF8s29xnt/RZAY=; b=aGgIzR5sxMevxwKrFIyIUyDYL1+Nx/1OC8zAJhAo/8dNBndVj2YmCvfj4i/zxgGBQ5 9edGcAC+kLpfo+7btqyQXLrPsDRjsU5GiMXrZ3F1bTwelUYM704o4c4HOhlb9i4g2T2G 46UcPIwAy05XmYLGl6WZEm82+FLAfxfQddpq5RM57C+zoFIgNj/WnvAj9M3P90P8JtVK fUQhcgTmih1w2KzIBZh2ceq9oweGUIxFdv9byIZH8yosJuMVvajEvIs+cuV9WSxGmoKX yK2E/F55R48zySZ4XYDK0bxU0szO5ISOj0W65i2/9aLaZho9b6vP+D9pYH9vnnHPIIXd /sVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eRu74lcVO6wVz56irfReRFgKKrKVWSF8s29xnt/RZAY=; b=qB5r/qn1qTXxW1jbUab+5bQevNrUKXGcG77C3LYN+umzuDko02gSTMC90ajcvD3OCh YQUhv33F9LS8lokpG7zA/qv3c59P/ZuESeiOq0hz8C7CoVEr74GSTBrtHBSDtThnCZDt BIgMWtz6xCkMjuk8KGo6FS/WTS0wA3aqRGO5ymrIi3Dy1fG6c7tUTe8RwxOipuXrKy5f kebC7/2y/oXjd8TiaoI4X/i8AW7xdxA3rqL7j+WqMBRAsUksd8Km+9MTEJAMGlEYLSHS R6cIxQNLuMkf9P9SQrjXfvcy1wNxzR1KWxmiC+2zV0mDiJzi7YuL441kUOswPKMTTSax zkiQ== X-Gm-Message-State: APjAAAW+pbRqavM91grHuouxrbyEkqvF743XRLsUsT/iH1KgeUn26+GC siPfTN+mlrW7J2wGCLFKw222GTGq6Q0= X-Google-Smtp-Source: APXvYqy6rek51YkaTV1nUhUOyqQ0yD+SP7FpICbjOhyO7EA98MykAeJdl6ufwnoeFlJrYhw0v9K3OA== X-Received: by 2002:a2e:9f02:: with SMTP id u2mr7121058ljk.4.1567126251915; Thu, 29 Aug 2019 17:50:51 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:51 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 08/10] samples: bpf: Makefile: base progs build on Makefile.progs Date: Fri, 30 Aug 2019 03:50:35 +0300 Message-Id: <20190830005037.24004-9-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The main reason for that - HOSTCC and CC have different aims. It was tested for arm cross compilation, based on linaro toolchain, but should work for others. In order to split cross compilation with host build, base bpf samples on Makefile.progs. I've verified it on arm with adding SYSROOT. It's also convenient when debug is with NFC. To cross-compile I've used: export ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf- make -j4 samples/bpf/ SYSROOT="path/to/sysroot" Sysroot contains correct headers installed ofc. Signed-off-by: Ivan Khoronzhuk --- samples/bpf/Makefile | 164 ++++++++++++++++++++++++----------------- samples/bpf/README.rst | 7 ++ 2 files changed, 102 insertions(+), 69 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 043f9cc14cdd..ed7131851172 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -4,55 +4,53 @@ BPF_SAMPLES_PATH ?= $(abspath $(srctree)/$(src)) TOOLS_PATH := $(BPF_SAMPLES_PATH)/../../tools # List of programs to build -hostprogs-y := test_lru_dist -hostprogs-y += sock_example -hostprogs-y += fds_example -hostprogs-y += sockex1 -hostprogs-y += sockex2 -hostprogs-y += sockex3 -hostprogs-y += tracex1 -hostprogs-y += tracex2 -hostprogs-y += tracex3 -hostprogs-y += tracex4 -hostprogs-y += tracex5 -hostprogs-y += tracex6 -hostprogs-y += tracex7 -hostprogs-y += test_probe_write_user -hostprogs-y += trace_output -hostprogs-y += lathist -hostprogs-y += offwaketime -hostprogs-y += spintest -hostprogs-y += map_perf_test -hostprogs-y += test_overhead -hostprogs-y += test_cgrp2_array_pin -hostprogs-y += test_cgrp2_attach -hostprogs-y += test_cgrp2_sock -hostprogs-y += test_cgrp2_sock2 -hostprogs-y += xdp1 -hostprogs-y += xdp2 -hostprogs-y += xdp_router_ipv4 -hostprogs-y += test_current_task_under_cgroup -hostprogs-y += trace_event -hostprogs-y += sampleip -hostprogs-y += tc_l2_redirect -hostprogs-y += lwt_len_hist -hostprogs-y += xdp_tx_iptunnel -hostprogs-y += test_map_in_map -hostprogs-y += per_socket_stats_example -hostprogs-y += xdp_redirect -hostprogs-y += xdp_redirect_map -hostprogs-y += xdp_redirect_cpu -hostprogs-y += xdp_monitor -hostprogs-y += xdp_rxq_info -hostprogs-y += syscall_tp -hostprogs-y += cpustat -hostprogs-y += xdp_adjust_tail -hostprogs-y += xdpsock -hostprogs-y += xdp_fwd -hostprogs-y += task_fd_query -hostprogs-y += xdp_sample_pkts -hostprogs-y += ibumad -hostprogs-y += hbm +progs-y := test_lru_dist +progs-y += sock_example +progs-y += fds_example +progs-y += sockex1 +progs-y += sockex2 +progs-y += sockex3 +progs-y += tracex1 +progs-y += tracex2 +progs-y += tracex3 +progs-y += tracex4 +progs-y += tracex5 +progs-y += tracex6 +progs-y += tracex7 +progs-y += test_probe_write_user +progs-y += trace_output +progs-y += lathist +progs-y += offwaketime +progs-y += spintest +progs-y += map_perf_test +progs-y += test_overhead +progs-y += test_cgrp2_array_pin +progs-y += test_cgrp2_attach +progs-y += test_cgrp2_sock +progs-y += test_cgrp2_sock2 +progs-y += xdp1 +progs-y += xdp2 +progs-y += xdp_router_ipv4 +progs-y += test_current_task_under_cgroup +progs-y += trace_event +progs-y += sampleip +progs-y += tc_l2_redirect +progs-y += lwt_len_hist +progs-y += xdp_tx_iptunnel +progs-y += test_map_in_map +progs-y += xdp_redirect_map +progs-y += xdp_redirect_cpu +progs-y += xdp_monitor +progs-y += xdp_rxq_info +progs-y += syscall_tp +progs-y += cpustat +progs-y += xdp_adjust_tail +progs-y += xdpsock +progs-y += xdp_fwd +progs-y += task_fd_query +progs-y += xdp_sample_pkts +progs-y += ibumad +progs-y += hbm # Libbpf dependencies LIBBPF = $(TOOLS_PATH)/lib/bpf/libbpf.a @@ -111,7 +109,7 @@ ibumad-objs := bpf_load.o ibumad_user.o $(TRACE_HELPERS) hbm-objs := bpf_load.o hbm.o $(CGROUP_HELPERS) # Tell kbuild to always build the programs -always := $(hostprogs-y) +always := $(progs-y) always += sockex1_kern.o always += sockex2_kern.o always += sockex3_kern.o @@ -171,26 +169,51 @@ always += ibumad_kern.o always += hbm_out_kern.o always += hbm_edt_kern.o -KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/bpf/ -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include -KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf - -HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable - -KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf -HOSTLDLIBS_tracex4 += -lrt -HOSTLDLIBS_trace_output += -lrt -HOSTLDLIBS_map_perf_test += -lrt -HOSTLDLIBS_test_overhead += -lrt -HOSTLDLIBS_xdpsock += -pthread - # Strip all expet -D options needed to handle linux headers # for arm it's __LINUX_ARM_ARCH__ and potentially others fork vars D_OPTIONS = $(shell echo "$(KBUILD_CFLAGS) " | sed 's/[[:blank:]]/\n/g' | \ sed '/^-D/!d' | tr '\n' ' ') +ifdef SYSROOT +ccflags-y += --sysroot=${SYSROOT} +ccflags-y += -I${SYSROOT}/usr/include +CLANG_EXTRA_CFLAGS := $(ccflags-y) +PROGS_LDFLAGS := -L${SYSROOT}/usr/lib +endif + +ccflags-y += -I$(srctree)/tools/lib/bpf/ +ccflags-y += -I$(srctree)/tools/testing/selftests/bpf/ +ccflags-y += -I$(srctree)/tools/lib/ +ccflags-y += -I$(srctree)/tools/perf + +ccflags-y += $(D_OPTIONS) +ccflags-y += -Wall +ccflags-y += -Wmissing-prototypes +ccflags-y += -Wstrict-prototypes +ccflags-y += -fomit-frame-pointer + +PROGS_CFLAGS := $(ccflags-y) + +ccflags-y += -I$(objtree)/usr/include +ccflags-y += -I$(srctree)/tools/include + +PROGCFLAGS_bpf_load.o += -I$(objtree)/usr/include -I$(srctree)/tools/include \ + -Wno-unused-variable +PROGCFLAGS_sampleip_user.o += -I$(srctree)/tools/include +PROGCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/include +PROGCFLAGS_trace_event_user.o += -I$(srctree)/tools/include +PROGCFLAGS_trace_output_user.o += -I$(srctree)/tools/include +PROGCFLAGS_tracex6_user.o += -I$(srctree)/tools/include +PROGCFLAGS_xdp_sample_pkts_user.o += -I$(srctree)/tools/include +PROGCFLAGS_xdpsock_user.o += -I$(srctree)/tools/include + +PROGS_LDLIBS := $(LIBBPF) -lelf +PROGLDLIBS_tracex4 += -lrt +PROGLDLIBS_trace_output += -lrt +PROGLDLIBS_map_perf_test += -lrt +PROGLDLIBS_test_overhead += -lrt +PROGLDLIBS_xdpsock += -pthread + CLANG_EXTRA_CFLAGS += $(D_OPTIONS) # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: @@ -202,15 +225,14 @@ BTF_PAHOLE ?= pahole # Detect that we're cross compiling and use the cross compiler ifdef CROSS_COMPILE -HOSTCC = $(CROSS_COMPILE)gcc CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%)) endif # Don't evaluate probes and warnings if we need to run make recursively ifneq ($(src),) HDR_PROBE := $(shell printf "\#include \n struct list_head { int a; }; int main() { return 0; }" | \ - $(HOSTCC) $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \ - echo okay) + $(CC) $(PROGS_CFLAGS) $(PROGS_LDFLAGS) -x c - -o /dev/null \ + 2>/dev/null && echo okay) ifeq ($(HDR_PROBE),) $(warning WARNING: Detected possible issues with include path.) @@ -246,7 +268,9 @@ clean: $(LIBBPF): FORCE # Fix up variables inherited from Kbuild that tools/ build system won't like - $(MAKE) -C $(dir $@) RM='rm -rf' LDFLAGS= srctree=$(BPF_SAMPLES_PATH)/../../ O= + $(MAKE) -C $(dir $@) RM='rm -rf' EXTRA_CFLAGS="$(ccflags-y)" \ + EXTRA_CXXFLAGS="$(ccflags-y)" LDFLAGS=$(PROGS_LDFLAGS) \ + srctree=$(BPF_SAMPLES_PATH)/../../ O= $(obj)/syscall_nrs.h: $(obj)/syscall_nrs.s FORCE $(call filechk,offsets,__SYSCALL_NRS_H__) @@ -283,6 +307,8 @@ $(obj)/hbm_out_kern.o: $(src)/hbm.h $(src)/hbm_kern.h $(obj)/hbm.o: $(src)/hbm.h $(obj)/hbm_edt_kern.o: $(src)/hbm.h $(src)/hbm_kern.h +-include $(BPF_SAMPLES_PATH)/Makefile.prog + # asm/sysreg.h - inline assembly used by it is incompatible with llvm. # But, there is no easy way to fix it, so just exclude it since it is # useless for BPF samples. diff --git a/samples/bpf/README.rst b/samples/bpf/README.rst index 5f27e4faca50..6b5e4eace977 100644 --- a/samples/bpf/README.rst +++ b/samples/bpf/README.rst @@ -74,3 +74,10 @@ samples for the cross target. export ARCH=arm64 export CROSS_COMPILE="aarch64-linux-gnu-" make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang + +If need to use environment of target board, the SYSROOT also can be set, +pointing on FS of target board: + +make samples/bpf/ LLC=~/git/llvm/build/bin/llc \ + CLANG=~/git/llvm/build/bin/clang \ + SYSROOT=~/some_sdk/linux-devkit/sysroots/aarch64-linux-gnu From patchwork Fri Aug 30 00:50:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155605 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="p+c78cGO"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLWf6BFwz9sNC for ; Fri, 30 Aug 2019 10:51:10 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728026AbfH3AvI (ORCPT ); Thu, 29 Aug 2019 20:51:08 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:40342 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727866AbfH3Auz (ORCPT ); Thu, 29 Aug 2019 20:50:55 -0400 Received: by mail-lf1-f67.google.com with SMTP id u29so3963148lfk.7 for ; Thu, 29 Aug 2019 17:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rseUd9y/GnXjRY8PsudxS8BEzI5o7BH/gE6GzGNAkz0=; b=p+c78cGOyUo6huk/pdHK4LHWxY05E5DmCBl6Y9TnX0wvtYNQzK7/aTvz75AqmlPGvA lX3zJWWhAuFN7kMzRbIe4MIRTgqe2XNObWdcxwvAYdo9v+NHqraV4ztUXFoSctAfudEb 6iWjcDghz5Lkpmgx4rrpBe3K+94vUyybq7SVTJP0KvecAGtDjApjNEeFXlxu6wHYQ2nG Aia65Ra96zxOxrfifKlzHZK+MklKrHz3P1CXW6V1T+wu0gkWFEF3j5zl9WfXVvgh/7Iz tX+fup/gKLffQChanaOEXwwKRLJP/Zl4iC0qpnp9r8NCvX0yAmZFBiQuq5bIQpJinAgf 23aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rseUd9y/GnXjRY8PsudxS8BEzI5o7BH/gE6GzGNAkz0=; b=oBHRlhuE+v6RetivpcPQvy4ciuHbcXHEuauuXn5KJ92fLitP8L1Ln2wK3FzXQrY1+F 0QCu/GYYCXkQ7Sc1EYdfr+RIvO+PgzklEqyhAU3YPjcuOe4em39mwwt8HSrIfEKVPuu+ FIlbj8whVFhx81VhHzJ9d98oZmh5AN9cci2g901SdC+V8NpfN3QZM641Qk5kqHamfAuM w4Pylt05/44+VP7Y9vx4+3HyXwowlc9jCoZ+BpNRPh0ov96guN+rmTJrSvTuVHHGfxFR b/SenFSXx7W3Fu0e0bagiG+ZpmxNDj7H5fgfg3FmA2Bjf4osATICc6wvbFUdRPJyoUOJ d0lA== X-Gm-Message-State: APjAAAX9Kh9YxoAAXyHGW36eHMblT07VdFRIKPoLLqiUlf8bW38cHn6N Hk0vs1KRcYIrlFKwOA+Ge957kQ== X-Google-Smtp-Source: APXvYqxNrtZrcEGcDIoDRzM60F5kluGphxsbk/1Bx4tLv8SvOizz47bOc1wno61j8h21RjFX5zUA3A== X-Received: by 2002:a19:e04f:: with SMTP id g15mr7384740lfj.46.1567126253185; Thu, 29 Aug 2019 17:50:53 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:52 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 09/10] arm: include: asm: swab: mask rev16 instruction for clang Date: Fri, 30 Aug 2019 03:50:36 +0300 Message-Id: <20190830005037.24004-10-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The samples/bpf with clang -emit-llvm reuses linux headers to build bpf samples, and this w/a only for samples (samples/bpf/Makefile CLANG-bpf). It allows to build samples/bpf for arm bpf using clang. In another way clang -emit-llvm generates errors like: CLANG-bpf samples/bpf/tc_l2_redirect_kern.o :1:2: error: invalid register/token name rev16 r3, r0 This decision is arguable, probably there is another way, but it doesn't have impact on samples/bpf, so it's easier just ignore it for clang, at least for now. Signed-off-by: Ivan Khoronzhuk --- arch/arm/include/asm/swab.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/include/asm/swab.h b/arch/arm/include/asm/swab.h index c6051823048b..a9fd9cd33d5e 100644 --- a/arch/arm/include/asm/swab.h +++ b/arch/arm/include/asm/swab.h @@ -25,8 +25,11 @@ static inline __attribute_const__ __u32 __arch_swahb32(__u32 x) __asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x)); return x; } + +#ifndef __clang__ #define __arch_swahb32 __arch_swahb32 #define __arch_swab16(x) ((__u16)__arch_swahb32(x)) +#endif static inline __attribute_const__ __u32 __arch_swab32(__u32 x) { From patchwork Fri Aug 30 00:50:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 1155603 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Okdsp5Zx"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46KLWY5g5sz9sNk for ; Fri, 30 Aug 2019 10:51:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727936AbfH3Au7 (ORCPT ); Thu, 29 Aug 2019 20:50:59 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45481 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727900AbfH3Au4 (ORCPT ); Thu, 29 Aug 2019 20:50:56 -0400 Received: by mail-lj1-f196.google.com with SMTP id l1so4768004lji.12 for ; Thu, 29 Aug 2019 17:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mY025N9ZTLshq6bUASscJHYyFWN73WCKPGSueHP30TA=; b=Okdsp5ZxNf0c0ZS1PgudZ1/Uzcx1vh+JyUHLIBaB4gA9eHqIu0am2+/xAGRamBrEmK qCvznYgVkMcSDDWdiuCGk34vVj8/mP+ro1bCTjA8Ka3xrOrkCNjL5U6xgrBRNELJmuje tp5PnYpAOK9+P7pd2AMtrpQ2VFUiwZgdf+VjTUiXBMwwiLm0B+wHxS9J4hkKQKTR1PMo g5JzQdW9lrRdG4QItLYA3aqHsMKgs2n4aIc4BsxCiDVNYjJ1gBnQXG5diF7z2I2DKLba 2UWvt484BgUsrYmmG+TmQ/bM0gM9QCmze3gdMrsQwFGwno6fmli/VeP2qEfoN4+I/6o0 LHHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mY025N9ZTLshq6bUASscJHYyFWN73WCKPGSueHP30TA=; b=izKk1Y2g+9FXgdEBDWCzOCTv7PaKeRVRO3NobcFJCviW4mZKP7hJo+MIXOdiy40/7c ya/ThARz8k7X7O5weWNTji9zau/xQdhJAHKvTuGUFl5HJpt5fnfsJCkY6yCiw8nMpNRm EgcFtWd8jnP913HoeL4W/UW7nUAIPdA0BT9h0IPTiVst7x9ZS2EAj82cqySLdmlZmrdg 38vJkBIq2RaCZO6QD5TU0WY7BDOoGeEkwKZ+DwWLq+iUr2WymNUT8s7OgxGM0i5+o7T6 yRhHrp34rx9VYLiEKEAjareTYeMQjDLhtI2Cns97jkNAbbGzrs2vI/agD4we92VrxTxH uMag== X-Gm-Message-State: APjAAAUbn8qPxM/GTxmR2NzLl0E3yXxP+u0WITHDwqD3WqmNptZuxnoG y+SPw95XJW8V7lCL/OTG6JHmTQ== X-Google-Smtp-Source: APXvYqwqImk+P6XTagmx3q1aVV2TwK0n5J/VZAS+IZlC8HW1HTeVnR0gZP11ETCdNHIKYsMWLXe3bA== X-Received: by 2002:a2e:2bda:: with SMTP id r87mr1097319ljr.3.1567126254430; Thu, 29 Aug 2019 17:50:54 -0700 (PDT) Received: from localhost.localdomain (168-200-94-178.pool.ukrtel.net. [178.94.200.168]) by smtp.gmail.com with ESMTPSA id f19sm628149lfk.43.2019.08.29.17.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 17:50:53 -0700 (PDT) From: Ivan Khoronzhuk To: linux@armlinux.org.uk, ast@kernel.org, daniel@iogearbox.net, yhs@fb.com, davem@davemloft.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Ivan Khoronzhuk Subject: [PATCH RFC bpf-next 10/10] arm: include: asm: unified: mask .syntax unified for clang Date: Fri, 30 Aug 2019 03:50:37 +0300 Message-Id: <20190830005037.24004-11-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> References: <20190830005037.24004-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The samples/bpf reuses linux headers, with clang -emit-llvm, so this w/a is only for samples/bpf (samples/bpf/Makefile CLANG-bpf). It allows to build samples/bpf for arm on target board. In another way clang -emit-llvm generates errors like: :1:1: error: unknown directive .syntax unified I have verified it on clang 5, 6 ,7, 8, 9, 10 as on native platform as for cross-compiling. This decision is arguable, but it doesn't have impact on samples/bpf so it's easier just ignore it for clang, at least for now... Signed-off-by: Ivan Khoronzhuk --- arch/arm/include/asm/unified.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h index 1e2c3eb04353..3cf8757b9a14 100644 --- a/arch/arm/include/asm/unified.h +++ b/arch/arm/include/asm/unified.h @@ -11,7 +11,11 @@ #if defined(__ASSEMBLY__) .syntax unified #else -__asm__(".syntax unified"); + +#ifndef __clang__ + __asm__(".syntax unified"); +#endif + #endif #ifdef CONFIG_CPU_V7M