forked from OSchip/llvm-project
Set IMAGE_DLL_CHARACTERISTICS_NO_BIND.
Our output is not compatible with the Binding feature, so make it explicit that. Differential Revision: https://reviews.llvm.org/D33336 llvm-svn: 303378
This commit is contained in:
parent
d66d976efd
commit
a674943211
|
@ -155,7 +155,6 @@ struct Configuration {
|
|||
uint32_t MajorOSVersion = 6;
|
||||
uint32_t MinorOSVersion = 0;
|
||||
bool DynamicBase = true;
|
||||
bool AllowBind = true;
|
||||
bool NxCompat = true;
|
||||
bool AllowIsolation = true;
|
||||
bool TerminalServerAware = true;
|
||||
|
|
|
@ -820,8 +820,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
|
|||
Config->ManifestInput.push_back(Arg->getValue());
|
||||
|
||||
// Handle miscellaneous boolean flags.
|
||||
if (Args.hasArg(OPT_allowbind_no))
|
||||
Config->AllowBind = false;
|
||||
if (Args.hasArg(OPT_allowisolation_no))
|
||||
Config->AllowIsolation = false;
|
||||
if (Args.hasArg(OPT_dynamicbase_no))
|
||||
|
|
|
@ -615,14 +615,19 @@ template <typename PEHeaderTy> void Writer::writeHeader() {
|
|||
PE->SizeOfStackCommit = Config->StackCommit;
|
||||
PE->SizeOfHeapReserve = Config->HeapReserve;
|
||||
PE->SizeOfHeapCommit = Config->HeapCommit;
|
||||
|
||||
// Import Descriptor Tables and Import Address Tables are merged
|
||||
// in our output. That's not compatible with the Binding feature
|
||||
// that is sort of prelinking. Setting this flag to make it clear
|
||||
// that our outputs are not for the Binding.
|
||||
PE->DLLCharacteristics = IMAGE_DLL_CHARACTERISTICS_NO_BIND;
|
||||
|
||||
if (Config->AppContainer)
|
||||
PE->DLLCharacteristics |= IMAGE_DLL_CHARACTERISTICS_APPCONTAINER;
|
||||
if (Config->DynamicBase)
|
||||
PE->DLLCharacteristics |= IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE;
|
||||
if (Config->HighEntropyVA)
|
||||
PE->DLLCharacteristics |= IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA;
|
||||
if (!Config->AllowBind)
|
||||
PE->DLLCharacteristics |= IMAGE_DLL_CHARACTERISTICS_NO_BIND;
|
||||
if (Config->NxCompat)
|
||||
PE->DLLCharacteristics |= IMAGE_DLL_CHARACTERISTICS_NX_COMPAT;
|
||||
if (!Config->AllowIsolation)
|
||||
|
|
|
@ -41,9 +41,10 @@ HEADER-NEXT: MinorSubsystemVersion: 0
|
|||
HEADER-NEXT: SizeOfImage: 16896
|
||||
HEADER-NEXT: SizeOfHeaders: 512
|
||||
HEADER-NEXT: Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI (0x3)
|
||||
HEADER-NEXT: Characteristics [ (0x9140)
|
||||
HEADER-NEXT: Characteristics [ (0x9940)
|
||||
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_APPCONTAINER (0x1000)
|
||||
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE (0x40)
|
||||
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_NO_BIND (0x800)
|
||||
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_NX_COMPAT (0x100)
|
||||
HEADER-NEXT: IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE (0x8000)
|
||||
HEADER-NEXT: ]
|
||||
|
|
|
@ -2,13 +2,7 @@
|
|||
|
||||
# RUN: lld-link /out:%t.exe /entry:main %t.obj
|
||||
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=BIND %s
|
||||
# RUN: lld-link /allowbind /out:%t.exe /entry:main %t.obj
|
||||
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=BIND %s
|
||||
BIND-NOT: IMAGE_DLL_CHARACTERISTICS_NO_BIND
|
||||
|
||||
# RUN: lld-link /allowbind:no /out:%t.exe /entry:main %t.obj
|
||||
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=NOBIND %s
|
||||
NOBIND: IMAGE_DLL_CHARACTERISTICS_NO_BIND
|
||||
BIND: IMAGE_DLL_CHARACTERISTICS_NO_BIND
|
||||
|
||||
# RUN: lld-link /out:%t.exe /entry:main %t.obj
|
||||
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=ISO %s
|
||||
|
|
Loading…
Reference in New Issue