Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp32642rwb; Fri, 19 Aug 2022 16:14:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR7VCjJML2dshOJwh7UJfW+lld3ivRX2kEXrB2LYekHcT3wQRQwKHsMASs+7gwxN2OVgVWmx X-Received: by 2002:a17:907:761b:b0:738:4c1c:7dd with SMTP id jx27-20020a170907761b00b007384c1c07ddmr5996357ejc.563.1660950849402; Fri, 19 Aug 2022 16:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660950849; cv=none; d=google.com; s=arc-20160816; b=QUUgTIPbHKcVSrcifzqLFtIDQxIyPmXqIZ3sLSaXhsaQy8MHknpXH41fQE0CaLTFO+ B2KCZWnA5cln0mO0q/lVyLWydluZpGr4CM0IA1iK4ofTMdQvztxFCQtvKCH2xkDUS7s6 S4B3ZMghzaNgTEw+6yZ/6Q5XfxX3NZg3JbE/vzMqcpA/KxGGowm+XpaCbZPv8mkDKsqE 1ivxTUaDLOQQS23iB+2r8cA7QjWuC4FqZO3Jf5huaU1pRvtCpo6+xtTNSySNTqIrJIuS bTmT6OGCLBeHljYUq5pVYlQBm9aMBH+5yUYmXZW38gz+nuN3K41oOhvzD8ZIb2ROZjzO 7UIw== 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=ePCvzW/muyp3tHWutyEFwLQrrnxA3ArTLs/J6HTRfLY=; b=SjuMuh9PnBMQhAfvxx8Q0VjqNNxvnFjBf1xkUd2RkN+molbCkd43KVGavLkEVT8f3j 1ujd3MKYtOhPtcXRgdZ7nnzm7mlwMmHn89OB09+sa50gwyFJfo0dHDgNfJwZI8LyURMV pwWX284oqcjlVjRLnYc6+ALvbYYwtKxLVTdAokAzBgyhal4dyfBNsHjy3sikrktzHkrU 0oL4bB7X+6x6WmtlFqblLsFsCMxpcieC78KohpxyhUqd+BDSpizgYbpC2Yfdbgt7VaA3 NeiHeg+xzvZAOKkCUhIY1NdLYPJQs0UsmETHbPWfvP9hcbJ554xHzrtHarv89hCcd5TB m5JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SfiS+2al; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs15-20020a1709073e8f00b0073d5b0868dcsi1068699ejc.852.2022.08.19.16.13.43; Fri, 19 Aug 2022 16:14:09 -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=@gmail.com header.s=20210112 header.b=SfiS+2al; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243145AbiHSWwT (ORCPT + 99 others); Fri, 19 Aug 2022 18:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243127AbiHSWwR (ORCPT ); Fri, 19 Aug 2022 18:52:17 -0400 Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 436D610B519; Fri, 19 Aug 2022 15:52:16 -0700 (PDT) Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-33365a01f29so158236267b3.2; Fri, 19 Aug 2022 15:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=ePCvzW/muyp3tHWutyEFwLQrrnxA3ArTLs/J6HTRfLY=; b=SfiS+2alq9htL30QUKpIzaZuP0u+uU0NCMdQbyKqhjNx1WVYuFMypqJ++I2zmlD5HR 9EbF5AxpHXlEEWbfAucgwKtDi5+WBpUfAxM4rU50kJzaPf5s3ewjBNfqOSTq8JP0esyV vxFl7+urp6LmiQsFJ45WjtPikSukan5lkMRISDwUG82TpAo8pA+VLDKlB5lBRKDPbGnt 6XCwsGn1g6s1sSC7C/gu8+xPYgadWY8qZzPkH0Uq7B2fM8hoXT5qN2gSQO0BamXMbLZZ LOrTxLUyddhiWJJaKiFaHYiFvkQICKV5+rnAtYuo49/lSn6Y2bd5XNSS3bq+D8Erb75h exLw== 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=ePCvzW/muyp3tHWutyEFwLQrrnxA3ArTLs/J6HTRfLY=; b=5DP9umjBja69OQDEIln8NTnE4pgHDy2so5eAmbqvfjhVfDRjnXXBWH5I6vQHt+H6rR Dpd207En9AyXhj+FaeRLUSN4B1WIaDz31qOiOXeL5H2DLX+NxHkQeiTDA/bQGgxYxzLX InwVhpy67YOUVWHnCcQY7nEsftzl6treUrlkKz7gA9tnfbpHL9MoWqaWbQyrnYPibE/e klrMrGSCiNU4DZMo835C9FCpsMVtJQDiD1ae7raUwJ35A8csa0Vi68dhAlhnMJXvGWx8 lqS9ernRQn0jSUfkV3/+wagiBFoCFtQsGK86KriKseiGLpJn6q/cELr6hMwZg/BiscK1 DmKQ== X-Gm-Message-State: ACgBeo1oXugSReVPUYnfB43Na92pgiPRhV/JyPhoEhYwbIjx0ervbD6R pEhfGg5sndm09rzSZqBkkSXGnXcZHtfBKPnFZ0ZI7Y4fOILi0B3t1tRDLDXL X-Received: by 2002:a25:ac9e:0:b0:68e:ccf4:ea04 with SMTP id x30-20020a25ac9e000000b0068eccf4ea04mr9510879ybi.287.1660949535520; Fri, 19 Aug 2022 15:52:15 -0700 (PDT) MIME-Version: 1.0 References: <20220815013317.26121-1-dmitrii.bundin.a@gmail.com> In-Reply-To: From: Dmitrii Bundin Date: Sat, 20 Aug 2022 01:52:04 +0300 Message-ID: Subject: Re: [PATCH v3] kbuild: add debug level and macro defs options To: Nick Desaulniers Cc: Masahiro Yamada , Andrew Morton , Dan Williams , Eric Dumazet , Isabella Basso , Josh Poimboeuf , Kees Cook , Linux Kbuild mailing list , Linux Kernel Mailing List , Rasmus Villemoes , Fangrui Song , Michal Marek , Nathan Chancellor , "Peter Zijlstra (Intel)" , Vlastimil Babka Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Fri, Aug 19, 2022 at 8:42 PM Nick Desaulniers wrote: > > Is any of this really necessary? Consider the case if CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y. Prior to GCC11/Clang12 -gsplit-dwarf implied -g2. So on newer compilers with -gsplit-dwarf in use there would be no debug symbols produced. -gdwarf-4/5 still implies -g2, but in case CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y neither of the options are set. So it seems like a reasonable choice to provide a debug info level config that would explicitly set the level without relying on implicits. The default value of the config is set to -g2 to not change the build behavior that was before introducing the option. And it works for both older and newer versions of GCC/Clang in the same way. The benefits of the -g1 option are indeed questionable except that it produces an image with ~20% less in size. > It seems like a great way to bloat > vmlinux artifacts built with CONFIG_DEBUG_INFO even further. The defaults were chosen to not change the build behavior that was before introducing the options. Or did you mean something else? > The > above link mentions "when debugging with GDB." In that case, please > don't add new Kconfigs for these; just set -g3 when > CONFIG_GDB_SCRIPTS=y. CONFIG_GDB_SCRIPTS does not necessarily mean that -g3 is wanted, -g2 (default) is usually a reasonable choice. The -g3 option is very useful when debugging macro-intensive code, but requires much more disk space to build. I documented it explicitly in the help section of DEBUG_INFO_LEVEL. GCC and Clang use different options to include macro definitions so it was handled depending on the compiler used. Regards Dmitrii