Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp22884ybl; Thu, 29 Aug 2019 17:54:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxr1Ubh4qtku57ORtvKjzRzhKIUt8qW17VS2GS39Oz/nTKMC6nZeLSpiJLeLSj1uSCZVKC6 X-Received: by 2002:a63:66c5:: with SMTP id a188mr10722839pgc.127.1567126495744; Thu, 29 Aug 2019 17:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567126495; cv=none; d=google.com; s=arc-20160816; b=eW3aCtE47a4aW3T4u+0C3Xv6ii8JqNc7yeFr+wNt5wQhDRp09/AnhR9E9SZg1cxSML 0PChQltMTQZ4ZYoWovUkbpdgaGl7pUm5/9sfHgiN6yAlIT6B7Q+SPWtnjADmLbAu00hs lsZkqMugy5nP2Px3pkGcenFnPprCkrWx7Ce6jI/f0ORu3BIK3JFx8ZvqPWkNl2OetACf oFCfpp8xR/eM3YlBDu1cXlcp9LkXX5UZFXmOOkcukHhw2rQqLKztuwMmKVgZWcodZenX oXY3bu594mkW+lvnpecf4Or/3zUAcz3PbFOyKVESOR/QjLzA8ZeS9gSYxJ81aT90Q8Uf GXLw== 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=SkXPm+m9gr0mdYrnSxILjcjbQqNgw8XqWQGpu37QILdO6ktSwOakaUpleHCLShYo4l 1rCKN8YEPK1AJNqiKx2SwMGRU5o7pEIVYShW8yxbkrWX4CN9NSr64ugvNmQ3wtgGRjxz ZVmlwgZ+oeWRUK+1xe24wSnE1mVGx2vU8MQzkrXJZogsLlGS+IDuf3z9m8IdRp/5OOU3 XsLFYN4tg0losNZUGe8EPQpIB+wCaKB+ScTb+rZiDA/47lt9QSaIV8cVd+NUQa+2Clii rosEZxzDCTmbbKEVwXpQ2SrDfN5ip5AEAwpDIZD1Cv2LQ2Z8EDXsbHGP1KJw8PYQjUvz nQlg== 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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 x18si4078807pff.208.2019.08.29.17.54.40; Thu, 29 Aug 2019 17:54:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1728129AbfH3Avm (ORCPT + 99 others); Thu, 29 Aug 2019 20:51:42 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38008 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727562AbfH3Aus (ORCPT ); Thu, 29 Aug 2019 20:50:48 -0400 Received: by mail-lj1-f193.google.com with SMTP id x3so4817652lji.5 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=Vug1+Tq2XHIX3lqxDuJmduokghJTdzrMEYtcQV0ewTX6SoiVFzXEsK75HOpuLi2l8b +ppIVrvwXOmr/7nrphhofDPlNn5fl1U4369sDy5vCop9NoH+QAppt2OuVurdZJz2bvt5 QULMYDDOYD+JawfUuzEihbqsGNENMG17uraMWmAJtw5wC7EOaXBMPZTbK5qxn5IyINKN DIR6VER4tbC9vEwWNJRlc0uQleSGb04VhLRLVHhxMsqUaypOoj0XQvTnIXK3IvuWioFQ 1v0WfNHirKY2ioFk2s/q2xLry+yCzxEnL+3UrPAVUpapycQ48QcwM28mXogS4DuAjjOR F9JA== X-Gm-Message-State: APjAAAXIMbUkkgB1OvIfmQy5jUcEab+zcpwJkclCdgWNb+eNrTdEcCfd E3QlRuZSN4wrxbmuFhZ1ripz7Q== 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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)|" \ -- 2.17.1