Extend the description of PE header flags.
authorEli Zaretskii <eliz@gnu.org>
Wed, 21 Apr 2021 16:38:52 +0000 (17:38 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 21 Apr 2021 16:38:52 +0000 (17:38 +0100)
PR 27760
include * coff/pe.h (IMAGE_DLLCHARACTERISTICS_APPCONTAINER): Define.
(IMAGE_DLLCHARACTERISTICS_GUARD_CF): Define.

bfd * peXXigen.c (_bfd_XX_print_private_bfd_data_common): Add display
of IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP,
IMAGE_FILE_NET_RUN_FROM_SWAP and IMAGE_FILE_UP_SYSTEM_ONLY flags.
Decode the contents of the DllCharacteristics field.

bfd/ChangeLog
bfd/peXXigen.c
include/ChangeLog
include/coff/pe.h

index 85f4f37de1e99c43ce0b38560f1b836d3aa85f13..db31bdb2669254e632ee2dd8194cd4683c55fc56 100644 (file)
@@ -1,3 +1,11 @@
+2021-04-21  Eli Zaretskii  <eliz@gnu.org>
+
+       PR 27760
+       * peXXigen.c (_bfd_XX_print_private_bfd_data_common): Add display
+       of IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP,
+       IMAGE_FILE_NET_RUN_FROM_SWAP and IMAGE_FILE_UP_SYSTEM_ONLY flags.
+       Decode the contents of the DllCharacteristics field.
+
 2021-04-21  Nick Clifton  <nickc@redhat.com>
 
        PR 27759
index b9a679a3701527f8b363796ae0770cb0e9c0a171..c41c3299277846875ee7eca9ca00e530b2683d61 100644 (file)
@@ -2720,8 +2720,11 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile)
   PF (IMAGE_FILE_BYTES_REVERSED_LO, "little endian");
   PF (IMAGE_FILE_32BIT_MACHINE, "32 bit words");
   PF (IMAGE_FILE_DEBUG_STRIPPED, "debugging information removed");
+  PF (IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP, "copy to swap file if on removable media");
+  PF (IMAGE_FILE_NET_RUN_FROM_SWAP, "copy to swap file if on network media");
   PF (IMAGE_FILE_SYSTEM, "system file");
   PF (IMAGE_FILE_DLL, "DLL");
+  PF (IMAGE_FILE_UP_SYSTEM_ONLY, "run only on uniprocessor machine");
   PF (IMAGE_FILE_BYTES_REVERSED_HI, "big endian");
 #undef PF
 
@@ -2848,6 +2851,34 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile)
   if (subsystem_name)
     fprintf (file, "\t(%s)", subsystem_name);
   fprintf (file, "\nDllCharacteristics\t%08x\n", i->DllCharacteristics);
+  if (i->DllCharacteristics)
+    {
+      unsigned short dllch = i->DllCharacteristics;
+      const char *indent = "\t\t\t\t\t";
+
+      if (dllch & IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA)
+       fprintf (file, "%sHIGH_ENTROPY_VA\n", indent);
+      if (dllch & IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE)
+       fprintf (file, "%sDYNAMIC_BASE\n", indent);
+      if (dllch & IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY)
+       fprintf (file, "%sFORCE_INTEGRITY\n", indent);
+      if (dllch & IMAGE_DLL_CHARACTERISTICS_NX_COMPAT)
+       fprintf (file, "%sNX_COMPAT\n", indent);
+      if (dllch & IMAGE_DLLCHARACTERISTICS_NO_ISOLATION)
+       fprintf (file, "%sNO_ISOLATION\n", indent);
+      if (dllch & IMAGE_DLLCHARACTERISTICS_NO_SEH)
+       fprintf (file, "%sNO_SEH\n", indent);
+      if (dllch & IMAGE_DLLCHARACTERISTICS_NO_BIND)
+       fprintf (file, "%sNO_BIND\n", indent);
+      if (dllch & IMAGE_DLLCHARACTERISTICS_APPCONTAINER)
+       fprintf (file, "%sAPPCONTAINER\n", indent);
+      if (dllch & IMAGE_DLLCHARACTERISTICS_WDM_DRIVER)
+       fprintf (file, "%sWDM_DRIVER\n", indent);
+      if (dllch & IMAGE_DLLCHARACTERISTICS_GUARD_CF)
+       fprintf (file, "%sGUARD_CF\n", indent);
+      if (dllch & IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE)
+       fprintf (file, "%sTERMINAL_SERVICE_AWARE\n", indent);
+    }
   fprintf (file, "SizeOfStackReserve\t");
   bfd_fprintf_vma (abfd, file, i->SizeOfStackReserve);
   fprintf (file, "\nSizeOfStackCommit\t");
index 83ae2cb84cc75a7aebae23ce5b897e7b761b467e..20aefde33971e366f622f006d5ae23f9052a102c 100644 (file)
@@ -1,3 +1,9 @@
+2021-04-21  Eli Zaretskii  <eliz@gnu.org>
+
+       PR 27760
+       * coff/pe.h (IMAGE_DLLCHARACTERISTICS_APPCONTAINER): Define.
+       (IMAGE_DLLCHARACTERISTICS_GUARD_CF): Define.
+
 2021-04-16  Alan Modra  <amodra@gmail.com>
 
        PR 27567
index d6e84691677f1337ec931cdb62cd4470472a22bf..9e1ea4b5aa47b8278a0e7a88fad2db5dd8bc9fc5 100644 (file)
@@ -49,7 +49,9 @@
 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION           0x0200
 #define IMAGE_DLLCHARACTERISTICS_NO_SEH                 0x0400
 #define IMAGE_DLLCHARACTERISTICS_NO_BIND                0x0800
+#define IMAGE_DLLCHARACTERISTICS_APPCONTAINER           0x1000
 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER             0x2000
+#define IMAGE_DLLCHARACTERISTICS_GUARD_CF               0x4000
 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE  0x8000
 
 /* Additional flags to be set for section headers to allow the NT loader to