From 7934b02b50b6948da3ef4ef6619412390e5e0dce Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Mon, 31 Aug 2020 10:26:19 -0700
Subject: [PATCH] Temporarily revert default dll characteristics.

Until more testing is done, this patch reverts the
DEFAULT_DLL_CHARACTERISTICS to 0, but keeps the new --disable- options
for the flags so that they can be overridden later on the command line.

Note that this does NOT revert the default --enable-reloc-section.  This
shouldn't hurt anything other than making the resulting executable
larger.
---
 ld/emultempl/pe.em  | 3 +--
 ld/emultempl/pep.em | 4 +---
 ld/ld.texi          | 7 +++----
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 59cb20241b..6c14af5e29 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -104,8 +104,7 @@ fragment <<EOF
 #define DEFAULT_PSEUDO_RELOC_VERSION 1
 #endif
 
-#define DEFAULT_DLL_CHARACTERISTICS	(IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE \
-					 | IMAGE_DLL_CHARACTERISTICS_NX_COMPAT)
+#define DEFAULT_DLL_CHARACTERISTICS	0
 
 #if defined(TARGET_IS_i386pe) || ! defined(DLL_SUPPORT)
 #define	PE_DEF_SUBSYSTEM		3
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index f3a0929b88..639a9e96cc 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -99,9 +99,7 @@ fragment <<EOF
 #define DLL_SUPPORT
 #endif
 
-#define DEFAULT_DLL_CHARACTERISTICS	(IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE \
-					 | IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA \
-					 | IMAGE_DLL_CHARACTERISTICS_NX_COMPAT)
+#define DEFAULT_DLL_CHARACTERISTICS	0
 
 #if defined(TARGET_IS_i386pep) || ! defined(DLL_SUPPORT)
 #define	PE_DEF_SUBSYSTEM		3
diff --git a/ld/ld.texi b/ld/ld.texi
index 43658a2daa..3bc4d908a9 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -3099,7 +3099,7 @@ of the PE file header:
 @item --high-entropy-va
 @itemx --disable-high-entropy-va
 Image is compatible with 64-bit address space layout randomization
-(ASLR).  This option is enabled by default for 64-bit PE images.
+(ASLR).  This option is disabled by default.
 
 This option also implies @option{--dynamicbase} and
 @option{--enable-reloc-section}.
@@ -3109,8 +3109,7 @@ This option also implies @option{--dynamicbase} and
 @itemx --disable-dynamicbase
 The image base address may be relocated using address space layout
 randomization (ASLR).  This feature was introduced with MS Windows
-Vista for i386 PE targets.  This option is enabled by default but
-can be disabled via the @option{--disable-dynamicbase} option.
+Vista for i386 PE targets.  This option is disabled by default.
 This option also implies @option{--enable-reloc-section}.
 
 @kindex --forceinteg
@@ -3124,7 +3123,7 @@ default.
 @item --disable-nxcompat
 The image is compatible with the Data Execution Prevention.
 This feature was introduced with MS Windows XP SP2 for i386 PE
-targets.  The option is enabled by default.
+targets.  The option is disabled by default.
 
 @kindex --no-isolation
 @item --no-isolation
-- 
2.28.0.windows.1

