ANDROID: vmlinux.lds.h: Define SANITIZER_DISCARDS with CONFIG_CFI_CLANG

Clang generates an .eh_frame section with CFI, which produces orphan
section warnings:

ld.lld: warning: <internal>:(.eh_frame) is being placed in '.eh_frame'

Define SANITIZER_DISCARDS to drop .eh_frame also with CFI.

Bug: 145210207
Link: https://github.com/ClangBuiltLinux/linux/issues/1227
Change-Id: I383f1d87920894440a234f8fca56f48119777042
Suggested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
Sami Tolvanen
2021-03-18 16:08:37 -07:00
committed by Alistair Delva
parent ffacd097fc
commit 5896d00f9c

View File

@@ -1030,7 +1030,8 @@
* keep any .init_array.* sections. * keep any .init_array.* sections.
* https://bugs.llvm.org/show_bug.cgi?id=46478 * https://bugs.llvm.org/show_bug.cgi?id=46478
*/ */
#if defined(CONFIG_GCOV_KERNEL) || defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KCSAN) #if defined(CONFIG_GCOV_KERNEL) || defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KCSAN) || \
defined(CONFIG_CFI_CLANG)
# ifdef CONFIG_CONSTRUCTORS # ifdef CONFIG_CONSTRUCTORS
# define SANITIZER_DISCARDS \ # define SANITIZER_DISCARDS \
*(.eh_frame) *(.eh_frame)