From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AFDCC433F5 for ; Thu, 7 Apr 2022 17:18:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230351AbiDGRUl (ORCPT ); Thu, 7 Apr 2022 13:20:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346077AbiDGRUd (ORCPT ); Thu, 7 Apr 2022 13:20:33 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA1A1403C9 for ; Thu, 7 Apr 2022 10:18:30 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id r2so7567349iod.9 for ; Thu, 07 Apr 2022 10:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=KH5PVhUf3St+PVWuuXxWv3bUswUGFaayVqUv+jlnQ5I=; b=o0MEVFN2DI5ySYUZQvXOB6ZGueGTtWl7IhUJh543EFF9fACYPGDzNTZ+Lc5JgMHpWi cQw3n5gS8HuG2oM4vKaXuGu8CtUE5L6EqqEHJEGoXpb68jv9bxWGi2QggrdMp5kCqqRA U6YJyi1TRdURJQevPY06wPY59bAjhEoEF5vCFBxaFj4HrKGqLxR0p7JG9+RAxMiGtYP7 QdjWUY1L2iQZptNmwj9egcMAtnSVmWoD5qnW4SGCKOKkN470vEkOt18bn5TMd0NuT8hF cyhu3E4GN1fPusdpyVcphrIcGMlm+D4q1dOs7wDYWSu28g5rFaT1NdYj8yx/5o66LeDN 1fyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=KH5PVhUf3St+PVWuuXxWv3bUswUGFaayVqUv+jlnQ5I=; b=RxvVY6CpdSo40YSpIcyZPXvYqrcEf/PzGaT1fvAdiczBP0h7mCypapxNhI9Tq8QKJu U+lB7VFSOwPySBfpbeybC1s3FGjkakl+bElUHqBQIWahOxaX5NUylyOuUznUrPfkIREc fwXM4NXqDE7AqHIQPiYaYKROWKag6nqq2ME45WuwatldwRZrdhtXmERH7UOL5QVVq7lv KXoGsHedLzpn/UFJVNCVodDUhrjVxzZwcZC1/xCs1oB/Cm0yFjQtSUcEbabzshk5M45J qgwh3lc0GkMLQNBRm43gKJnSZPVKTKo9xMMAUXetjer161Lxm1TvqQKGLASQsp8pwr+h uCHQ== X-Gm-Message-State: AOAM533n8tms2daX8XmZJiIhZp/Qd4ePOhgAbtJe19ZkvQbqNSIg0yFz giWtKfDw3UkLYvHSSseYderveGW4nyB6Mw5ejlo= X-Google-Smtp-Source: ABdhPJw6JiLSNOULkHElEr39EhvWk8yT8SEWbzQ5Y2S9x4fTB+bIVMA6CqVbhDN+YO8/EXFFMPBeu5Ivx7KO29Naot4= X-Received: by 2002:a05:6602:3ca:b0:63d:dfc8:fa66 with SMTP id g10-20020a05660203ca00b0063ddfc8fa66mr6617430iov.128.1649351909565; Thu, 07 Apr 2022 10:18:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Thu, 7 Apr 2022 19:17:53 +0200 Message-ID: Subject: Re: Build perf with clang, failure with libperf To: Nathan Chancellor Cc: Arnaldo Carvalho de Melo , Adrian Hunter , Fangrui Song , Florian Fainelli , Ian Rogers , Jiri Olsa , John Keeping , Leo Yan , Michael Petlan , Namhyung Kim , Nick Desaulniers , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 7, 2022 at 7:14 PM Nathan Chancellor wrote: > > On Thu, Apr 07, 2022 at 06:25:29PM +0200, Sedat Dilek wrote: > > On Thu, Apr 7, 2022 at 5:03 PM Nathan Chancellor wrote: > > > > > > On Thu, Apr 07, 2022 at 12:27:14PM +0200, Sedat Dilek wrote: > > > > On Mon, Apr 4, 2022 at 11:53 PM Nathan Chancellor wrote: > > > > > > > > > > Hi Arnaldo, > > > > > > > > > > On Mon, Apr 04, 2022 at 05:43:11PM -0300, Arnaldo Carvalho de Melo wrote: > > > > > > Hi, > > > > > > > > > > > > Trying to apply Sedat's patch something changed in my system, > > > > > > and that patch wasn't enough, so I had to first apply this one: > > > > > > > > > > > > commit 173b552663419f40bcd3cf9df4f68285cac72727 > > > > > > Author: Arnaldo Carvalho de Melo > > > > > > Date: Mon Apr 4 17:28:48 2022 -0300 > > > > > > > > > > > > tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts > > > > > > > > > > > > Just like its done for ldopts and for both in tools/perf/Makefile.config. > > > > > > > > > > > > Using `` to initialize PERL_EMBED_CCOPTS somehow precludes using: > > > > > > > > > > > > $(filter-out SOMETHING_TO_FILTER,$(PERL_EMBED_CCOPTS)) > > > > > > > > > > > > And we need to do it to allow for building with versions of clang where > > > > > > some gcc options selected by distros are not available. > > > > > > > > > > > > Cc: Adrian Hunter > > > > > > Cc: Fangrui Song > > > > > > Cc: Florian Fainelli > > > > > > Cc: Ian Rogers > > > > > > Cc: Jiri Olsa > > > > > > Cc: John Keeping > > > > > > Cc: Leo Yan > > > > > > Cc: Michael Petlan > > > > > > Cc: Namhyung Kim > > > > > > Cc: Nathan Chancellor > > > > > > Cc: Nick Desaulniers > > > > > > Cc: Sedat Dilek > > > > > > Signed-off-by: Arnaldo Carvalho de Melo > > > > > > > > > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile > > > > > > index 1480910c792e2cb3..90774b60d31b2b8e 100644 > > > > > > --- a/tools/build/feature/Makefile > > > > > > +++ b/tools/build/feature/Makefile > > > > > > @@ -217,7 +217,7 @@ strip-libs = $(filter-out -l%,$(1)) > > > > > > PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) > > > > > > PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) > > > > > > PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) > > > > > > -PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` > > > > > > +PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) > > > > > > FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) > > > > > > > > > > > > $(OUTPUT)test-libperl.bin: > > > > > > > > > > > > ----------------------------------------------------- 8< ------------------- > > > > > > > > > > > > After this I go on filtering out some of the gcc options that clang > > > > > > doesn't grok: > > > > > > > > > > > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile > > > > > > index 90774b60d31b2b8e..bbc5e263e02385ed 100644 > > > > > > --- a/tools/build/feature/Makefile > > > > > > +++ b/tools/build/feature/Makefile > > > > > > @@ -215,9 +215,12 @@ grep-libs = $(filter -l%,$(1)) > > > > > > strip-libs = $(filter-out -l%,$(1)) > > > > > > > > > > > > PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) > > > > > > +PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) > > > > > > PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) > > > > > > PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) > > > > > > PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) > > > > > > +PERL_EMBED_CCOPTS := $(filter-out -ffat-lto-objects, $(PERL_EMBED_CCOPTS)) > > > > > > +PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) > > > > > > FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) > > > > > > > > > > > > $(OUTPUT)test-libperl.bin: > > > > > > > > > > > > ----------------------------------------------------- 8< ------------------- > > > > > > > > > > > > And then get to the problems at the end of this message, which seem > > > > > > similar to the problem described here: > > > > > > > > > > > > From Nathan Chancellor <> > > > > > > Subject [PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO > > > > > > > > > > > > https://lkml.org/lkml/2020/9/1/135 > > > > > > > > > > > > So perhaps in this case its better to disable that > > > > > > -Werror,-Wcompound-token-split-by-macro when building with clang? > > > > > > > > > > Yes, I think that is probably the best solution. As far as I can tell, > > > > > at least in this file and context, the warning appears harmless, as the > > > > > "create a GNU C statement expression from two different macros" is very > > > > > much intentional, based on the presence of PERL_USE_GCC_BRACE_GROUPS. > > > > > The warning is fixed in upstream Perl by just avoiding creating GNU C > > > > > statement expressions using STMT_START and STMT_END: > > > > > > > > > > https://github.com/Perl/perl5/issues/18780 > > > > > https://github.com/Perl/perl5/pull/18984 > > > > > > > > > > If I am reading the source code correctly, an alternative to disabling > > > > > the warning would be specifying -DPERL_GCC_BRACE_GROUPS_FORBIDDEN but it > > > > > seems like that might end up impacting more than just this site, > > > > > according to the issue discussion above. > > > > > > > > > > > > > Thanks for the pointer Nathan. > > > > > > > > As said I hit the problem with Debian's perl v5.34. > > > > > > > > Checking perl5 Git reveals: > > > > > > > > "skip using gcc brace groups for STMT_START/END" > > > > https://github.com/Perl/perl5/commit/7169efc77525df70484a824bff4ceebd1fafc760 > > > > > > GitHub says this is in 5.35.2, so it would make sense that 5.34 still > > > shows the issue. > > > > > > > "Partially Revert "skip using gcc brace groups for STMT_START/END"" > > > > https://github.com/Perl/perl5/commit/e08ee3cb66f362c4901846a46014cfdfcd60326c > > > > > > > > Perl v5.34.x seems not to have these changes: > > > > https://github.com/Perl/perl5/compare/v5.34.0...v5.34.1 > > > > > > > > Unsure if there exists a real fix for perl5. > > > > > > Perhaps those two changes could be cherry-picked into Debian's 5.34. I > > > have no idea if that is possible though. > > > > > > > What perl5 version has Arch Linux? > > $ pacman -Q perl > perl 5.34.1-1 > > It appears that 5.35 is the development version, which I suppose means > we won't see this fix widely available for some time: > > https://www.nntp.perl.org/group/perl.perl5.porters/2022/03/msg263388.html > > > Do you see the issue and need -Wno-compound-token-split-by-macro? > > I don't build perf but given the above information, I suspect I would > need that flag as well. > Can you be so kind and apply my 2 diffs to perl.h and acme patchset (or Git tree) and test? - Sedat - [1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/urgent