From patchwork Wed Sep 7 04:59:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 12968435 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 C3731C6FA82 for ; Wed, 7 Sep 2022 04:59:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbiIGE7j (ORCPT ); Wed, 7 Sep 2022 00:59:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbiIGE73 (ORCPT ); Wed, 7 Sep 2022 00:59:29 -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 C0A8B112E for ; Tue, 6 Sep 2022 21:59:26 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-345753b152fso39020547b3.7 for ; Tue, 06 Sep 2022 21:59:26 -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:subject:date; bh=HyKr9I8MzG9kBN69CE/ANl9iOdCK/yJrqP2VJJKmtbA=; b=mJJdHlkWP0qiECsFlrlh4TKS0YhzeMCgS4kv9vWslSXb4Vob+X30ichTiTL9WTKgI5 gol9O3sKAlXKI1d1of7Cx5Dpy6M7xy066hXl72LhnNeDvOPqt4fAeMBFk9P/xDlbHDD2 UA/pc6CA6BCCHdAtX4qtkpOdFmk8fiZ2OArMTR+ncA3Yby8+sBmM+xa3oX1KJ2YzgJKa L3WqzmAD6s/p69GW8Di63kcHhq5ThiT5UKYWfMmqynAphjEWW/B63Rm2Ocy3RFqD/324 TnivXmR6PypnprSSrfFTKQ6rz9V+TOXSc4HJQE//4PY20nwqS/FUvdbNY4f1mLnkixFm MvPQ== 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:subject:date; bh=HyKr9I8MzG9kBN69CE/ANl9iOdCK/yJrqP2VJJKmtbA=; b=exboJa2z/dxNhVJGCa+g4GzjumVudMJ03H7dA1IoYw7J2bRA5oT27j0dmDOhboxHhd A7enP/ctsWx/pVGq1I2BHyhKLUu/c96gTCm4nLkrlCG6yBxyALlAfa7A9+UvDvH+wOpf ZMA19hPuvkzRy62a848sFMHT2ve/68WU8LREz8lHOvqEN8yr+O0YTFR4yztEiUcGaeuk /PHu+1hMPSm45C/IEXRyKijEPFl2lEQ4cEw0c+Unk+sMgbLZLT+uBqQ7RfNX3Skg2YQE Vgqrh2nwNsHy/n7aR8WA0PuoMfOuJXuV86wwGNt1kQ+W8w286GE4ZZBOrni0ZUyEgzoi gwuw== X-Gm-Message-State: ACgBeo0szIBscYHnegarq04DYo3LHgYbcsZoXzV59lGFK9yI6XdV5sJo 2wbIT+RBLpjpQTzKV/0L0P2z/4yMtOi6u14iX1Q= X-Google-Smtp-Source: AA6agR6A3nOFVgzH/LIlkj47r/IKh6L2ey7C7N3pfYOn5TOUy3NjV0xTHyAbU1giaqkuT92t6UljPsTDaUWLkFIxjWY= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:0:100e:712:9755:c523:9dcb:2228]) (user=ndesaulniers job=sendgmr) by 2002:a0d:f2c4:0:b0:333:560c:ee46 with SMTP id b187-20020a0df2c4000000b00333560cee46mr1649366ywf.109.1662526766087; Tue, 06 Sep 2022 21:59:26 -0700 (PDT) Date: Tue, 6 Sep 2022 21:59:03 -0700 In-Reply-To: <20220907045907.484043-1-ndesaulniers@google.com> Mime-Version: 1.0 References: <20220907045907.484043-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=1662526746; l=1808; i=ndesaulniers@google.com; s=20211004; h=from:subject; bh=kYGYc5XWvUdto/5QJT//gD0cOAVBQRf+GCe08dKvohM=; b=QJ3sqizOMx1/LC5t2cVcxIGdd+h2qlDiVbAXaw+l/z2ysUwiRHXCM6y0Rhd2/XAI2e9D/+A9TzOz sLMzCcW9BimZSDyDaerFZtig2p3NctS62ufemI2LaTKtXaET2zUe X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220907045907.484043-2-ndesaulniers@google.com> Subject: [PATCH v3 1/5] x86/boot/compressed: prefer cc-option for CFLAGS additions 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 , Arvind Sankar Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org as-option tests new options using KBUILD_CFLAGS, which causes problems when using as-option to update KBUILD_AFLAGS because many compiler options are not valid assembler options. This is being fixed in a follow up patch. Before doing so, move the assembler test for -Wa,-mrelax-relocations=no from using as-option to cc-option. Cc: Arvind Sankar Cc: x86@kernel.org Link: https://lore.kernel.org/llvm/CAK7LNATcHt7GcXZ=jMszyH=+M_LC9Qr6yeAGRCBbE6xriLxtUQ@mail.gmail.com/ Suggested-by: Masahiro Yamada Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Changes v2 -> v3: * Reword commit message as per Nathan. * Pick up Nathan's RB/TB tags. Changes v1 -> v2: * Split off of v1 [1/3]. * Use cc-option to update CFLAGS, as per Masahiro. * Add Masahiro's Suggested-by, Cc Arvind. arch/x86/boot/compressed/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 35ce1a64068b..85934204d905 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -49,7 +49,7 @@ 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 += $(call cc-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 From patchwork Wed Sep 7 04:59:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 12968438 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 DBE03C6FA82 for ; Wed, 7 Sep 2022 04:59:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbiIGE7m (ORCPT ); Wed, 7 Sep 2022 00:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbiIGE7a (ORCPT ); Wed, 7 Sep 2022 00:59:30 -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 0108226FF for ; Tue, 6 Sep 2022 21:59:28 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-3456e0bcd5aso42305037b3.20 for ; Tue, 06 Sep 2022 21:59:28 -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:subject:date; bh=OAxiGU2+Zm5TGJDmYfJLZJYOpFooL4QHZIWYZiKDaNI=; b=UzsWkCGsn6TQFhqSZYOpR99wDWCEXyZ5MMKliAg92jQS0AYBHwEF9zjvATBGutup0p NO4wYpNhStcU1J2cjuQ9GbbOxS0zgurgoKVwHDsFvcRp3qp+1FwJWk9aGuyQbd+ASbse iV3thzcFMTbZumH8eFJ/+YP8y1KiQsIPJKUs8IhaiUZOb43fNEAzNxjiZYFDNQPUG37S YBaAhRCr92G4fwx7c3G1Ptk9p0+T0o/DqhaN7oWXfr5m8Ga95DnhZNA9Q15IBNaTbnp2 gNSGwfBi+FAib0O60VIP4ATtHiqMscBaDINfd3MnenIeo3QSkPkQcshNYHMvheD3+gFv eKoQ== 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:subject:date; bh=OAxiGU2+Zm5TGJDmYfJLZJYOpFooL4QHZIWYZiKDaNI=; b=LJ1oBfb85rsUcaziTbe2XlpQDwSm1p/31VXK9ZhKWh5OHxdTfQJuzagnwPF6HjB1Jh B6ralkL+dd7Jj6f/oNeathGpWjrLyf/19pV6jam8Qjy4I/247po5CgQbE27mI/i6fROO 8qlDZEQxrGcgFHmWHLa4u59gRRnE4BRuqM9ZjxSzBBPgXoo++0nJ8w+VsrvIKNyKXo4j DFQgdgcCYMXE2ZL4ejs/88vcwivUM5a/CGrdJ3KSgs5ExCCHHpnhtXM7EtR3pRbQq5nI Dll0J37UJzRAsluOjvwFSHwnA4nJYar5CQk0SxUXMZYQqt5uVVfg8TTkKJudSLc4NfSz GNlw== X-Gm-Message-State: ACgBeo0kyR8xYYRpbTzw9462RdREUNNLgWYn/AAYSsTU/ionjONDvpdM gL66mHn7WJWDOFWa/CmTtn5hcdP7nnp0tq+xmR4= X-Google-Smtp-Source: AA6agR7THdtxfPlLHDj0ifMy7DcCylYYagRl6nsfCC9Vw9Lgt7j1YooO+zDIu58BxyQMjhmKLfZwaRD9tKprzZQX4dk= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:0:100e:712:9755:c523:9dcb:2228]) (user=ndesaulniers job=sendgmr) by 2002:a05:6902:192:b0:695:7e89:ed5b with SMTP id t18-20020a056902019200b006957e89ed5bmr1546228ybh.226.1662526768328; Tue, 06 Sep 2022 21:59:28 -0700 (PDT) Date: Tue, 6 Sep 2022 21:59:04 -0700 In-Reply-To: <20220907045907.484043-1-ndesaulniers@google.com> Mime-Version: 1.0 References: <20220907045907.484043-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=1662526746; l=2233; i=ndesaulniers@google.com; s=20211004; h=from:subject; bh=M5avwGZxXNJVxI+Cw3zYKb1tkFDlYgC1vraaiWNDNLE=; b=PMS5H0clISr6OeQLTZXXnl/Hs9ioLuh2rFA+ahRsD1VUjLrQCJQtmQXeyAUyMdzSLZZtrtXNSCWV 8GhYxzD9DiNFAxz0fymoGHRZtV2fWVqD5vlKD/7fvZ87O2xKqe1o X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220907045907.484043-3-ndesaulniers@google.com> Subject: [PATCH v3 2/5] Makefile.compiler: Use 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 when CONFIG_WERROR is set, 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. Also, change as-option and as-instr to use -x assembler-with-cpp since kernel sources are .S files that use the compiler as the driver. And then add -Werror as well. Link: https://github.com/ClangBuiltLinux/linux/issues/1699 Suggested-by: Masahiro Yamada Reviewed-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Changes v2 -> v1: * Add -x assembler-with-cpp -Werror to both as-option and (new) as-instr, as per Masahiro. * Add Masahiro's SB tag. Changes v1 -> v2: * Split off changes to arch/x86/boot/compressed/Makefile into parent patch, as per Masahiro. scripts/Makefile.compiler | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler index 94d0d40cddb3..a66638b5f4a5 100644 --- a/scripts/Makefile.compiler +++ b/scripts/Makefile.compiler @@ -29,16 +29,16 @@ 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) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp /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)) + printf "%b\n" "$(1)" | $(CC) -Werror $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3)) # __cc-option # Usage: MY_CFLAGS += $(call __cc-option,$(CC),$(MY_CFLAGS),-march=winchip-c6,-march=i586) From patchwork Wed Sep 7 04:59:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 12968436 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 45C38C38145 for ; Wed, 7 Sep 2022 04:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbiIGE7k (ORCPT ); Wed, 7 Sep 2022 00:59:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbiIGE7i (ORCPT ); Wed, 7 Sep 2022 00:59:38 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B9C5FAD for ; Tue, 6 Sep 2022 21:59:31 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id d8-20020a25bc48000000b00680651cf051so10171033ybk.23 for ; Tue, 06 Sep 2022 21:59:31 -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:subject:date; bh=bcgi8Ou8th2qqJa7CD88vTQQmiUlNdn6G38aIXpHI6Y=; b=ntpiMlsUZbBzGuoDfGrsuzC9Fu9Dngcb4gIzs9vYGwNNGJsAHWhrinnINN7afNa+aa Ju69QRlfFJKW9Y10Cp/2v4E6l4L3HUCFUsswVqibz/opy/3jfd5IGljZ+yDbnBHTGone gLjkZkXmzODkCXP09P6it2IQmKO6vQiVkQCWObUeDZWSQQsyH2CrqhdhCEkLAIvxJ++3 Cn1vaDzB3STqCw6p0UOO+5q+vBLH7eUoI8EnXYuDLIxqAjPA0pQIlsetbgBApQo/8knJ 9xuXq0izZx+52Ei7v7eLE+alDASuxx+P4GL55l25kj1eL6HIUPJ9xOXLI0sbvJ+5PZko Niqg== 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:subject:date; bh=bcgi8Ou8th2qqJa7CD88vTQQmiUlNdn6G38aIXpHI6Y=; b=BwJB88sMNPO1BoNXVXoEAau65vfF36iplCVBh4SGBkohzoL/orQzoQQx/jFT48IJQ4 4pNnhYLyRP0Cd9tW9tPDbBYh3X4kqC4Bb24MbuNmiDLuVG/9Pjk4yae3hdjWAozvqhPX 2tCERW1gBFESguTCpKCrPjnRE2RtG1Trvb9Ip6DJaNJyr8uk2AnX1+JLJ7Sk986A689B gkM5M5WADPdvtjC2Qn8JYfDGUqrAYVkiZvuAT7+Rrs5Ah9dZKnTJm5IfNbyEF/CPyE9k efVl5xafIWVZfR6nM2hxYQzOeQoRSZiqw7BL+1zj854mQ0ay1LVegjeE0F9M1O/AXsNx uFJw== X-Gm-Message-State: ACgBeo38s/JvNoCIbVNUSvqMSb+Pt/DFIakNb44v8YXlgKcFp4wxAhcq /kEnEZ1efwgT9JyIYqfbuvgpg6b9+Uh07dUW2OM= X-Google-Smtp-Source: AA6agR51gs/uUHreq+msqsiaEhkiRFCgMis3Jrd7egz+g3Jty9ES9OQyft1PDZ/MLkfp6N0Nb4aIesch0EUTQLjAZFA= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:0:100e:712:9755:c523:9dcb:2228]) (user=ndesaulniers job=sendgmr) by 2002:a25:2501:0:b0:6a9:2c63:41df with SMTP id l1-20020a252501000000b006a92c6341dfmr1513377ybl.570.1662526770665; Tue, 06 Sep 2022 21:59:30 -0700 (PDT) Date: Tue, 6 Sep 2022 21:59:05 -0700 In-Reply-To: <20220907045907.484043-1-ndesaulniers@google.com> Mime-Version: 1.0 References: <20220907045907.484043-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=1662526746; l=5523; i=ndesaulniers@google.com; s=20211004; h=from:subject; bh=vU2YBqs04SKJi0GQSDvA4poA04ESc702LTI4xVOdImw=; b=ACvgjV4W2Fn0d0OoSsDUnfzLwgzbvkoSX5pWoxmj3OhBeI7wqr6l/Ze+J8eLCVskjea6kj/Y/Vom ccwPJxl5DeIznlJUZRGwr4WOP/rnBszo5UuLLP878hh5x1U5qH57 X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220907045907.484043-4-ndesaulniers@google.com> Subject: [PATCH v3 3/5] Makefile.compiler: replace cc-ifversion with compiler-specific macros 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 cc-ifversion is GCC specific. Replace it with compiler specific variants. Update the users of cc-ifversion to use these new macros. Link: https://github.com/ClangBuiltLinux/linux/issues/350 Link: https://lore.kernel.org/llvm/CAGG=3QWSAUakO42kubrCap8fp-gm1ERJJAYXTnP1iHk_wrH=BQ@mail.gmail.com/ Suggested-by: Bill Wendling Reviewed-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Changes v2 -> v3: * Fix AMDGPU -msse flag, as per Nathan. * Pick up Nathan's RB tag. * Drop cc-min-version, as per Masahiro. Changes v1 -> v2: * New patch. Documentation/kbuild/makefiles.rst | 29 ++++++++++++--------- Makefile | 6 ++--- drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 +- scripts/Makefile.compiler | 10 ++++--- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst index 11a296e52d68..ee7e3ea1fbe1 100644 --- a/Documentation/kbuild/makefiles.rst +++ b/Documentation/kbuild/makefiles.rst @@ -682,22 +682,27 @@ more details, with real examples. In the above example, -Wno-unused-but-set-variable will be added to KBUILD_CFLAGS only if gcc really accepts it. - cc-ifversion - cc-ifversion tests the version of $(CC) and equals the fourth parameter - if version expression is true, or the fifth (if given) if the version - expression is false. + gcc-min-version + gcc-min-version tests if the value of $(CONFIG_GCC_VERSION) is greater than + or equal to the provided value and evaluates to y if so. Example:: - #fs/reiserfs/Makefile - ccflags-y := $(call cc-ifversion, -lt, 0402, -O1) + cflags-$(call gcc-min-version, 70100) := -foo - In this example, ccflags-y will be assigned the value -O1 if the - $(CC) version is less than 4.2. - cc-ifversion takes all the shell operators: - -eq, -ne, -lt, -le, -gt, and -ge - The third parameter may be a text as in this example, but it may also - be an expanded variable or a macro. + In this example, cflags-y will be assigned the value -foo if $(CC) is gcc and + $(CONFIG_GCC_VERSION) is >= 7.1. + + clang-min-version + clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater + than or equal to the provided value and evaluates to y if so. + + Example:: + + cflags-$(call clang-min-version, 110000) := -foo + + In this example, cflags-y will be assigned the value -foo if $(CC) is clang + and $(CONFIG_CLANG_VERSION) is >= 11.0.0. cc-cross-prefix cc-cross-prefix is used to check if there exists a $(CC) in path with diff --git a/Makefile b/Makefile index a4f71076cacb..cd9919c66b96 100644 --- a/Makefile +++ b/Makefile @@ -790,7 +790,6 @@ KBUILD_CFLAGS += $(stackp-flags-y) KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds -KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH) ifdef CONFIG_CC_IS_CLANG KBUILD_CPPFLAGS += -Qunused-arguments @@ -972,7 +971,6 @@ ifdef CONFIG_CC_IS_GCC KBUILD_CFLAGS += -Wno-maybe-uninitialized endif -ifdef CONFIG_CC_IS_GCC # The allocators already balk at large sizes, so silence the compiler # warnings for bounds checks involving those possible values. While # -Wno-alloc-size-larger-than would normally be used here, earlier versions @@ -984,8 +982,8 @@ ifdef CONFIG_CC_IS_GCC # ignored, continuing to default to PTRDIFF_MAX. So, left with no other # choice, we must perform a versioned check to disable this warning. # https://lore.kernel.org/lkml/20210824115859.187f272f@canb.auug.org.au -KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0901, -Wno-alloc-size-larger-than) -endif +KBUILD_CFLAGS-$(call gcc-min-version, 90100) += -Wno-alloc-size-larger-than +KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH) # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += -fno-strict-overflow diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile index 86a3b5bfd699..3c64ae0b212c 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile @@ -34,7 +34,7 @@ dml_ccflags := -mhard-float -maltivec endif ifdef CONFIG_CC_IS_GCC -ifeq ($(call cc-ifversion, -lt, 0701, y), y) +ifneq ($(call gcc-min-version, 70100),y) IS_OLD_GCC = 1 endif endif diff --git a/scripts/Makefile.compiler b/scripts/Makefile.compiler index a66638b5f4a5..4b998dadd79d 100644 --- a/scripts/Makefile.compiler +++ b/scripts/Makefile.compiler @@ -61,9 +61,13 @@ cc-option-yn = $(call try-run,\ cc-disable-warning = $(call try-run,\ $(CC) -Werror $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) -# cc-ifversion -# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) -cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4)) +# gcc-min-version +# Usage: cflags-$(call gcc-min-version, 70100) += -foo +gcc-min-version = $(shell [ $(CONFIG_GCC_VERSION) -ge $(1) ] && echo y) + +# clang-min-version +# Usage: cflags-$(call clang-min-version, 110000) += -foo +clang-min-version = $(shell [ $(CONFIG_CLANG_VERSION) -ge $(1) ] && echo y) # ld-option # Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y) From patchwork Wed Sep 7 04:59:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 12968437 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 B2288C6FA86 for ; Wed, 7 Sep 2022 04:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229528AbiIGE7l (ORCPT ); Wed, 7 Sep 2022 00:59:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbiIGE7i (ORCPT ); Wed, 7 Sep 2022 00:59:38 -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 74D71BF40 for ; Tue, 6 Sep 2022 21:59:33 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-3451e7b0234so70410977b3.23 for ; Tue, 06 Sep 2022 21:59:33 -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:subject:date; bh=1COoEIPBVX2RpaBUk98TcXRSJaNnm6A+DPC71dE8tyA=; b=s3zbhnn4yneYiDRSoLecTRmu6wrM36fumucM96wks5JEOW+winLJxgjTCizxSD0vQQ 4LIxu9C5zIHRcDqu2u2lNecbhUbn/2TWEkJJNOnQRGTbP/t+N8tSrjmLqoNZ4Hys/YfY rXjKvD+IaIth1LIDrIKHqgEj2zf3K/v0DQJ1j8rDMz5MwmTvfUGzUOKJa1lVvGPvqf9P +8A42mJo+1FKX2JGEWRbmq1cLWbk1x4A8ndh39gYz9TEaivkCM3GNR8CZxO90PyAaynQ mJT0Ist67AYlzVHi98qIbw0zfJsg4FDWxcQitTzHAY11Ikv4I9i0j4cc7EPR5ECWbtGC CVKw== 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:subject:date; bh=1COoEIPBVX2RpaBUk98TcXRSJaNnm6A+DPC71dE8tyA=; b=z9zaGV/Nt5PDIz62fb1FPLEVjwrsZMx6mqjxmXENZeGet0oBJ/CyLiG+CqI/POp1s7 LNNo9RFagU7aJAU8h1IgzFe5A7PesCKdzGb+AaUByeXsELRg+XrdM2G/NkA0dVkiif4O uby0TYZtKLOoiUSfT20fvoIIrgsOXfCv8K36ySHghPmpoHEmY/mzPI4BBvceA6lUQ2CC gH4pEYYfZwkUday3hyg0mlZDVfZz4EKWXudzuULQFEuBXdMnPaq5I7nAJQ4lU84d+O3A 2y7VniaYBJW6lxQvo3rZaz3gHAmozbSW6gzzEJbOtvBikOaxyxH4TXxeDbqYo2SD3ZCg htZA== X-Gm-Message-State: ACgBeo3KcpHv04vDKt8Yd2+Gy62//pNzedwj9oZvQR5fEymvLi4J0Ld8 B5WOiAphp5YhAHjQsJGBZrdLKOaYbAyEIJsgvrY= X-Google-Smtp-Source: AA6agR4PDE9DXpqaLgbI/t9G91mUki/RmvatymlHezczkZ1UM0qxH+3O/M1DPc+CuckZPxkGq1Gw30BzmtKEQyH16HA= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:0:100e:712:9755:c523:9dcb:2228]) (user=ndesaulniers job=sendgmr) by 2002:a05:6902:72a:b0:69e:f780:4de1 with SMTP id l10-20020a056902072a00b0069ef7804de1mr1597326ybt.53.1662526772788; Tue, 06 Sep 2022 21:59:32 -0700 (PDT) Date: Tue, 6 Sep 2022 21:59:06 -0700 In-Reply-To: <20220907045907.484043-1-ndesaulniers@google.com> Mime-Version: 1.0 References: <20220907045907.484043-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=1662526746; l=3571; i=ndesaulniers@google.com; s=20211004; h=from:subject; bh=izinVuTPOGuJAOWpMqC3T3tWj1j7qEU602s5D6R33gQ=; b=3HKm8e+bXV4z5Vehfj0HJ55Vwjh98Cw8BeO7rIXrOAoTmo0gFo5f7KN8zo1XTJHURY3xrr+qxu8O 7wO+MevQBnzuM/Tu/NZEUxCAUC2q1PZIAlDnuHsKyAQG1XPgoYnY X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220907045907.484043-5-ndesaulniers@google.com> Subject: [PATCH v3 4/5] 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") 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 Reviewed-by: Nathan Chancellor Suggested-by: Masahiro Yamada Signed-off-by: Nick Desaulniers --- Changes v2 -> v3: * Replace diff outright with Masahiro's suggestion in https://lore.kernel.org/llvm/CAK7LNATWDH01=ZKLnsxc0vcib1zGDbEq8jLQwhWP7HkkmSb_Mw@mail.gmail.com/2-dwarf.diff with some modifications, PTAL. * Pick up Nathan's RB tag and Masahiro's SB tag. * Cut down commit message. Changes v1 -> v2: * Use newly added compiler-specific macros, as per Bill. lib/Kconfig.debug | 4 +++- scripts/Makefile.debug | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index bcbe60d6c80c..d3e5f36bb01e 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -264,8 +264,10 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT config DEBUG_INFO_DWARF4 bool "Generate DWARF Version 4 debuginfo" select DEBUG_INFO + depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) help - Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+. + Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 + if using clang without clang's integrated assembler, and gdb 7.0+. If you have consumers of DWARF debug info that are not ready for newer revisions of DWARF, you may wish to choose this or have your diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug index 9f39b0130551..2845145c1220 100644 --- a/scripts/Makefile.debug +++ b/scripts/Makefile.debug @@ -3,17 +3,16 @@ DEBUG_CFLAGS := ifdef CONFIG_DEBUG_INFO_SPLIT DEBUG_CFLAGS += -gsplit-dwarf else -DEBUG_CFLAGS += -g +debug-cflags-y += -g endif -ifndef CONFIG_AS_IS_LLVM -KBUILD_AFLAGS += -Wa,-gdwarf-2 -endif +debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gdwarf-4 +debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gdwarf-5 -ifndef 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) +ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU),yy) +# Clang does not pass -g or -gdwarf-* option down to GAS. +# Add -Wa, prefix to explicitly specify the flags. +KBUILD_AFLAGS += $(addprefix -Wa$(comma), $(debug-flags-y)) endif ifdef CONFIG_DEBUG_INFO_REDUCED @@ -29,5 +28,7 @@ KBUILD_AFLAGS += -gz=zlib KBUILD_LDFLAGS += --compress-debug-sections=zlib endif -KBUILD_CFLAGS += $(DEBUG_CFLAGS) +DEBUG_CFLAGS += $(debug-flags-y) +KBUILD_AFLAGS += $(debug-flags-y) +KBUILD_CFLAGS += $(DEBUG_CFLAGS) export DEBUG_CFLAGS From patchwork Wed Sep 7 04:59:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Desaulniers X-Patchwork-Id: 12968439 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 0FAD8C38145 for ; Wed, 7 Sep 2022 04:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229488AbiIGE7p (ORCPT ); Wed, 7 Sep 2022 00:59:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229662AbiIGE7j (ORCPT ); Wed, 7 Sep 2022 00:59:39 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11BFF120B4 for ; Tue, 6 Sep 2022 21:59:36 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id h9-20020a256c09000000b0069671af62ecso10124610ybc.4 for ; Tue, 06 Sep 2022 21:59:36 -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:subject:date; bh=c0DpBOnZ7fHKw3QNWuDsBHLUoP21ketOwjbqwElOkqs=; b=G3opd2Kk7smjSi01ZxULHYBb3aZEPYHUyBy3/mRzPOA7AoYOgM1AG5Hr7cycpkvp2k 7zmIUTwbwGDC2E7T4vT/WYWusN78+R87+am64PQyPlKsAzEmY50QiKUKIAoq02QVC52q AeM1hmMw/deHDfPRbcEMAs2fdxfnRnwQin//MD28AjsSEt8iOmIlErdGoPa9zNXWO15A X4/SX+bm7r1NdOrUdFOy1qu4GZ4TxCTv6HXUl8Hqc7sWxBBNwG8BE1eVwLXfWAwS1aQw +0gDpWtqgpEKjBXTHa3efxgcMH+NWtwBBFv0w/mQISgkan8BA28APqByaEUis7YN7XH1 gbPA== 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:subject:date; bh=c0DpBOnZ7fHKw3QNWuDsBHLUoP21ketOwjbqwElOkqs=; b=pv4v3xBfmeLh51XCLROS0/b1Odn1O2lda8ISi56UJpGUJfQBAcebEsxHjMr+06BS6F 5LpumZbOydsBd/BO/HZj7zO+oU5L31MOqwrARkCPB1Azz5p+U1ZO+OnyIL2hCsjvzbaH /KlqW4PCtRhVCs/NS5k7D7603lv1tZgY0G4SGbkc7mlHtYS5QutmlcZA9b5PHg6xGK58 6GNoGmUwfFV1kT1Z0v3rcsGp+k+tAh6pU/wyaQJuxtHOlf2xX8WfbRLmZZAPrWlRu5F0 GdfOQoXKLNa6GhD/MBSfIQHJ2xUj9G0yX4Pt+9R3SaNfyp5vOVhgrkiY5h4A36NauDnu 9whA== X-Gm-Message-State: ACgBeo193OSCri2YJlYyH3d/CIpxFzPR3jQn8FjjcfsWK47KCanWXHIr Vq6mw0e/nCEHxudxMaZAqBc9llSTfdtxj8eYWU0= X-Google-Smtp-Source: AA6agR4yqG8oXRGrN2c3vGVjKmn+ZXcqxyGd3kFbqy9a7TH8mlfm2goz1npG5dcXN3vR8r+Mk+rzj0/w3aimHdWPBSI= X-Received: from ndesaulniers1.mtv.corp.google.com ([2620:0:100e:712:9755:c523:9dcb:2228]) (user=ndesaulniers job=sendgmr) by 2002:a25:26c9:0:b0:6a9:922:4a6d with SMTP id m192-20020a2526c9000000b006a909224a6dmr1571274ybm.239.1662526775388; Tue, 06 Sep 2022 21:59:35 -0700 (PDT) Date: Tue, 6 Sep 2022 21:59:07 -0700 In-Reply-To: <20220907045907.484043-1-ndesaulniers@google.com> Mime-Version: 1.0 References: <20220907045907.484043-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=1662526746; l=2043; i=ndesaulniers@google.com; s=20211004; h=from:subject; bh=0UUXvo2ECsHljJrCvpyFZ/IOiA9qf1pxH+OXOsjnp1k=; b=EPZloRmrF5sgzyoix1T+c/b0M8kYWBCLqwRogtnVgQh3+LO3Uy4aqeBCu1Thtarw+ZI/xgMsperC QC/5HfWjCEpJsJsOsjwgYmvtS6GTbJlSsOD2ruSzWrRZsqSP2wbm X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220907045907.484043-6-ndesaulniers@google.com> Subject: [PATCH v3 5/5] 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 , Andi Kleen 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. -gsplit-dwarf has been mutually exclusive with -g since support for CONFIG_DEBUG_INFO_SPLIT was introduced in commit 866ced950bcd ("kbuild: Support split debug info v4") I don't think it ever needed to be. 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 Cc: Andi Kleen Reported-by: Dmitrii Bundin Reported-by: Fangrui Song Reported-by: Masahiro Yamada Suggested-by: Dmitrii Bundin Reviewed-by: Nathan Chancellor Signed-off-by: Nick Desaulniers --- Changes v2 -> v3: * Pick up Nathan's RB tag. Changes v1 -> v2: * Add reference to 866ced950bcd, cc Andi, in commit message. scripts/Makefile.debug | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug index 2845145c1220..c20f8f2e76bf 100644 --- a/scripts/Makefile.debug +++ b/scripts/Makefile.debug @@ -1,10 +1,4 @@ -DEBUG_CFLAGS := - -ifdef CONFIG_DEBUG_INFO_SPLIT -DEBUG_CFLAGS += -gsplit-dwarf -else -debug-cflags-y += -g -endif +DEBUG_CFLAGS := -g debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gdwarf-4 debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gdwarf-5 @@ -15,6 +9,8 @@ ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU),yy) KBUILD_AFLAGS += $(addprefix -Wa$(comma), $(debug-flags-y)) endif +debug-flags-$(CONFIG_DEBUG_INFO_SPLIT) += -gsplit-dwarf + ifdef CONFIG_DEBUG_INFO_REDUCED DEBUG_CFLAGS += -fno-var-tracking ifdef CONFIG_CC_IS_GCC