Marcus Meissner : winebuild: Output a .note.GNU-stack section to allow nonexecutable stack.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Jan 21 12:29:41 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 1ed3ca0883390089531dcc6f7a2daa6a6f84d991
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=1ed3ca0883390089531dcc6f7a2daa6a6f84d991

Author: Marcus Meissner <meissner at suse.de>
Date:   Sat Jan 21 19:23:36 2006 +0100

winebuild: Output a .note.GNU-stack section to allow nonexecutable stack.

---

 tools/winebuild/build.h  |    1 +
 tools/winebuild/relay.c  |    2 ++
 tools/winebuild/spec16.c |    1 +
 tools/winebuild/spec32.c |    1 +
 tools/winebuild/utils.c  |   14 ++++++++++++++
 5 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index a445be9..c100b2c 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -176,6 +176,7 @@ extern const char *get_asm_short_keyword
 extern const char *get_asm_rodata_section(void);
 extern const char *get_asm_string_section(void);
 extern void output_function_size( FILE *outfile, const char *name );
+extern void output_gnu_stack_note( FILE *outfile );
 
 extern void add_import_dll( const char *name, const char *filename );
 extern void add_delayed_import( const char *name );
diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c
index 8d304d0..6900294 100644
--- a/tools/winebuild/relay.c
+++ b/tools/winebuild/relay.c
@@ -982,6 +982,7 @@ void BuildRelays16( FILE *outfile )
     fprintf( outfile, "%s\n\t.long 0\n", asm_globl("CallTo16_DataSelector") );
     fprintf( outfile, "%s\n\t.long 0\n", asm_globl("CallTo16_TebSelector") );
     if (UsePIC) fprintf( outfile, "wine_ldt_copy_ptr:\t.long %s\n", asm_name("wine_ldt_copy") );
+    output_gnu_stack_note( outfile );
 }
 
 /*******************************************************************
@@ -1007,4 +1008,5 @@ void BuildRelays32( FILE *outfile )
     BuildCallFrom32Regs( outfile );
 
     output_function_size( outfile, "__wine_spec_thunk_text_32" );
+    output_gnu_stack_note( outfile );
 }
diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c
index c8a1026..d3b4ef3 100644
--- a/tools/winebuild/spec16.c
+++ b/tools/winebuild/spec16.c
@@ -804,6 +804,7 @@ void BuildSpec16File( FILE *outfile, DLL
     output_stubs( outfile, spec );
     output_get_pc_thunk( outfile );
     output_init_code( outfile, spec, header_name );
+    output_gnu_stack_note( outfile );
 
     free( typelist );
 }
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 963e916..aa1ce3d 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -479,6 +479,7 @@ void BuildSpec32File( FILE *outfile, DLL
     output_imports( outfile, spec );
     output_resources( outfile, spec );
     output_asm_constructor( outfile, "__wine_spec_init_ctor" );
+    output_gnu_stack_note( outfile );
 }
 
 
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 8fb3acc..8ba3cf8 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -533,6 +533,20 @@ void output_function_size( FILE *outfile
     }
 }
 
+/* output the GNU note for non-exec stack */
+void output_gnu_stack_note( FILE *outfile )
+{
+    switch (target_platform)
+    {
+    case PLATFORM_WINDOWS:
+    case PLATFORM_APPLE:
+        break;
+    default:
+        fprintf( outfile, "\t.section .note.GNU-stack,\"\", at progbits\n" );
+        break;
+    }
+}
+
 /* return a global symbol declaration for an assembly symbol */
 const char *asm_globl( const char *func )
 {




More information about the wine-cvs mailing list