From patchwork Fri Aug 26 18:10:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 12956380 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 53B86ECAAD6 for ; Fri, 26 Aug 2022 18:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344955AbiHZSKy (ORCPT ); Fri, 26 Aug 2022 14:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344972AbiHZSKw (ORCPT ); Fri, 26 Aug 2022 14:10:52 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21A59B69C7 for ; Fri, 26 Aug 2022 11:10:51 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-3363b1dffa0so36509227b3.23 for ; Fri, 26 Aug 2022 11:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc; bh=+rojwMFSR1ktivBcLatbShichab85h559FFhXLBJsbQ=; b=d4+SAZcB49L1Pz5691krlFA1DIyOTvq2Luh257EaP1K/PH0dmddhrS56CK7oNvjTCq JYW3is9kyarysYwRgAyND3s3bxVw/jubRHzTepqU8ADf1ANplMvsHHy3sUZbgip1TrYi VQMolp4u+aOxwOmOth5Tljke2JmC0du+AIf40liTCnqtb1TQYByhptbt3UfS9P2/7Pn7 V5D0Be+0FdKEK5I/9qKIW+ZDCqEWhahEwZ+F4wuKJ1GglG/LNWUg3D3IskGzoZvboVlp hoMcfu+1N82G+jY1PxSMeTMZaBdq+6+I+UxN62ZsTG3R3DeZx5dd48VB8uYWHkru790q LStQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc; bh=+rojwMFSR1ktivBcLatbShichab85h559FFhXLBJsbQ=; b=NGjGUngtJPztgNoAmNlVSEQ0bGPpdtu0dqisz7yuitkkxvsBPzUD+lZS3calEGL8fs KcPshPYSZbZ/FCSAUFR29cVzyE2Ypk87vXh65vqlMkrWy/jJJ2T5hesC4ylvy87j6vpm b1uKW/j2T03Mm7H1w0buRZFSyjx4dnMAjdYHGLj/on/Ep/LcqnDMSGCgBE3nf8S1JOz3 3Nyt2Kc8dUS/TyV/QFMv3fGZ3VbiQYFi5+i+eSv0vbtMZ0peIfz9oCuuba9lSCg6DF32 RDQYrtfA7rh52T2W1wZtLvafmhMoPyYYI3hmP6JKARXX4qK1YJn5Sh2m0yjhIo23Y2RO tKfQ== X-Gm-Message-State: ACgBeo3oxD6e6G/FseM58OUuremgjd1k41arD00JRp1yKaulTQWcCNgd flkK/whK94+6fp1DpZ7nMGSm8AJvctsFI8K/xwM= X-Google-Smtp-Source: AA6agR4ULUmbr1GFgEraiIaT8AxK9RcdvEUmCKesyk2DxFW/lUdbvm5cGag9CLzJsNLFrG4g/doYTURXjga8oVLFUHU= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:0:100e:712:8d7b:b933:5438:2a88]) (user=ndesaulniers job=sendgmr) by 2002:a25:e90e:0:b0:695:64cf:5d2 with SMTP id n14-20020a25e90e000000b0069564cf05d2mr832499ybd.541.1661537450473; Fri, 26 Aug 2022 11:10:50 -0700 (PDT) Date: Fri, 26 Aug 2022 11:10:33 -0700 In-Reply-To: <20220826181035.859042-1-ndesaulniers@google.com> Mime-Version: 1.0 References: <20220826181035.859042-1-ndesaulniers@google.com> X-Developer-Key: i=ndesaulniers@google.com; a=ed25519; pk=lvO/pmg+aaCb6dPhyGC1GyOCvPueDrrc8Zeso5CaGKE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1661537434; l=2534; i=ndesaulniers@google.com; s=20211004; h=from:subject; bh=+Ce697Gvc792vtSqpkgUmOwOXeS8MsAAIdR8EYSt4bI=; b=D9av99GhEUVuJgb7imYpdihlXqaXba/P8TNNQf7iB27ysvI+vgrjTW1hi6ko1PmKeztnZYwKFkzD +kwn7lP+BBx5GbbPxnX3QOnvS+vc5/jOX7d4q9Aev4g8z14GlfxF X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220826181035.859042-2-ndesaulniers@google.com> Subject: [PATCH 1/3] Makefile.compiler: s/KBUILD_CFLAGS/KBUILD_AFLAGS/ for as-option From: Nick Desaulniers To: Masahiro Yamada Cc: Michal Marek , Nathan Chancellor , Tom Rix , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, x86@kernel.org, Dmitrii Bundin , Fangrui Song , Alexey Alexandrov , Bill Wendling , Greg Thelen , Nick Desaulniers Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org as-instr uses KBUILD_AFLAGS, but as-option uses KBUILD_CFLAGS. This can cause as-option to fail unexpectedly because clang will emit -Werror,-Wunused-command-line-argument for various -m and -f flags for assembler sources. Callers of as-option (and as-instr) likely want to be adding flags to KBUILD_AFLAGS/aflags-y, not KBUILD_CFLAGS/cflags-y. Link: https://github.com/ClangBuiltLinux/linux/issues/1699 Signed-off-by: Nick Desaulniers --- arch/x86/boot/compressed/Makefile | 5 +++-- scripts/Makefile.compiler | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 35ce1a64068b..fb3db714a028 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -48,8 +48,6 @@ KBUILD_CFLAGS += -Wno-pointer-sign KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) KBUILD_CFLAGS += -fno-asynchronous-unwind-tables KBUILD_CFLAGS += -D__DISABLE_EXPORTS -# Disable relocation relaxation in case the link is not PIE. -KBUILD_CFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no) KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h # sev.c indirectly inludes inat-table.h which is generated during @@ -58,6 +56,9 @@ KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h CFLAGS_sev.o += -I$(objtree)/arch/x86/lib/ KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ +# Disable relocation relaxation in case the link is not PIE. +KBUILD_AFLAGS += $(call as-option,-Wa$(comma)-mrelax-relocations=no) + GCOV_PROFILE := n UBSAN_SANITIZE :=n diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler index 94d0d40cddb3..d1739f0d3ce3 100644 --- a/scripts/Makefile.compiler +++ b/scripts/Makefile.compiler @@ -29,13 +29,13 @@ try-run = $(shell set -e; \ fi) # as-option -# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) +# Usage: aflags-y += $(call as-option,-Wa$(comma)-isa=foo,) as-option = $(call try-run,\ - $(CC) $(KBUILD_CFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(KBUILD_AFLAGS) $(1) -c -x assembler /dev/null -o "$$TMP",$(1),$(2)) # as-instr -# Usage: cflags-y += $(call as-instr,instr,option1,option2) +# Usage: aflags-y += $(call as-instr,instr,option1,option2) as-instr = $(call try-run,\ printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) From patchwork Fri Aug 26 18:10:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 12956381 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 20DFEECAAA3 for ; Fri, 26 Aug 2022 18:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344960AbiHZSKz (ORCPT ); Fri, 26 Aug 2022 14:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344980AbiHZSKy (ORCPT ); Fri, 26 Aug 2022 14:10:54 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89E4DBD0BE for ; Fri, 26 Aug 2022 11:10:53 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-33da75a471cso36828377b3.20 for ; Fri, 26 Aug 2022 11:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc; bh=y85OHCHx+Vi/sO7g73ubX7Iq+I1fFfBENt1UsLJJtEY=; b=Wj6HCEjnqrM+ctPXZ7KiGzIXUgQPn1aBBzqlXzJXgi4UZbJJxcgs2UwkHjll+zpoDb QeMdKfqcbQOVp17Y0+gesDEiIBE2NtsbSzBeish3QzVjv+ccDr8N9iBPhNlnJ+YXJgXc TvKwx7H5srQaXdmnL0HXDThn+fsOePUCjTuCn0aigqKEnJMlv7h1Xp+qfv8qoTynWxqI 4txto8tzY+q23E3IEn+vhGNU4fNuv5wFW3EC0z2YsZ+kLvCz3/6YommEVb33Y4oEwDD3 0L4yDniY0aGOCZ6n2IM+1XskuCSVe+ByexHFTTMple1/llBbEl7kTK+daJJISfnFHL6d TeaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc; bh=y85OHCHx+Vi/sO7g73ubX7Iq+I1fFfBENt1UsLJJtEY=; b=Vv8FReG3NuZx8SeadgRniGEZNRspiLjYmorgV1kqYnApT1FMsKlq5PQljsvREu90NW 38eVMGy+E3w/uPUa6qF0EPoYli88mtfLAxPBKcTJ40P5wEqzw2+7SSzZEr4btp/ihEHa KIx4QU3DkV4MikDm7Ey0lHOFk5NXfPMR1DdSGVV4idNtnprqyyRHASXrsB4F4KBs3UtQ FxxaeFyUtvbqYpymblF8dU+AFDLUVAPTfr5bT0NGct89ugOGX4cgXHt0p4uqQij70TjZ ayRwS6dhezwtd04NeHtNk3yW48bsft2WeuVaLp+kPS1i4E2FjLwgLCB22EpFdG6/3J6L cOsw== X-Gm-Message-State: ACgBeo0Xvrccz0pL7Bn1YGxFU4aTBv62gq8lWftjt7/W1pHAL6AuVl1K +cD2X7powywT7/cHoGLS6LSCLw0pSZlKRPAA99s= X-Google-Smtp-Source: AA6agR5OzcKIoYCg9NU/S1Bt4QZM/GluQ1lilTqv2NoDx2SVtJGQ0ZZoyYauXUteYnrMqBae+wpkPcsEDZ5Oc9etZfQ= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:0:100e:712:8d7b:b933:5438:2a88]) (user=ndesaulniers job=sendgmr) by 2002:a05:6902:124f:b0:66e:e3da:487e with SMTP id t15-20020a056902124f00b0066ee3da487emr973177ybu.310.1661537452858; Fri, 26 Aug 2022 11:10:52 -0700 (PDT) Date: Fri, 26 Aug 2022 11:10:34 -0700 In-Reply-To: <20220826181035.859042-1-ndesaulniers@google.com> Mime-Version: 1.0 References: <20220826181035.859042-1-ndesaulniers@google.com> X-Developer-Key: i=ndesaulniers@google.com; a=ed25519; pk=lvO/pmg+aaCb6dPhyGC1GyOCvPueDrrc8Zeso5CaGKE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1661537435; l=3096; i=ndesaulniers@google.com; s=20211004; h=from:subject; bh=WJicEEw1ygkDh8L4szHogyorYbivCBDQ7W9ZrvdhNOc=; b=ZWuPxn7dhLiVcgTrvuHdUAPAmyqC6WoqmU5iSPWfVYPAWJqjwzpjYxl1614lFrA0/+q4/P3onXk1 O00OgL5BCi40Z6C06mizSDk06M74HD6otU8B3ZzdiYDlMTNMCJLe X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220826181035.859042-3-ndesaulniers@google.com> Subject: [PATCH 2/3] Makefile.debug: re-enable debug info for .S files From: Nick Desaulniers To: Masahiro Yamada Cc: Michal Marek , Nathan Chancellor , Tom Rix , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, x86@kernel.org, Dmitrii Bundin , Fangrui Song , Alexey Alexandrov , Bill Wendling , Greg Thelen , Nick Desaulniers Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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) +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 From patchwork Fri Aug 26 18:10:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 12956382 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 0343EECAAA6 for ; Fri, 26 Aug 2022 18:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344945AbiHZSLR (ORCPT ); Fri, 26 Aug 2022 14:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344987AbiHZSLA (ORCPT ); Fri, 26 Aug 2022 14:11:00 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 467C5D34E3 for ; Fri, 26 Aug 2022 11:10:56 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-33dce8cae71so36988927b3.8 for ; Fri, 26 Aug 2022 11:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc; bh=CWU/c+Z/T3afmWH8jUSRUPrlGa0DK6zNkVSVmthE7JY=; b=J+AQGYjSJRFoIHL2qT5xdAZvDrv7rB5xy/XhHbqmf4gaE97fgjZ/gsV7Bj3BJxJ6C+ FPRauz+dGA3SM+kwveIWXCZxJ7Lo09AWQQ48FIY0hXIPvqLTUVr2mNyYvf0+hQLa5dRB p8jEAl2BGy5VXM7O9Hc7ChpszUItzykwB158shIdBODNy334KmOa7Wmpm6E3iQQ83TJt 32XwyG0fmLqJ039OynjBFyJqv8N2DKehM8g7IugjxRi7bq5yo9SZ8Eas2ju1LuPB7ou7 0OJ42v4NsHKPhivZjHIYd0OnMbrCqPgaGPj8gsCuamCPEeSNl4fyigNCj8s3DLHyhH42 ztVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc; bh=CWU/c+Z/T3afmWH8jUSRUPrlGa0DK6zNkVSVmthE7JY=; b=IG5DkXxfYzrfSxCA8dzLt5MRzzl5ctNBSwvGDmvusHEtSv7csIaWjIm10Zx0oMWbQa O088x4A+rukcE6siTXmlLgVopHwiYp9q8h5Ko8aQ8We1YzuqlxzZIFJwLYWM+BPkPSgT PqhzuYsQqaDUioYNY9l4JtbYHwQV6RtF3J0ZZvbNspOmZ6V45O83w17c/gzKZWINQELo JvZM2zp44Vi9WbEyv+41xo9vnky6p40K0GM/mK+3WBPFxac+mMN8UQbOyrr+D5kXykxp sb6bSsQTOTyPv6lsxY+12n6SHad5WxUY1Jvb2W04cHjCGVp0qUD2EG1LlG+/kvivSHcJ Rnag== X-Gm-Message-State: ACgBeo0vlmUTNhFpi6HDjUPkY++5PNW+wPkJD28tTTv7x0ynrh3lDTdC vU72fUe0wH/U3IVJJDy15n1xAuuZkUudFXNIn1M= X-Google-Smtp-Source: AA6agR5zI4BE0SfjNUKDcGZ6Xb4IGuI7GBSJB6t0ufhMUW2iZNyRbbuavTdHsFVco3HP2hlWhORE8Awb5dEsiQIyeEs= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:0:100e:712:8d7b:b933:5438:2a88]) (user=ndesaulniers job=sendgmr) by 2002:a25:8e84:0:b0:696:466c:baa with SMTP id q4-20020a258e84000000b00696466c0baamr798614ybl.604.1661537455239; Fri, 26 Aug 2022 11:10:55 -0700 (PDT) Date: Fri, 26 Aug 2022 11:10:35 -0700 In-Reply-To: <20220826181035.859042-1-ndesaulniers@google.com> Mime-Version: 1.0 References: <20220826181035.859042-1-ndesaulniers@google.com> X-Developer-Key: i=ndesaulniers@google.com; a=ed25519; pk=lvO/pmg+aaCb6dPhyGC1GyOCvPueDrrc8Zeso5CaGKE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1661537435; l=1289; i=ndesaulniers@google.com; s=20211004; h=from:subject; bh=KFmDrL6BvTknKQovEEq6T3GFbpZs3ibjX3HcMW2RbEw=; b=HAVmPHDoSpY2S9bAFO1KTHzp0jMYkmspk0Y0zWNA/klCy1NkTBTvFdbFEPvTjqH5HFwy7nCPzrDJ 2mGy2RsICFikIgnIL9rPA36Q4SDd51mgrcFdoNpQ/CPxtlHcT01h X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220826181035.859042-4-ndesaulniers@google.com> Subject: [PATCH 3/3] Makefile.debug: set -g unconditional on CONFIG_DEBUG_INFO_SPLIT From: Nick Desaulniers To: Masahiro Yamada Cc: Michal Marek , Nathan Chancellor , Tom Rix , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, x86@kernel.org, Dmitrii Bundin , Fangrui Song , Alexey Alexandrov , Bill Wendling , Greg Thelen , Nick Desaulniers Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Dmitrii, Fangrui, and Mashahiro note: Before GCC 11 and Clang 12 -gsplit-dwarf implicitly uses -g2. Fix CONFIG_DEBUG_INFO_SPLIT for gcc-11+ & clang-12+ which now need -g specified in order for -gsplit-dwarf to work at all. Link: https://lore.kernel.org/lkml/20220815013317.26121-1-dmitrii.bundin.a@gmail.com/ Link: https://lore.kernel.org/lkml/CAK7LNARPAmsJD5XKAw7m_X2g7Fi-CAAsWDQiP7+ANBjkg7R7ng@mail.gmail.com/ Link: https://reviews.llvm.org/D80391 Reported-by: Dmitrii Bundin Reported-by: Fangrui Song Reported-by: Masahiro Yamada Suggested-by: Dmitrii Bundin Signed-off-by: Nick Desaulniers --- scripts/Makefile.debug | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug index a7a6da7f6e7d..0f9912f7bd4c 100644 --- a/scripts/Makefile.debug +++ b/scripts/Makefile.debug @@ -1,10 +1,8 @@ -DEBUG_CFLAGS := +DEBUG_CFLAGS := -g +KBUILD_AFLAGS += -g ifdef CONFIG_DEBUG_INFO_SPLIT DEBUG_CFLAGS += -gsplit-dwarf -else -DEBUG_CFLAGS += -g -KBUILD_AFLAGS += -g endif ifdef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT