[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:19:45 PDT 2017


ruiu created this revision.

Our output is not compatible with the Binding feature, so make it
explicit that.


https://reviews.llvm.org/D33336

Files:
  lld/COFF/Config.h
  lld/COFF/Driver.cpp
  lld/COFF/Writer.cpp


Index: lld/COFF/Writer.cpp
===================================================================
--- lld/COFF/Writer.cpp
+++ lld/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)
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/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/COFF/Config.h
===================================================================
--- lld/COFF/Config.h
+++ lld/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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33336.99485.patch
Type: text/x-patch
Size: 1967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170518/62a43f30/attachment.bin>


More information about the llvm-commits mailing list