Alexandre Julliard : winebuild: Added --nxcompat option, and mark all modules as NX-compatible by default.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Dec 7 14:23:41 CST 2006


Module: wine
Branch: master
Commit: 662897e9d675941a089f9e6515006bdecb092ffb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=662897e9d675941a089f9e6515006bdecb092ffb

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Dec  7 20:51:49 2006 +0100

winebuild: Added --nxcompat option, and mark all modules as NX-compatible by default.

---

 tools/winebuild/build.h          |    1 +
 tools/winebuild/main.c           |    7 +++++++
 tools/winebuild/spec32.c         |    4 ++--
 tools/winebuild/utils.c          |    3 +++
 tools/winebuild/winebuild.man.in |    4 ++++
 5 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 2749c4c..5668271 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -99,6 +99,7 @@ typedef struct
     int              nb_names;           /* number of entry points with names */
     unsigned int     nb_resources;       /* number of resources */
     int              characteristics;    /* characteristics for the PE header */
+    int              dll_characteristics;/* DLL characteristics for the PE header */
     int              subsystem;          /* subsystem id */
     int              subsystem_major;    /* subsystem version major number */
     int              subsystem_minor;    /* subsystem version minor number */
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index b5f0054..5005fe1 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -260,6 +260,7 @@ static const char usage_str[] =
 "   -L, --library-path=DIR   Look for imports libraries in DIR\n"
 "   -M, --main-module=MODULE Set the name of the main module for a Win16 dll\n"
 "       --nm-cmd=NM          Command to use to get undefined symbols (default: nm)\n"
+"       --nxcompat=y|n       Set the NX compatibility flag (default: yes)\n"
 "   -N, --dll-name=DLLNAME   Set the DLL name (default: from input file name)\n"
 "   -o, --output=NAME        Set the output file name (default: stdout)\n"
 "   -r, --res=RSRC.RES       Load resources from RSRC.RES\n"
@@ -287,6 +288,7 @@ enum long_options_values
     LONG_OPT_EXTERNAL_SYMS,
     LONG_OPT_LDCMD,
     LONG_OPT_NMCMD,
+    LONG_OPT_NXCOMPAT,
     LONG_OPT_RELAY16,
     LONG_OPT_RELAY32,
     LONG_OPT_SAVE_TEMPS,
@@ -306,6 +308,7 @@ static const struct option long_options[
     { "external-symbols", 0, 0, LONG_OPT_EXTERNAL_SYMS },
     { "ld-cmd",        1, 0, LONG_OPT_LDCMD },
     { "nm-cmd",        1, 0, LONG_OPT_NMCMD },
+    { "nxcompat",      1, 0, LONG_OPT_NXCOMPAT },
     { "relay16",       0, 0, LONG_OPT_RELAY16 },
     { "relay32",       0, 0, LONG_OPT_RELAY32 },
     { "save-temps",    0, 0, LONG_OPT_SAVE_TEMPS },
@@ -476,6 +479,10 @@ static char **parse_options( int argc, c
         case LONG_OPT_NMCMD:
             nm_command = xstrdup( optarg );
             break;
+        case LONG_OPT_NXCOMPAT:
+            if (optarg[0] == 'n' || optarg[0] == 'N')
+                spec->dll_characteristics &= ~IMAGE_DLLCHARACTERISTICS_NX_COMPAT;
+            break;
         case LONG_OPT_RELAY16:
             set_exec_mode( MODE_RELAY16 );
             break;
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 9e74e85..6fcc42e 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -426,8 +426,8 @@ void BuildSpec32File( DLLSPEC *spec )
     output( "\t.long 0\n" );              /* CheckSum */
     output( "\t%s 0x%04x\n",              /* Subsystem */
              get_asm_short_keyword(), spec->subsystem );
-    output( "\t%s 0\n",                   /* DllCharacteristics */
-             get_asm_short_keyword() );
+    output( "\t%s 0x%04x\n",              /* DllCharacteristics */
+            get_asm_short_keyword(), spec->dll_characteristics );
     output( "\t%s %u,%u\n",               /* SizeOfStackReserve/Commit */
              get_asm_ptr_keyword(), (spec->stack_size ? spec->stack_size : 1024) * 1024, page_size );
     output( "\t%s %u,%u\n",               /* SizeOfHeapReserve/Commit */
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index f86f198..3458eb7 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -31,6 +31,8 @@
 # include <unistd.h>
 #endif
 
+#include "windef.h"
+#include "winnt.h"
 #include "build.h"
 
 #define MAX_TMP_FILES 8
@@ -332,6 +334,7 @@ DLLSPEC *alloc_dll_spec(void)
     spec->nb_names           = 0;
     spec->nb_resources       = 0;
     spec->characteristics    = 0;
+    spec->dll_characteristics = IMAGE_DLLCHARACTERISTICS_NX_COMPAT;
     spec->subsystem          = 0;
     spec->subsystem_major    = 4;
     spec->subsystem_minor    = 0;
diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in
index 3b6d0c7..87f47f8 100644
--- a/tools/winebuild/winebuild.man.in
+++ b/tools/winebuild/winebuild.man.in
@@ -153,6 +153,10 @@ KRNL386.EXE. It shouldn't be needed othe
 Specify the command to use to get the list of undefined symbols; the
 default is \fBnm\fR.
 .TP
+.BI --nxcompat= yes|no
+Specify whether the module is compatible with no-exec support. The
+default is yes.
+.TP
 .BI \-o,\ --output= file
 Set the name of the output file (default is standard output). If the
 output file name end in \fB.o\fR, the text output is sent to a




More information about the wine-cvs mailing list