Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp138334rdh; Tue, 22 Aug 2023 15:29:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFK5kxep0Kog/tj8TzWcrBmQ9e9uXsT08xkE7VxxsNAHAK9xxyZwYc1JmwyfUOxyNRPWBk+ X-Received: by 2002:a05:6a20:8412:b0:132:bdba:5500 with SMTP id c18-20020a056a20841200b00132bdba5500mr15075808pzd.39.1692743387223; Tue, 22 Aug 2023 15:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692743387; cv=none; d=google.com; s=arc-20160816; b=Mh8z6yui1HGSAt/4TYd707C6bOIgyU56FTSUwzpvV5uBaZG4dtn8s4xlHewZHG6Qf7 bUAQpCoKXz1Ipw8iuzjAVJK/PDmtems+rP3koL+tjUsw5owOOCP/FscmtQYo0lGex9TB t6fO0XjDoZE+a2tA9mem/RhRuoodcYaS0PIgnBE1T0GTN7TiwU4ZWqjzpOjNWAyOcZRr t36h9NRbFRhONo2MsPPdTuzggCG70b4YNJZYnhlZxUYltqoAiXEnNzUPX8m8YQvi81EG DMGFvJb7h3WRJ9RvILZJRe8YWdktyVJMmqdVVDtusbLPAsl+S2SQ9eZDTDMlKvyOE4gW ebKg== 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:dkim-signature; bh=aYBXM1fK8mclkYHkQQDwkFeoUP2LRTRb84kNSq8DjuQ=; fh=aRZL8tU8h4euiNKngU7pxt4iHqO8UgIekbvKxb63b6c=; b=jlp8nqoRobtwjMx3bHRh49qk6Awe0NePTNvO5xid0vV6vKsi6rnRD98Z9laIyj777e 7jWcinKAj78qlNgNh3hL6w7r2tQ+01Qix6JvDZhtiEj6BtxGzpFZwzrdON0/yuX7n/xj VrWigHUQ9RUe68JIxzqObp9bu68BOQO5cgCIOjtIow5dpgsgQscMsSto2u5DLYTldvbz RnH6t/W8PVPHcxfNyTQji7C4pxFBpIrNYu1GLZwt4NJ6b3y4NQ7myp2KHhX5RtXJHH6O 8fQbQ6gwj5jCpRzLxua17mKjRRfXFb4/C0ljIDL12yK//UqVamfdR/a2geSeZiXloebb Vlmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DaD5nV08; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k24-20020a6568d8000000b0056534300dc2si9621510pgt.247.2023.08.22.15.28.56; Tue, 22 Aug 2023 15:29:47 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DaD5nV08; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230245AbjHVTnT (ORCPT + 99 others); Tue, 22 Aug 2023 15:43:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjHVTnS (ORCPT ); Tue, 22 Aug 2023 15:43:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 202FE10F for ; Tue, 22 Aug 2023 12:43:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B286362E74 for ; Tue, 22 Aug 2023 19:43:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7489C433C8; Tue, 22 Aug 2023 19:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692733396; bh=DUuG0P0MSkK9+4aNXYx5VuJ6d8t1sM3PXwUrQ9yjyqo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DaD5nV08LW6J+ijTq93X4/pS1reqnxpUfCDl8A4BbCqgErd5X56tVpwHhNxKnlQqP j01bKJceoY1pc35BtG8ddDP2+fmHgOz/IJzElpq/p1oji/sT0JC0H/KV/vwEpHS/aC 06EDC/3ZsFit9RiC7efZrgRsJ6yMq5rCs/RwMqueLWUhWCUo5p7S0QTfvH26re0ePs BA6kW1uZVZRKo6Ty+XQKdz/xNXu11pLCbscohIbZ95jGW/a+XGmLAbgIz3VJfeZSX7 0Kn0HSSq53z1tn6Hb2CIhOhanuGNStFQnc5NvQTFbSUWybBo1SAhFC8o9i9+JlYwJw C2uvGJpbkAZxg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 5291640722; Tue, 22 Aug 2023 16:43:13 -0300 (-03) Date: Tue, 22 Aug 2023 16:43:13 -0300 From: Arnaldo Carvalho de Melo To: Guilherme Amadio Cc: Ian Rogers , Adrian Hunter , Jiri Olsa , 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=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,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 Em Tue, Aug 22, 2023 at 08:58:09PM +0200, Guilherme Amadio escreveu: > On Tue, Aug 22, 2023 at 09:33:16AM -0300, Arnaldo Carvalho de Melo wrote: > > 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 I tried the one that introduced CLANG_OPTIONS and checked WERROR= to set Werror, read more further down this message. I think we need to have it but for this problem I want to have finer grained control on what goes into the CFLAGS for CLANG _when building BPF bytecode_. > 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 Oh, I see, so we need to overcome that in the perf Makefiles by _removing_ those unsupported options for the BPF target, something like what is done in tools/perf/util/setup.py, because some of the options may not be supported for one version of clang but be supported in a newer one :-\ > 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 Right, so it is the one I saw. > 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 Right, I'll apply that patch, I tested it, it just didn't some the problem at hand, i.e. after applying it one has to use WERROR=0. - Arnaldo > a new compiler comes out users may hit build failures, since we are a > source based distribution. > > Best regards, > -Guilherme