* emultempl/pe.em (real_flags): New static.
authorBrian Ford <ford@vss.fsi.com>
Fri, 7 May 2004 15:17:58 +0000 (15:17 +0000)
committerBrian Ford <ford@vss.fsi.com>
Fri, 7 May 2004 15:17:58 +0000 (15:17 +0000)
(OPTION_LARGE_ADDRESS_AWARE): New define.
(gld${EMULATION_NAME}_add_options): Add --large-address-aware option.
(gld_${EMULATION_NAME}_list_options): Likewise.
(gld${EMULATION_NAME}_handle_option): Likewise.
(gld_${EMULATION_NAME}_after_open): Pass real_flags to PE private data.
* ld.texinfo: Document it.
* NEWS: Mention it.

ld/ChangeLog
ld/NEWS
ld/emultempl/pe.em
ld/ld.texinfo

index a81c5d6..20222ff 100644 (file)
@@ -1,4 +1,16 @@
 2004-05-07  Brian Ford  <ford@vss.fsi.com>
+            DJ Delorie  <dj@redhat.com>
+
+       * emultempl/pe.em (real_flags): New static.
+       (OPTION_LARGE_ADDRESS_AWARE): New define.
+       (gld${EMULATION_NAME}_add_options): Add --large-address-aware option.
+       (gld_${EMULATION_NAME}_list_options): Likewise.
+       (gld${EMULATION_NAME}_handle_option): Likewise.
+       (gld_${EMULATION_NAME}_after_open): Pass real_flags to PE private data.
+       * ld.texinfo: Document it.
+       * NEWS: Mention it.
+
+2004-05-07  Brian Ford  <ford@vss.fsi.com>
 
        * NEWS: Mention DWARF 2 support for i386pe.
 
diff --git a/ld/NEWS b/ld/NEWS
index 39db029..cec229b 100644 (file)
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,5 +1,8 @@
 -*- text -*-
 
+* New PE --large-address-aware option to indicate executables support virtual
+  addresses greater than 2 gigabytes.
+
 * DWARF 2 support for i386pe added.
 
 * The linker script operator DEFINED() will now yield 1 only for a symbol that
index 7d6c2e8..a3b50af 100644 (file)
@@ -62,6 +62,11 @@ cat >>e${EMULATION_NAME}.c <<EOF
 #include "ldctor.h"
 #include "coff/internal.h"
 
+/* FIXME: See bfd/peXXigen.c for why we include an architecture specific
+   header in generic PE code.  */
+#include "coff/i386.h"
+#include "coff/pe.h"
+
 /* FIXME: This is a BFD internal header file, and we should not be
    using it here.  */
 #include "../bfd/libcoff.h"
@@ -106,6 +111,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
 
 static struct internal_extra_pe_aouthdr pe;
 static int dll;
+static flagword real_flags = 0;
 static int support_old_code = 0;
 static char * thumb_entry_symbol = NULL;
 static lang_assignment_statement_type *image_base_statement = 0;
@@ -182,6 +188,8 @@ gld_${EMULATION_NAME}_before_parse (void)
                                        (OPTION_EXCLUDE_LIBS + 1)
 #define OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC        \
                                        (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC + 1)
+#define OPTION_LARGE_ADDRESS_AWARE \
+                                       (OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC + 1)
 
 static void
 gld${EMULATION_NAME}_add_options
@@ -235,6 +243,7 @@ gld${EMULATION_NAME}_add_options
     {"enable-runtime-pseudo-reloc", no_argument, NULL, OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC},
     {"disable-runtime-pseudo-reloc", no_argument, NULL, OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC},
 #endif
+    {"large-address-aware", no_argument, NULL, OPTION_LARGE_ADDRESS_AWARE},
     {NULL, no_argument, NULL, 0}
   };
 
@@ -335,6 +344,8 @@ gld_${EMULATION_NAME}_list_options (FILE *file)
   fprintf (file, _("  --enable-extra-pe-debug            Enable verbose debug output when building\n\
                                        or linking to DLLs (esp. auto-import)\n"));
 #endif
+  fprintf (file, _("  --large-address-aware              Executable supports virtual addresses\n\
+                                       greater than 2 gigabytes\n"));
 }
 
 
@@ -597,6 +608,9 @@ gld${EMULATION_NAME}_handle_option (int optc)
       pe_dll_extra_pe_debug = 1;
       break;
 #endif
+    case OPTION_LARGE_ADDRESS_AWARE:
+      real_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
+      break;
     }
   return TRUE;
 }
@@ -949,6 +963,7 @@ gld_${EMULATION_NAME}_after_open (void)
 
   pe_data (output_bfd)->pe_opthdr = pe;
   pe_data (output_bfd)->dll = init[DLLOFF].value;
+  pe_data (output_bfd)->real_flags |= real_flags;
 
 #ifdef DLL_SUPPORT
   if (pe_enable_stdcall_fixup) /* -1=warn or 1=disable */
index f50d79a..4127968 100644 (file)
@@ -1872,6 +1872,15 @@ If given, the stdcall suffixes (@@@var{nn}) will be stripped from
 symbols before they are exported.
 [This option is specific to the i386 PE targeted port of the linker]
 
+@kindex --large-address-aware
+@item --large-address-aware
+If given, the appropriate bit in the ``Charateristics'' field of the COFF
+header is set to indicate that this executable supports virtual addresses
+greater than 2 gigabytes.  This should be used in conjuction with the /3GB
+or /USERVA=@var{value} megabytes switch in the ``[operating systems]''
+section of the BOOT.INI.  Otherwise, this bit has no effect.
+[This option is specific to PE targeted ports of the linker]
+
 @kindex --major-image-version
 @item --major-image-version @var{value}
 Sets the major number of the ``image version''.  Defaults to 1.