Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp662881rwe; Fri, 26 Aug 2022 11:50:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Q8Yo8BKK/VbgLHh06AVbMpWpa2AvE9hBwyMXkbSEgtb4QNWDoSaCHMKjPDY4tt0K+TdAX X-Received: by 2002:a05:6402:4313:b0:446:ffc0:50b5 with SMTP id m19-20020a056402431300b00446ffc050b5mr7535673edc.153.1661539835726; Fri, 26 Aug 2022 11:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661539835; cv=none; d=google.com; s=arc-20160816; b=Z3yRkCyPuyJEFoijJME1MpGSPOT8ajEUlsWEG39B4Rj+kMVeShVhD37MTlvd5qitT1 +PqYMb9fMJTy449QzYwq5FZt5Ii2h8G68EnT8ArD4n9R6EWliLQuTQBESzSJYxCruzh6 S28ESEvOHuMjjXUl+rfB8plZj3jl21VNwHOA5+hW6Ij/tWwu8cVLL2mzwCcFzH/BqkHO J1i1oumwyu8zm1P3RxK3wwHcbejoEs7p/C2KATvtXcY42Jv6KK3QuH2uQxeW2Kd9MsUG 7ZyjeeGKLGczktVrTKvy79QuGnsPQwl5jzuOoY2/dJPXxQbY0mRcI+QzKfwJ+A6ZCTVl IAAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lPP8ZIOLS6D+TcMlycR/OR+lDE15x2XXqZgNT5DKzz4=; b=UCELj767kvpGUtKdsOrD3savSkxqar3XqeBDyuKbvPCyJwsQR+tTh6up+m5DLTtQFP oM8pPumQKZ2TKtI2N6WV6SrAgLyH2kHPVG5f6C34w65GJHvUpkwc4v0tIIssObFG/u7N /ZRD2m8sCzApD/pkKciWNwErUq+oegBULLAwNixx7B91EnI8a16kVq3L38/fBOc8vKOt 3nQO+5a9uFItV9GhRNKCC8Mpyo7YEVkxBdL3nXR+AssaEXpQ/jAytXHffJLfNPONIhEs sz9rQxJtu1ShkQq9WIyKdzF9cBxVAiZV2rB6P0JvlerBqz7LbXxEG2eVxoh6rMa913PM xATw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=BVoMBeOy; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13-20020aa7d40d000000b004409963eb80si1482331edq.432.2022.08.26.11.50.08; Fri, 26 Aug 2022 11:50:35 -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=@google.com header.s=20210112 header.b=BVoMBeOy; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345128AbiHZSpR (ORCPT + 99 others); Fri, 26 Aug 2022 14:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345119AbiHZSoe (ORCPT ); Fri, 26 Aug 2022 14:44:34 -0400 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8D0C167D8 for ; Fri, 26 Aug 2022 11:41:31 -0700 (PDT) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-33dc31f25f9so57255967b3.11 for ; Fri, 26 Aug 2022 11:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=lPP8ZIOLS6D+TcMlycR/OR+lDE15x2XXqZgNT5DKzz4=; b=BVoMBeOyrKSnw5NxEVstnntoqejvil646ntiJcHVzelMDsUyoG4srhTizGO05tCtK+ CE0IZGiImHFzl1kLyh714dY5gNVaPOf8nQmzWq/if8zDPgdu9BprwDZ4WLIk6zLefVMJ 6RRoxnlM2kFggt+ANGnUVzLD9OzLvjQXb+hW9jKKiWjkJ8qM7f9lA3Re7Lw++7VKuZdB EF8/CHvz/TrzEl/T6gsE1yHmkY90PncBgphWcS1QLuAj0+P4F6Tsr74swhuEiaVvBNfX lcQL/sPlxOc+t/BvST3O6GOemuTzNMLWae3vts46vCKVZqdN/9Wg/sx1lYQDGI0j6MNK xF+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=lPP8ZIOLS6D+TcMlycR/OR+lDE15x2XXqZgNT5DKzz4=; b=Jw99EmvyzWmbYSAAdOwo9G7IyW5Ay2+eGFQNCcFJpMh+fGwfCiqasy1fXjwLDsIPtQ hoK19m7wB+eIPu7lYIUeSjQ7zHoo7AY+E6BiQBMb8A/bNzUSTFkDKxL/rCxO/YSPhlrn tUwWmFRLmRtqFX/h+8/RM/ksdCV95wP6pTidFiwvW0MNKmrsyLWGewu8R90K/XbKL4w9 5xitCIqpuc5thq6WtmHk+5dryfBTOcpEId5/Old9zy3ZZqKixf6IcNjSaBqFYyI2KeNV 71OwMaaP2zxOjjV2XuENZjZLyUOa8SSLZHQvLNWnpq5DuFjngwjJrxmOmOlkP9+w0TLN 0cDQ== X-Gm-Message-State: ACgBeo1ExjlNEckl0jP/wHAiBbQr0x/O7ldlmLBb6hNOaHdSSVfeaRaX FiWQqNc/cwX/x/jZiJH3VeGjaelSyeUu9tTr5Tyx X-Received: by 2002:a25:6ec5:0:b0:676:d7ec:65c5 with SMTP id j188-20020a256ec5000000b00676d7ec65c5mr982536ybc.610.1661539288470; Fri, 26 Aug 2022 11:41:28 -0700 (PDT) MIME-Version: 1.0 References: <20220826181035.859042-1-ndesaulniers@google.com> <20220826181035.859042-3-ndesaulniers@google.com> In-Reply-To: <20220826181035.859042-3-ndesaulniers@google.com> From: Bill Wendling Date: Fri, 26 Aug 2022 11:41:17 -0700 Message-ID: Subject: Re: [PATCH 2/3] Makefile.debug: re-enable debug info for .S files To: Nick Desaulniers Cc: Masahiro Yamada , Michal Marek , Nathan Chancellor , Tom Rix , Linux Kbuild mailing list , LKML , clang-built-linux , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Dmitrii Bundin , Fangrui Song , Alexey Alexandrov , Greg Thelen Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 On Fri, Aug 26, 2022 at 11:10 AM Nick Desaulniers wrote: > > Alexey reported that the fraction of unknown filename instances in > kallsyms grew from ~0.3% to ~10% recently; Bill and Greg tracked it down > to assembler defined symbols, which regressed as a result of: > > commit b8a9092330da ("Kbuild: do not emit debug info for assembly with LLVM_IAS=1") > > In that commit, I allude to restoring debug info for assembler defined > symbols in a follow up patch, but it seems I forgot to do so in > > commit a66049e2cf0e ("Kbuild: make DWARF version a choice") > > This patch does a few things: > 1. Add -g to KBUILD_AFLAGS. This will instruct the compiler to instruct > the assembler to emit debug info. But this can cause an issue for > folks using a newer compiler but older assembler, because the > implicit default DWARF version changed from v4 to v5 in gcc-11 and > clang-14. > 2. If the user is using CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT, use a > version check to explicitly set -Wa,-gdwarf- for the > assembler. There's another problem with this; GAS only gained support > for explicit DWARF versions 3-5 in the 2.36 GNU binutils release. > 3. Wrap -Wa,-gdwarf- in as-option call to test whether the > assembler supports that explicit DWARF version. > > Link: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=31bf18645d98b4d3d7357353be840e320649a67d > Fixes: b8a9092330da ("Kbuild: do not emit debug info for assembly with LLVM_IAS=1") > Reported-by: Alexey Alexandrov > Reported-by: Bill Wendling > Reported-by: Greg Thelen > Signed-off-by: Nick Desaulniers > --- > scripts/Makefile.debug | 22 ++++++++++++++++++---- > 1 file changed, 18 insertions(+), 4 deletions(-) > > diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug > index 9f39b0130551..a7a6da7f6e7d 100644 > --- a/scripts/Makefile.debug > +++ b/scripts/Makefile.debug > @@ -4,18 +4,32 @@ ifdef CONFIG_DEBUG_INFO_SPLIT > DEBUG_CFLAGS += -gsplit-dwarf > else > DEBUG_CFLAGS += -g > +KBUILD_AFLAGS += -g > endif > > -ifndef CONFIG_AS_IS_LLVM > -KBUILD_AFLAGS += -Wa,-gdwarf-2 > +ifdef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT > +# gcc-11+, clang-14+ > +ifeq ($(shell [ $(CONFIG_GCC_VERSION) -ge 110000 -o $(CONFIG_CLANG_VERSION) -ge 140000 ] && echo y),y) Do you think this would be better as a macro? Maybe something like: if $(call cc-min-version,110000,140000) where the first argument is GCC's min version and second Clang's min version. It would be more readable and reusable. -bw > +dwarf-version-y := 5 > +else > +dwarf-version-y := 4 > endif > - > -ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT > +else # !CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4 > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5 > DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y) > endif > > +# Binutils 2.35+ (or clang) required for -gdwarf-{4|5}. > +# https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=31bf18645d98b4d3d7357353be840e320649a67d > +ifneq ($(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y)),) > +KBUILD_AFLAGS += -Wa,-gdwarf-$(dwarf-version-y) > +else > +ifndef CONFIG_AS_IS_LLVM > +KBUILD_AFLAGS += -Wa,-gdwarf-2 > +endif > +endif > + > ifdef CONFIG_DEBUG_INFO_REDUCED > DEBUG_CFLAGS += -fno-var-tracking > ifdef CONFIG_CC_IS_GCC > -- > 2.37.2.672.g94769d06f0-goog >