Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp51201rdh; Tue, 22 Aug 2023 12:16:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGg+sUiUk7DxDd/YJCZizRU8Xti5vIFaZozM58GAN+05X67fYvXlmKfNZ0a4ofT5je6WaU X-Received: by 2002:a17:902:eb45:b0:1b8:9552:ca with SMTP id i5-20020a170902eb4500b001b8955200camr8559412pli.45.1692731796393; Tue, 22 Aug 2023 12:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692731796; cv=none; d=google.com; s=arc-20160816; b=LCLFm6r1VHkl8ihWoDuWmK6jYRZL9lkDRvILLQfRCyODujD7VL8djFkODqtIuYxvLY 0ihWb4HBClKXmQTvq4EcpPhh+dAZbRb0DKtmaF9uRifOTg16rfEcerJ+moWSJw+UkoxE XAMPvszwYEHsGhfQnZGucYc5zVYL3c+Qj9iCgc1ipITOhk+J8nXNzue/2KdIFxcm+q1B Vm9ZYbrVOz5v1GumSLR2nYTkbOL4aczg4Y6/zmw3IOYTjaGaDJqCSxdD6ECgfQqHKS0S Niaw78GiApH5PgEC5Z9PXccB0NTSVmavcarVIqNc5bCUUfgYXdoPSznS6SK+SOIsAUjx BKdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=p+XQ2WuMwnaHgFDwe4VtO2KkUE9mv8HvHTbMuGDWHgQ=; fh=0VwmZE/WJwN9sBDvS1kwHx5AbrV4i4m5h/Ov+iuIuCk=; b=RBLsetwOFlgHR/TAI7N2zS9Y//SabqyiuSfd5cwRSNRKdQHq1RGlgPcPKpRdMSB4z2 ACBxruJR6aqMRs1ut6KWoORCW6DmpJRn/8fLpdu1SU9zzzEXc1bLxfj7ZFKEnjPH582g vEZVPzYDJoUnTo1IRecnF2GtgrLdI1dYAX2tV2O4YHfcx3sDu20UW7ucIwPP7KVdwbtd G4Dz8kCl8+mMLP3xt90xs8YfnUL2Wq+X/Oa3jr0813zF/RQYknYGKSyhxhpwEAikeaL2 gVL3A6NpG/TnoHAfb0LxsQOa80QyY63ZasNLhR7ZO42xne0cWXlJDa4OWImS5VD2Kx+k oKPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020a170902e5cc00b001b9c992945fsi9773098plf.555.2023.08.22.12.15.49; Tue, 22 Aug 2023 12:16:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbjHVS6R (ORCPT + 99 others); Tue, 22 Aug 2023 14:58:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbjHVS6Q (ORCPT ); Tue, 22 Aug 2023 14:58:16 -0400 Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53653CD1 for ; Tue, 22 Aug 2023 11:58:15 -0700 (PDT) Date: Tue, 22 Aug 2023 20:58:09 +0200 From: Guilherme Amadio To: Arnaldo Carvalho de Melo Cc: Ian Rogers , Adrian Hunter , Jiri Olsa , amadio@ghostprotocols.net, Namhyung Kim , Linux Kernel Mailing List Subject: Re: perf tools: Options being passed to clang when building the BPF part of skels Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnaldo, On Tue, Aug 22, 2023 at 09:33:16AM -0300, Arnaldo Carvalho de Melo wrote: > Hi, > > On gentoo I'm noticing this: > > clang-16clang-16: : clang-16error: : error: clang-16clang-16: clang-16clang-16clang-16: clang-16error: clang-16: : ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored]: : : clang-16error: ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored]error: error: : > error: > error: error: error: ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored]ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored]error: ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored]ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored] > > ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored]ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored]ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored]ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored] > > ignoring '-fstack-protector-strong' option as it is not currently supported for target 'bpf' [-Werror,-Woption-ignored] > > And while just doing: > > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf > index a5dd1ba..7726b57 100644 > --- a/tools/perf/Makefile.perf > +++ b/tools/perf/Makefile.perf > @@ -1101,7 +1101,7 @@ else > endif > > $(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) $(SKEL_OUT)/vmlinux.h | $(SKEL_TMP_OUT) > - $(QUIET_CLANG)$(CLANG) -g -O2 --target=bpf -Wall -Werror $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \ > + $(QUIET_CLANG)$(CLANG) -g -O2 --target=bpf -Wall -Werror -Wno-option-ignored $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \ > -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@ > > $(SKEL_OUT)/%.skel.h: $(SKEL_TMP_OUT)/%.bpf.o | $(BPFTOOL) > > > "Fixes" it, I'm curious as where is that we're setting up the options > that are being passed to clang at: > > tools/perf/Makefile.perf > > $(SKEL_TMP_OUT)/%.bpf.o: util/bpf_skel/%.bpf.c $(LIBBPF) $(SKEL_OUT)/vmlinux.h | $(SKEL_TMP_OUT) > $(QUIET_CLANG)$(CLANG) -g -O2 --target=bpf -Wall -Werror $(BPF_INCLUDE) $(TOOLS_UAPI_INCLUDE) \ > -c $(filter util/bpf_skel/%.bpf.c,$^) -o $@ > > Perhaps it is plain just using CFLAGS? I.e. maybe the native build > CFLAGS is being passed to the BPF target clang calls? > > Ideas? In the patches I sent previously, I had a commit to address this. In summary, the extra flags you see are hardening flags added by default. Have also a look at /usr/include/gentoo/fortify.h. I suppose other distributions may add such flags as well. It's a pity the hardening flags are added indiscriminately to all target architectures, but just making the compiler not error out should be enough to work around the issue. In my patch, I put -Werror under the control of the WERROR build option and disabled it when configuring perf in the ebuild. Since other warnings may be triggered in the future, having an easy way to disable -Werror when building the package would be nice to have, otherwise when a new compiler comes out users may hit build failures, since we are a source based distribution. Best regards, -Guilherme