Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp847839ybp; Fri, 11 Oct 2019 05:25:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIoToFIh8+tcf9nZyRxjPTVAtfCtmszoUYaiTRSVfpEOrVyxvq3t7i6EB7uwsWnOJFi4Ou X-Received: by 2002:aa7:de02:: with SMTP id h2mr13218930edv.212.1570796715149; Fri, 11 Oct 2019 05:25:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570796715; cv=none; d=google.com; s=arc-20160816; b=PmIj40t4XBmOD6j+ifZlaNqMdovv/KGz5GwvZ1MGzFkb1y91h5380dUusoFnfHoJSD DhMgI0QfHUVcG1vr18luqNta72j+bnZIkZQDbMEgxTEji3C9fPfjiccsiGwbKeGL9tj4 BsNiGWBQDvfao66Z6KvDbvItnOhIdwtrEdsQ5DSt6vBztAfFaZCK6R6WRkwBCJgK8Zwq lh0GzzL7vLp7ZBsTkHeY0tJqX2Xj8sA8HUO/Tgy2VVuvFkjpIEH79XiqkkwB+N7l/Xf1 r3nhTKbS2Ulh2OMqqB7ANtIcfG6K3btNxOjlmStzlDwfwXfqiB7XbftOoj2loHjI6I7R VoOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=H0RshtQMOKIcALWjouwnsqD4OxSGasyn6fLMpFfBn24=; b=u56XjBgUMqA09EpGpDwhCemiszGzdV5vydwXUeDHQAu9OmkmySVL4EMSGM9P7gCI9Q vFuhO3ahIFfESM6pt0TapJ7JUdDU2kVyIlvy2nxcfezo4OTuYOaieHk2ESMSij/ZeEZu HkVYAWcykZb5rLHOiyspTnJvKAnIEz0EiM0hkgs1oVfBSY3+ADDyFkOsTNX1aJ7nfYCd WrkdPxMjtfzQzwb6ivVhcszW+hI3pb/GBctIzo48H1nCYAA6AdD22RVdWEEzPzzyFsCy 5L4g9geyLDMhoRPQLGnTA1MXul83wZkfbkUXtAm4R0po9ZbxbUt3X4IKzt1Ba+fXwCxJ k72g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e48si6105355eda.130.2019.10.11.05.24.51; Fri, 11 Oct 2019 05:25:15 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728002AbfJKMV7 (ORCPT + 99 others); Fri, 11 Oct 2019 08:21:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44100 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727198AbfJKMV6 (ORCPT ); Fri, 11 Oct 2019 08:21:58 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5B4885537; Fri, 11 Oct 2019 12:21:57 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.206.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED3A76012A; Fri, 11 Oct 2019 12:21:55 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Andi Kleen , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH] perf tools: Propagate CFLAGS to libperf Date: Fri, 11 Oct 2019 14:21:55 +0200 Message-Id: <20191011122155.15738-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 11 Oct 2019 12:21:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andi reported that 'make DEBUG=1' does not propagate to the libbperf code. It's true also for the other flags. Changing the code to propagate the global build flags to libperf compilation. Reported-by: Andi Kleen Link: http://lkml.kernel.org/n/tip-sgq5yeyvitp655s2iq3e75ls@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/Makefile.config | 28 +++++++++++++++------------- tools/perf/Makefile.perf | 2 +- tools/perf/lib/core.c | 3 ++- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 46f7fba2306c..063202c53b64 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -188,7 +188,7 @@ endif # Treat warnings as errors unless directed not to ifneq ($(WERROR),0) - CFLAGS += -Werror + CORE_CFLAGS += -Werror CXXFLAGS += -Werror endif @@ -198,9 +198,9 @@ endif ifeq ($(DEBUG),0) ifeq ($(CC_NO_CLANG), 0) - CFLAGS += -O3 + CORE_CFLAGS += -O3 else - CFLAGS += -O6 + CORE_CFLAGS += -O6 endif endif @@ -245,12 +245,12 @@ FEATURE_CHECK_LDFLAGS-libaio = -lrt FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl -CFLAGS += -fno-omit-frame-pointer -CFLAGS += -ggdb3 -CFLAGS += -funwind-tables -CFLAGS += -Wall -CFLAGS += -Wextra -CFLAGS += -std=gnu99 +CORE_CFLAGS += -fno-omit-frame-pointer +CORE_CFLAGS += -ggdb3 +CORE_CFLAGS += -funwind-tables +CORE_CFLAGS += -Wall +CORE_CFLAGS += -Wextra +CORE_CFLAGS += -std=gnu99 CXXFLAGS += -std=gnu++11 -fno-exceptions -fno-rtti CXXFLAGS += -Wall @@ -272,12 +272,12 @@ include $(FEATURES_DUMP) endif ifeq ($(feature-stackprotector-all), 1) - CFLAGS += -fstack-protector-all + CORE_CFLAGS += -fstack-protector-all endif ifeq ($(DEBUG),0) ifeq ($(feature-fortify-source), 1) - CFLAGS += -D_FORTIFY_SOURCE=2 + CORE_CFLAGS += -D_FORTIFY_SOURCE=2 endif endif @@ -301,10 +301,12 @@ INC_FLAGS += -I$(src-perf)/util INC_FLAGS += -I$(src-perf) INC_FLAGS += -I$(srctree)/tools/lib/ -CFLAGS += $(INC_FLAGS) +CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + +CFLAGS += $(CORE_CFLAGS) $(INC_FLAGS) CXXFLAGS += $(INC_FLAGS) -CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE +LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS) ifeq ($(feature-sync-compare-and-swap), 1) CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 45c14dc24f4b..a099a8a89447 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -769,7 +769,7 @@ $(LIBBPF)-clean: $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) clean >/dev/null $(LIBPERF): FORCE - $(Q)$(MAKE) -C $(LIBPERF_DIR) O=$(OUTPUT) $(OUTPUT)libperf.a + $(Q)$(MAKE) -C $(LIBPERF_DIR) EXTRA_CFLAGS="$(LIBPERF_CFLAGS)" O=$(OUTPUT) $(OUTPUT)libperf.a $(LIBPERF)-clean: $(call QUIET_CLEAN, libperf) diff --git a/tools/perf/lib/core.c b/tools/perf/lib/core.c index d0b9ae422b9f..58fc894b76c5 100644 --- a/tools/perf/lib/core.c +++ b/tools/perf/lib/core.c @@ -5,11 +5,12 @@ #include #include #include +#include #include #include #include "internal.h" -static int __base_pr(enum libperf_print_level level, const char *format, +static int __base_pr(enum libperf_print_level level __maybe_unused, const char *format, va_list args) { return vfprintf(stderr, format, args); -- 2.21.0