From bd28bd59a3693b6abc12231f2140e02760c0ada0 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 24 Aug 2022 19:56:31 +0000 Subject: [clang-cl] /kernel should toggle bit 30 in @feat.00 The linker is supposed to detect when an object with /kernel is linked with another object which is not compiled with /kernel. The linker detects this by checking bit 30 in @feat.00. --- clang/lib/CodeGen/CodeGenModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 6238a289978d..9df197056664 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -697,6 +697,10 @@ void CodeGenModule::Release() { // Function ID tables for EH Continuation Guard. getModule().addModuleFlag(llvm::Module::Warning, "ehcontguard", 1); } + if (Context.getLangOpts().Kernel) { + // Note if we are compiling with /kernel. + getModule().addModuleFlag(llvm::Module::Warning, "ms-kernel", 1); + } if (CodeGenOpts.OptimizationLevel > 0 && CodeGenOpts.StrictVTablePointers) { // We don't support LTO with 2 with different StrictVTablePointers // FIXME: we could support it by stripping all the information introduced -- cgit v1.2.3