Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2432460pxb; Sat, 30 Jan 2021 02:24:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzA2DsJSGMo5vgkfpKTmfVi6HLVlhJ4zkevVrmVV1dDnSY5q0CYZxUyYOida046v8ZUafkr X-Received: by 2002:a17:906:b757:: with SMTP id fx23mr8475332ejb.273.1612002284096; Sat, 30 Jan 2021 02:24:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612002284; cv=none; d=google.com; s=arc-20160816; b=fieW0qlNuBDG6xHqoRGdOmh88DgPhWaggMVXsnDrD+ZlMGdO/yEiJW9jO8R7moZFmt QhH2CrWOpsgE2811aNQT0RTC+5szthPaBJFVZiU92Vdvvr56+20AuatFHx7wLKi1PrGZ nEXUJDPOHHAEaWpnzJehtLRP30UmJjhTpqYJXE/mCux3/o31sZjfbGUbpp0EYkgbGlT3 gmYd8LB8OArc7d9xNzilKS3jtOlz3Iv2Von1Rc6r89V14DItuRy0/3X/avM8gkxMGhbr mc1zxqZzgE36xfC3GrnpX1EdwTsTyYkXkumucE4n73ppBu98ivZvDGTOd0tTdxptZ92L dE4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3x9VFg7sCskUVPa9T5fWvrYkiNTKCCwthKMcxFyTqcE=; b=owlGJCFKY96K3IAKILbxkeRj+HZtMhxBI6Jt3si/sd2STz4Wn++H74ZsrBrODMrFeH l8Tl0HsgdiSAvoyIQcLbSIdlbuIUzrHntC5mLC74Hi2NfhbhNvG4bzhhgTvyh00Mvk8f oP9MCoRzDWIOhByJBPwKHm3npxwVpTdtl2wmAFTDvbHEhgt7iDJ9fGhTeojpD4751ws3 eNoSvQZfCbOlzPuztwgSQ0DZcHLraW4nnXLHBOfQSW6IftRQXQzSI4ZK+58StcIsXBpy 1Yr4TQz4pE8/7St8WG4FoJvSNwhKzN12YJabFZu8aD/vV2NPasGiOAtLHYz5zbfkUhCF ruMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pGK18VaL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si6905438edy.464.2021.01.30.02.24.20; Sat, 30 Jan 2021 02:24:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pGK18VaL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231562AbhA3KVt (ORCPT + 99 others); Sat, 30 Jan 2021 05:21:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:44944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231423AbhA3A16 (ORCPT ); Fri, 29 Jan 2021 19:27:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7BA3764E00; Sat, 30 Jan 2021 00:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611966435; bh=T6CSjbBhjBe08pyip59nu5BecvICMTSZdw9QpUPIIHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pGK18VaLZTQOfi8+66QN4kHlHzjo23VuSHdPsntDxYAH64wUjqHh8FkoPFo4CmDbv i8shE68JzyhYJ/rj5eFy34Ib90yTqJZf6NEd3UydvmB5MqqsZ6aHb4l8FWRGq2TNQx Uo2TqIAzhaxzpOEmoh9SGvIotQs/5UFvH+qj6z1WD393ZsH30P4JCQpEAVXNQwP8wH 5CslTXVdLI/1RumHZiO/ZhyYmgrYkh8Db6162j/Hum045SyCuOI9Gs0wDJgHk74ZcD mbknya/pJmNNz4cPaNXyBa3a0ihkY2tcdYqilb8zCEtNDf5DH5QSSpoRK20FQ5pLU7 DeLsvWCvzJMQg== From: Nathan Chancellor To: Arnd Bergmann , Kees Cook Cc: Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , kernel test robot , Fangrui Song Subject: [PATCH v2] vmlinux.lds.h: Define SANTIZER_DISCARDS with CONFIG_GCOV_KERNEL=y Date: Fri, 29 Jan 2021 17:25:58 -0700 Message-Id: <20210130002557.2681512-1-nathan@kernel.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210129201116.2658179-1-nathan@kernel.org> References: <20210129201116.2658179-1-nathan@kernel.org> MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org clang produces .eh_frame sections when CONFIG_GCOV_KERNEL is enabled, even when -fno-asynchronous-unwind-tables is in KBUILD_CFLAGS: $ make CC=clang vmlinux ... ld: warning: orphan section `.eh_frame' from `init/main.o' being placed in section `.eh_frame' ld: warning: orphan section `.eh_frame' from `init/version.o' being placed in section `.eh_frame' ld: warning: orphan section `.eh_frame' from `init/do_mounts.o' being placed in section `.eh_frame' ld: warning: orphan section `.eh_frame' from `init/do_mounts_initrd.o' being placed in section `.eh_frame' ld: warning: orphan section `.eh_frame' from `init/initramfs.o' being placed in section `.eh_frame' ld: warning: orphan section `.eh_frame' from `init/calibrate.o' being placed in section `.eh_frame' ld: warning: orphan section `.eh_frame' from `init/init_task.o' being placed in section `.eh_frame' ... $ rg "GCOV_KERNEL|GCOV_PROFILE_ALL" .config CONFIG_GCOV_KERNEL=y CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y CONFIG_GCOV_PROFILE_ALL=y This was already handled for a couple of other options in commit d812db78288d ("vmlinux.lds.h: Avoid KASAN and KCSAN's unwanted sections") and there is an open LLVM bug for this issue. Take advantage of that section for this config as well so that there are no more orphan warnings. Link: https://bugs.llvm.org/show_bug.cgi?id=46478 Link: https://github.com/ClangBuiltLinux/linux/issues/1069 Reported-by: kernel test robot Reviewed-by: Fangrui Song Reviewed-by: Nick Desaulniers Signed-off-by: Nathan Chancellor --- v1 -> v2: * Keep configs and flag names alphabetized. * Drop mention of -ftest-coverage since it does not cause this issue per Fangrui. * Pick up review tags from Fangrui and Nick. include/asm-generic/vmlinux.lds.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index b2b3d81b1535..0e6c5da667a7 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -988,12 +988,13 @@ #endif /* - * Clang's -fsanitize=kernel-address and -fsanitize=thread produce - * unwanted sections (.eh_frame and .init_array.*), but - * CONFIG_CONSTRUCTORS wants to keep any .init_array.* sections. + * Clang's -fprofile-arcs, -fsanitize=kernel-address, and + * -fsanitize=thread produce unwanted unwanted sections + * (.eh_frame and .init_array.*), but CONFIG_CONSTRUCTORS + * wants to keep any .init_array.* sections. * https://bugs.llvm.org/show_bug.cgi?id=46478 */ -#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KCSAN) +#if defined(CONFIG_GCOV_KERNEL) || defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KCSAN) # ifdef CONFIG_CONSTRUCTORS # define SANITIZER_DISCARDS \ *(.eh_frame) base-commit: bec4c2968fce2f44ce62d05288a633cd99a722eb -- 2.30.0