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: 172657 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3000227ily; Thu, 29 Aug 2019 17:50:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJzkg7+SFL9REEqRQbNE3xoGH82DG1g0ZukkbAQuj9pZwK5jzAbe4WAtw2n5OoDSb3lRLQ X-Received: by 2002:aa7:8edd:: with SMTP id b29mr15304974pfr.173.1567126247871; Thu, 29 Aug 2019 17:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567126247; cv=none; d=google.com; s=arc-20160816; b=HWTolwKLyRPyhrsV3IA7I5V9qzx5Ndw/xexWhYBo3B80uKuu9Y8j05iC55Zp3V1rAi Wkj40P9x6qOyY945Bn3YHpkfPQwztJkdkE4znDRiNuaI+8V7vIU1lbf/qT0EuVAvZN/O UhS6Q1xjWCB2h2f61nqVqMJpe5pHY15jGmtOtBgT/fhZwxPHslnzc4moBs1TOAHzDBDt YEFWGqrAp+F06AuS7nQz5V7YaT3DswiHeCH/ScMQ2HvTAaSUJlFlRoQeXu0w2cosH353 3iFuuub5Mi7FPy7Crj9tTkKVeYxw3tz+dJ8C9thmUnihglwI4jXrKwewPKscbqcPMj7f /Qbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Uyna4IYOJol121SLmRwAZvx/NaOoPDVjYK6GTYbGUpc=; b=YmF8E9NSKGmrfyOWJp6U3RYQY+o/6TrrT6lw2GDGxfPfPshx4DNASEFGogj0uRPyu3 7xwusCtax6cRePd9eY6OoChypIpfp0aXmo+lN1vogyoh0jBCFV3tYQXiFibICQoKmjgL vYxXxQ4akst2RQhyE9G3jgSYEvuQmpPmKVA+txXofkW/vRdEezpyZn5OFm9+9dWqff54 BTs7uABrPHHaNpJV8TaBBDWbAtcSchJDe66fzs1+P2tFw/lKzRqY5uk06Ml2FlNQ1NGt ita3IdoKR+iUx7TGJ5bDrZk+hAgNJfwgb87Dg6Gqd5C2dalMM5QDH00k+rFFj/6HGtdq 9H5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kCLWWa8C; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si3330408pgv.225.2019.08.29.17.50.47; Thu, 29 Aug 2019 17:50:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kCLWWa8C; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbfH3Auq (ORCPT + 8 others); 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-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(+) -- 2.17.1 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: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: 172666 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3001037ily; Thu, 29 Aug 2019 17:51:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzco9RONoceg3Sg3DPZrNqU7aeJVX8b5XthGMaqQnVsTfqMX/HAvLPr6G6jL8bJbqr0FOr+ X-Received: by 2002:a63:dd17:: with SMTP id t23mr10698384pgg.295.1567126299809; Thu, 29 Aug 2019 17:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567126299; cv=none; d=google.com; s=arc-20160816; b=G0LNw1FSkubDFoh1HqRKhtZGfepxzQDwquMDRD2f6kvOWDGfGuLnyEJvxZnnN4C8k7 ZFWTpkCKfu/dfFwnzh6STd3zs6/fTabNHvAeHUSAjepw2EDliMknK5YrkzdYoV8SWDD8 sy29Dtwoy2TZfZ1gXcT6MGRBDeXOHDLwbW0d27IYcrQ0goeqYnX5CZm4Wp5IHIYogkWy FE+MCr6O2KCPPFqKIBUmRLCPmzGRpn6YKHGo9g6stp57ZqC/vYeVW0L5fF4Rd9QrsYGr pD8sSYBJtQ2wgMtod+obQ5NzllY0cNpeHoYTubM5NTTAuQpsV0gCKaA27JjV9Tmi9noD jUHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=baF6/BEW5KEVo2LOFkZZTRTkQs3Veu82MyQ6XaftpOU=; b=W6wTwCUmwcaWMB5CBiUCel9IpXRbpsWGATfNOXo9VZ7QQcA0DDE7/MszEd/CI+3mGk AptMdKiGXq+pEizLXv6RPuyKVQOsQsMDjJRYoh7fEUmaPnnd0GuU4Ux3u2uT72XsLsRB lpkJvCz2YqRKRMmh2n/Vj3laqXNFcM1o49CawNxhqqmRU+H3Zo5T7p7rQLs8czWFSMM2 FG5PQVmLRwz7HFUSpajhm4rViaAC4HYCbjtKG1LZG9Xt4e66e043Csmvz0mk8ORo/J5m bxbQY4K7o/8qV1LexKS77DJkqIA1oQwXMBMiNNkEwAUt7Ab5iHHMHJFU+da27HQmTkzy lWuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=biPM7KPd; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ck4si3325238plb.235.2019.08.29.17.51.39; Thu, 29 Aug 2019 17:51:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=biPM7KPd; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727664AbfH3Aut (ORCPT + 8 others); 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-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(-) -- 2.17.1 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: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: 172664 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3000890ily; Thu, 29 Aug 2019 17:51:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzn3mKUPXAc2z4REcWU3tyoj1EcVgvhc0P7MP2c2zlQjojPY/qiTfJlTSSQq2NSPQnopRiS X-Received: by 2002:a17:902:758a:: with SMTP id j10mr5288185pll.233.1567126290656; Thu, 29 Aug 2019 17:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567126290; cv=none; d=google.com; s=arc-20160816; b=QwZ5yfUb7pbAiRSZFt+pfmP0QfkqCY7t2pTBzVphLCxR13EhJJptMn47cQW5ZTiz1u zuQ4DTeoyyF2s40+rBlHdHanxJxivlVYxJtgj9znaTf0AP/QS2BVs+TzYwXh6tI4hX1b BP2MLEENTVQM71qoCEQnK2UrDbQyjDpitvn/rH7doVmuQL1dQZePek4G5Njd1v64HGq+ b474Mkc5quS7iALw/cc5NdiDfgs6zXUVNJ+YvA7c0DUpkWWDHyBZj6T90KkBxwuJnIwH 1/FhDkPAIbLe5i4IY2DgJaNCS2cLmyDC27KW4m88Pe61HjC2oQLrXa1C4RvAYDzBXuoC psmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=XM+El1wyypVfaXfQc7FxTfECR5DYv9zUGiXmgC/VC5g=; b=OcCfe+96jW5idiU3rXhM2j1bivyJfYqjdV+GjYAA4cRRtKmNB8H7JbO6fcawbU5nnE xj5hg0SO7g0Dvxgjb2YuX98tmeCfcjssT+G0yaFJtgb30QfMKsDije3lVsv7Ktgixiqr gtlo4pCsrD1SyvmcDY1LWKAB8GeV9kVJd8ABc2UkRUXmraGqvFE2hV6fZNvNuPC9RfvC uJsdAL4jYeyXnaT3TfV3163C9LIDlBQolMUSzwVwPvyNvumSLRs1ZpfIRIbqPSsq4DJE eyscjTZBXiCoh0WQE4zoO3UZUyvRZy3qdELWniq534i/TF7SICe0mfyvy5ehQY8ysFBD vooQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OmaVkDBx; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34si3408181plz.18.2019.08.29.17.51.30; Thu, 29 Aug 2019 17:51:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OmaVkDBx; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728099AbfH3Av3 (ORCPT + 8 others); 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-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(+) -- 2.17.1 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: 172663 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3000707ily; Thu, 29 Aug 2019 17:51:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsuvjxk4s/7RItvGniePOWfz84CriKk2rl+Fx9XEw8Xiqs+ENlJKamcdEUNeQmdaBJsXgj X-Received: by 2002:a17:902:b20c:: with SMTP id t12mr12906647plr.205.1567126279543; Thu, 29 Aug 2019 17:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567126279; cv=none; d=google.com; s=arc-20160816; b=x19OWv/+3kXwsm3/0L5/bo3hOuOJpZHLpxT1Xh6JbNZHmwqFB57jiM9WJGdrBuS2dp uqa9JkqYQH9Un4alFipYke/EaGMbXQDdvn751rfAafU1EVbyqWzb97XNT/NHFNy2Un0o s1fjtjByxNP8pIh21A5JAnx+2Y5adUiVY9vRkl3ubQNX8jWnJsowUd0QaF7BJE8bp/y6 +fejD81ZpEL6lZJEzPNrJ+TDaHmUWp2kJ3U7sZWXefqKMDGks+n2gzwtq1vToz4Nhjh6 qrkMaCSwKu6zxy9Wn28CIBg2v0uO7Xr/s5VZtcIkFeGGFezvd+zL1DTGlVCKXJBiXGsh PMWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=jGmbuQhjfybpgV20Mr6h/vZA852gJhY9ROLsc2sx8l8=; b=SCVywXVHYuXcEFK85R6oZrNsmqrt+sGnpmkFRGMV5LUUTPv7y1EBs0wYFeRK2UN+PJ +vnXbkKAJoHgmYz1XVwTlEJE800eflAL1cQJlQev2K3cWP/le5kRzKenxAbH/Oj5ytB7 cU6MOYLavWsd/LuODwEvKEwZe2XPhyxNumkaEmOnTKh30/rIZ7vHbgytZiptI+2Ta8eG MplAMqMwUOz5V26iXuD9KdvXcxfSjmK750oKRynzbvX86X2MJwVk9NM7AVJ094fAv+1E c4/XIUy80Q41yIANy7FUajcFvH7Pfj+BPFxzQgy3bETxMMMJ0hzWV97/TDGiWPIiPbmB iBmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pWeUz6Fu; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ds19si3580998pjb.81.2019.08.29.17.51.19; Thu, 29 Aug 2019 17:51:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pWeUz6Fu; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727809AbfH3Auw (ORCPT + 8 others); 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-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(-) -- 2.17.1 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)