From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756219AbbJ2Ht7 (ORCPT ); Thu, 29 Oct 2015 03:49:59 -0400 Received: from bastet.se.axis.com ([195.60.68.11]:35532 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751478AbbJ2Ht4 (ORCPT ); Thu, 29 Oct 2015 03:49:56 -0400 From: Rabin Vincent To: Arnaldo Carvalho de Melo CC: , , Ingo Molnar , Peter Zijlstra , , Rabin Vincent Subject: [PATCHv2 2/3] tools: build: fix libiberty feature detection Date: Thu, 29 Oct 2015 08:49:37 +0100 Message-ID: <1446104978-26429-2-git-send-email-rabin.vincent@axis.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1446104978-26429-1-git-send-email-rabin.vincent@axis.com> References: <1446104978-26429-1-git-send-email-rabin.vincent@axis.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Any CFLAGS or LDFLAGS set by the user need to be passed to the feature build command. This many include for example -I or -L to point to libraries and include files in custom paths. In most of the test-*.bin rules in build/feature/Makefile, we use the BUILD macro which always sends in CFLAGS and LDFLAGS. The libiberty build line however doesn't use the BUILD macro and thus needs to send in CFLAGS and LDFLAGS explicitly. Without this, when using custom CFLAGS/LDFLAGS, libiberty fails to be detected and the perf link fails with something like: LINK perf libbfd.a(bfd.o): In function `bfd_errmsg': bfd.c:(.text+0x168): undefined reference to `xstrerror' bbfd.a(opncls.o): In function `_bfd_new_bfd': opncls.c:(.text+0xe8): undefined reference to `objalloc_create' ... Signed-off-by: Rabin Vincent --- v2: rewrite commit message tools/build/feature/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index e43a297..cea04ce9 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -132,10 +132,10 @@ test-libbfd.bin: $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl test-liberty.bin: - $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty + $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty test-liberty-z.bin: - $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz + $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz test-cplus-demangle.bin: $(BUILD) -liberty -- 1.7.10.4