[PATCH] D33336: Set IMAGE_DLL_CHARACTERISTICS_NO_BIND.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 18 13:40:25 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303378: Set IMAGE_DLL_CHARACTERISTICS_NO_BIND. (authored by ruiu).
Changed prior to commit:
https://reviews.llvm.org/D33336?vs=99486&id=99487#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33336
Files:
lld/trunk/COFF/Config.h
lld/trunk/COFF/Driver.cpp
lld/trunk/COFF/Writer.cpp
lld/trunk/test/COFF/hello32.test
lld/trunk/test/COFF/options.test
Index: lld/trunk/test/COFF/hello32.test
===================================================================
--- lld/trunk/test/COFF/hello32.test
+++ lld/trunk/test/COFF/hello32.test
@@ -41,9 +41,10 @@
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: ]
Index: lld/trunk/test/COFF/options.test
===================================================================
--- lld/trunk/test/COFF/options.test
+++ lld/trunk/test/COFF/options.test
@@ -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
Index: lld/trunk/COFF/Config.h
===================================================================
--- lld/trunk/COFF/Config.h
+++ lld/trunk/COFF/Config.h
@@ -155,7 +155,6 @@
uint32_t MajorOSVersion = 6;
uint32_t MinorOSVersion = 0;
bool DynamicBase = true;
- bool AllowBind = true;
bool NxCompat = true;
bool AllowIsolation = true;
bool TerminalServerAware = true;
Index: lld/trunk/COFF/Driver.cpp
===================================================================
--- lld/trunk/COFF/Driver.cpp
+++ lld/trunk/COFF/Driver.cpp
@@ -820,8 +820,6 @@
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))
Index: lld/trunk/COFF/Writer.cpp
===================================================================
--- lld/trunk/COFF/Writer.cpp
+++ lld/trunk/COFF/Writer.cpp
@@ -615,14 +615,19 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33336.99487.patch
Type: text/x-patch
Size: 3640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170518/7f7ca43d/attachment.bin>
More information about the llvm-commits
mailing list