[lld] r244425 - COFF: Define symbols for MSVC 2015 Control Flow Protection.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 9 14:01:06 PDT 2015
Author: ruiu
Date: Sun Aug 9 16:01:06 2015
New Revision: 244425
URL: http://llvm.org/viewvc/llvm-project?rev=244425&view=rev
Log:
COFF: Define symbols for MSVC 2015 Control Flow Protection.
MSVC 2015's load configuration object (__load_config_used) contains
references to these symbols. I don't fully understand how it works,
but looks like these symbols are linker-defined ones. So I define them
here in the Driver. With this patch, LLD can self-host with MSVC 2015.
This patch is to link MSVC 2015-produced object files. It does not
implement Control Flow Protection. If I understand correctly, the
linker has to create a bitmap of function entry point addresses for
the CFG runtime. We don't do that yet. Produced executables will not
be protected by CFG.
Modified:
lld/trunk/COFF/Driver.cpp
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=244425&r1=244424&r2=244425&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Sun Aug 9 16:01:06 2015
@@ -538,6 +538,12 @@ void LinkerDriver::link(llvm::ArrayRef<c
Config->SEHCount = Symtab.addAbsolute("___safe_se_handler_count", 0);
}
+ // We do not support /guard:cf (control flow protection) yet.
+ // Define CFG symbols anyway so that we can link MSVC 2015 CRT.
+ Symtab.addAbsolute(mangle("__guard_fids_table"), 0);
+ Symtab.addAbsolute(mangle("__guard_fids_count"), 0);
+ Symtab.addAbsolute(mangle("__guard_flags"), 0x100);
+
// Read as much files as we can from directives sections.
Symtab.run();
More information about the llvm-commits
mailing list