[6/9] winebuild: Remove get_asm_short_keyword

André Hentschel nerv at dawncrow.de
Fri Mar 8 14:37:05 CST 2013


It was said, this should be done with the next great winebuild change, i thought Sparc removal would be enough, missed to do it for ARM64 inclusion
---
 tools/winebuild/build.h  |   1 -
 tools/winebuild/import.c |   2 +-
 tools/winebuild/res16.c  |  12 ++---
 tools/winebuild/res32.c  |   9 ++--
 tools/winebuild/spec16.c | 130 +++++++++++++++++++++--------------------------
 tools/winebuild/spec32.c |  40 +++++++--------
 tools/winebuild/utils.c  |   8 ---
 7 files changed, 85 insertions(+), 117 deletions(-)

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index fd56c8c..08b0004 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -272,7 +272,6 @@ extern const char *func_declaration( const char *func );
 extern const char *asm_globl( const char *func );
 extern const char *get_asm_ptr_keyword(void);
 extern const char *get_asm_string_keyword(void);
-extern const char *get_asm_short_keyword(void);
 extern const char *get_asm_rodata_section(void);
 extern const char *get_asm_string_section(void);
 extern void output_function_size( const char *name );
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index fab4158..3756c75 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -771,7 +771,7 @@ static void output_immediate_imports(void)
             {
                 output( "\t.align %d\n", get_alignment(2) );
                 output( ".L__wine_spec_import_data_%s_%s:\n", dll_name, odp->name );
-                output( "\t%s %d\n", get_asm_short_keyword(), odp->ordinal );
+                output( "\t.short %d\n", odp->ordinal );
                 output( "\t%s \"%s\"\n", get_asm_string_keyword(), odp->name );
             }
         }
diff --git a/tools/winebuild/res16.c b/tools/winebuild/res16.c
index 4a6dddd..216d253 100644
--- a/tools/winebuild/res16.c
+++ b/tools/winebuild/res16.c
@@ -246,22 +246,22 @@ void output_res16_directory( DLLSPEC *spec )
     tree = build_resource_tree( spec );
 
     output( "\n.L__wine_spec_ne_rsrctab:\n" );
-    output( "\t%s 0\n", get_asm_short_keyword() );  /* alignment */
+    output( "\t.short 0\n" );  /* alignment */
 
     /* type and name structures */
 
     for (i = 0, type = tree->types; i < tree->nb_types; i++, type++)
     {
-        output( "\t%s 0x%04x,%u,0,0\n", get_asm_short_keyword(), type->name_offset, type->nb_names );
+        output( "\t.short 0x%04x,%u,0,0\n", type->name_offset, type->nb_names );
 
         for (j = 0, res = type->res; j < type->nb_names; j++, res++)
         {
-            output( "\t%s .L__wine_spec_resource_%lu-.L__wine_spec_dos_header,%u\n",
-                    get_asm_short_keyword(), (unsigned long)(res - spec->resources), res->data_size );
-            output( "\t%s 0x%04x,0x%04x,0,0\n", get_asm_short_keyword(), res->memopt, res->name_offset );
+            output( "\t.short .L__wine_spec_resource_%lu-.L__wine_spec_dos_header,%u\n",
+                    (unsigned long)(res - spec->resources), res->data_size );
+            output( "\t.short 0x%04x,0x%04x,0,0\n", res->memopt, res->name_offset );
         }
     }
-    output( "\t%s 0\n", get_asm_short_keyword() );  /* terminator */
+    output( "\t.short 0\n" );  /* terminator */
 
     /* name strings */
 
diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c
index 729aa2f..bd3f6fa 100644
--- a/tools/winebuild/res32.c
+++ b/tools/winebuild/res32.c
@@ -407,7 +407,7 @@ static void free_resource_tree( struct res_tree *tree )
 static void output_string( const WCHAR *name )
 {
     int i, len = strlenW(name);
-    output( "\t%s 0x%04x", get_asm_short_keyword(), len );
+    output( "\t.short 0x%04x", len );
     for (i = 0; i < len; i++) output( ",0x%04x", name[i] );
     output( " /* " );
     for (i = 0; i < len; i++) output( "%c", isprint((char)name[i]) ? (char)name[i] : '?' );
@@ -419,10 +419,9 @@ static inline void output_res_dir( unsigned int nb_names, unsigned int nb_ids )
 {
     output( "\t.long 0\n" );  /* Characteristics */
     output( "\t.long 0\n" );  /* TimeDateStamp */
-    output( "\t%s 0,0\n",     /* Major/MinorVersion */
-             get_asm_short_keyword() );
-    output( "\t%s %u,%u\n",   /* NumberOfNamed/IdEntries */
-             get_asm_short_keyword(), nb_names, nb_ids );
+    output( "\t.short 0,0\n" );   /* Major/MinorVersion */
+    output( "\t.short %u,%u\n",   /* NumberOfNamed/IdEntries */
+             nb_names, nb_ids );
 }
 
 /* output the resource definitions */
diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c
index 481ed13..726dc31 100644
--- a/tools/winebuild/spec16.c
+++ b/tools/winebuild/spec16.c
@@ -110,18 +110,16 @@ static void output_entries( DLLSPEC *spec, int first, int count )
         case TYPE_PASCAL:
         case TYPE_VARARGS:
         case TYPE_STUB:
-            output( "\t%s .L__wine_%s_%u-.L__wine_spec_code_segment\n",
-                     get_asm_short_keyword(),
+            output( "\t.short .L__wine_%s_%u-.L__wine_spec_code_segment\n",
                      make_c_identifier(spec->dll_name), first + i );
             break;
         case TYPE_VARIABLE:
-            output( "\t%s .L__wine_%s_%u-.L__wine_spec_data_segment\n",
-                     get_asm_short_keyword(),
+            output( "\t.short .L__wine_%s_%u-.L__wine_spec_data_segment\n",
                      make_c_identifier(spec->dll_name), first + i );
             break;
         case TYPE_ABS:
-            output( "\t%s 0x%04x  /* %s */\n",
-                     get_asm_short_keyword(), odp->u.abs.value, odp->name );
+            output( "\t.short 0x%04x  /* %s */\n",
+                     odp->u.abs.value, odp->name );
             break;
         default:
             assert(0);
@@ -213,7 +211,7 @@ static void output_resident_name( const char *string, int ordinal )
     output( "\t.byte 0x%02x", len );
     for (i = 0; i < len; i++) output( ",0x%02x", (unsigned char)toupper(string[i]) );
     output( " /* %s */\n", string );
-    output( "\t%s %u\n", get_asm_short_keyword(), ordinal );
+    output( "\t.short %u\n", ordinal );
 }
 
 
@@ -570,68 +568,60 @@ static void output_module16( DLLSPEC *spec )
     output( "\t.data\n" );
     output( "\t.align %d\n", get_alignment(4) );
     output( ".L__wine_spec_dos_header:\n" );
-    output( "\t%s 0x5a4d\n", get_asm_short_keyword() );                    /* e_magic */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_cblp */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_cp */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_crlc */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_cparhdr */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_minalloc */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_maxalloc */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_ss */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_sp */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_csum */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_ip */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_cs */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_lfarlc */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_ovno */
-    output( "\t%s 0,0,0,0\n", get_asm_short_keyword() );                   /* e_res */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_oemid */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* e_oeminfo */
-    output( "\t%s 0,0,0,0,0,0,0,0,0,0\n", get_asm_short_keyword() );       /* e_res2 */
+    output( "\t.short 0x5a4d\n" );                                         /* e_magic */
+    output( "\t.short 0\n" );                                              /* e_cblp */
+    output( "\t.short 0\n" );                                              /* e_cp */
+    output( "\t.short 0\n" );                                              /* e_crlc */
+    output( "\t.short 0\n" );                                              /* e_cparhdr */
+    output( "\t.short 0\n" );                                              /* e_minalloc */
+    output( "\t.short 0\n" );                                              /* e_maxalloc */
+    output( "\t.short 0\n" );                                              /* e_ss */
+    output( "\t.short 0\n" );                                              /* e_sp */
+    output( "\t.short 0\n" );                                              /* e_csum */
+    output( "\t.short 0\n" );                                              /* e_ip */
+    output( "\t.short 0\n" );                                              /* e_cs */
+    output( "\t.short 0\n" );                                              /* e_lfarlc */
+    output( "\t.short 0\n" );                                              /* e_ovno */
+    output( "\t.short 0,0,0,0\n" );                                        /* e_res */
+    output( "\t.short 0\n" );                                              /* e_oemid */
+    output( "\t.short 0\n" );                                              /* e_oeminfo */
+    output( "\t.short 0,0,0,0,0,0,0,0,0,0\n" );                            /* e_res2 */
     output( "\t.long .L__wine_spec_ne_header-.L__wine_spec_dos_header\n" );/* e_lfanew */
 
     output( ".L__wine_spec_ne_header:\n" );
-    output( "\t%s 0x454e\n", get_asm_short_keyword() );                    /* ne_magic */
+    output( "\t.short 0x454e\n" );                                         /* ne_magic */
     output( "\t.byte 0\n" );                                               /* ne_ver */
     output( "\t.byte 0\n" );                                               /* ne_rev */
-    output( "\t%s .L__wine_spec_ne_enttab-.L__wine_spec_ne_header\n",      /* ne_enttab */
-             get_asm_short_keyword() );
-    output( "\t%s .L__wine_spec_ne_enttab_end-.L__wine_spec_ne_enttab\n",  /* ne_cbenttab */
-             get_asm_short_keyword() );
+    output( "\t.short .L__wine_spec_ne_enttab-.L__wine_spec_ne_header\n" );/* ne_enttab */
+    output( "\t.short .L__wine_spec_ne_enttab_end-.L__wine_spec_ne_enttab\n" );/* ne_cbenttab */
     output( "\t.long 0\n" );                                               /* ne_crc */
-    output( "\t%s 0x%04x\n", get_asm_short_keyword(),                      /* ne_flags */
-             NE_FFLAGS_SINGLEDATA |
+    output( "\t.short 0x%04x\n", NE_FFLAGS_SINGLEDATA |                    /* ne_flags */
              ((spec->characteristics & IMAGE_FILE_DLL) ? NE_FFLAGS_LIBMODULE : 0) );
-    output( "\t%s 2\n", get_asm_short_keyword() );                         /* ne_autodata */
-    output( "\t%s %u\n", get_asm_short_keyword(), spec->heap_size );       /* ne_heap */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* ne_stack */
+    output( "\t.short 2\n" );                                              /* ne_autodata */
+    output( "\t.short %u\n", spec->heap_size );                            /* ne_heap */
+    output( "\t.short 0\n" );                                              /* ne_stack */
     if (!entry_point) output( "\t.long 0\n" );                             /* ne_csip */
-    else output( "\t%s .L__wine_%s_0-.L__wine_spec_code_segment,1\n",
-                 get_asm_short_keyword(), make_c_identifier(spec->dll_name) );
-    output( "\t%s 0,2\n", get_asm_short_keyword() );                       /* ne_sssp */
-    output( "\t%s 2\n", get_asm_short_keyword() );                         /* ne_cseg */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* ne_cmod */
-    output( "\t%s 0\n", get_asm_short_keyword() );                         /* ne_cbnrestab */
-    output( "\t%s .L__wine_spec_ne_segtab-.L__wine_spec_ne_header\n",      /* ne_segtab */
-             get_asm_short_keyword() );
-    output( "\t%s .L__wine_spec_ne_rsrctab-.L__wine_spec_ne_header\n",     /* ne_rsrctab */
-             get_asm_short_keyword() );
-    output( "\t%s .L__wine_spec_ne_restab-.L__wine_spec_ne_header\n",      /* ne_restab */
-             get_asm_short_keyword() );
-    output( "\t%s .L__wine_spec_ne_modtab-.L__wine_spec_ne_header\n",      /* ne_modtab */
-             get_asm_short_keyword() );
-    output( "\t%s .L__wine_spec_ne_imptab-.L__wine_spec_ne_header\n",      /* ne_imptab */
-             get_asm_short_keyword() );
+    else output( "\t.short .L__wine_%s_0-.L__wine_spec_code_segment,1\n",
+                 make_c_identifier(spec->dll_name) );
+    output( "\t.short 0,2\n" );                                            /* ne_sssp */
+    output( "\t.short 2\n" );                                              /* ne_cseg */
+    output( "\t.short 0\n" );                                              /* ne_cmod */
+    output( "\t.short 0\n" );                                              /* ne_cbnrestab */
+    output( "\t.short .L__wine_spec_ne_segtab-.L__wine_spec_ne_header\n" );/* ne_segtab */
+    output( "\t.short .L__wine_spec_ne_rsrctab-.L__wine_spec_ne_header\n" );   /* ne_rsrctab */
+    output( "\t.short .L__wine_spec_ne_restab-.L__wine_spec_ne_header\n" );    /* ne_restab */
+    output( "\t.short .L__wine_spec_ne_modtab-.L__wine_spec_ne_header\n" );    /* ne_modtab */
+    output( "\t.short .L__wine_spec_ne_imptab-.L__wine_spec_ne_header\n" );    /* ne_imptab */
     output( "\t.long 0\n" );                                   /* ne_nrestab */
-    output( "\t%s 0\n", get_asm_short_keyword() );             /* ne_cmovent */
-    output( "\t%s 0\n", get_asm_short_keyword() );             /* ne_align */
-    output( "\t%s 0\n", get_asm_short_keyword() );             /* ne_cres */
+    output( "\t.short 0\n" );                                  /* ne_cmovent */
+    output( "\t.short 0\n" );                                  /* ne_align */
+    output( "\t.short 0\n" );                                  /* ne_cres */
     output( "\t.byte 0x02\n" );                                /* ne_exetyp = NE_OSFLAGS_WINDOWS */
     output( "\t.byte 0x08\n" );                                /* ne_flagsothers = NE_AFLAGS_FASTLOAD */
-    output( "\t%s 0\n", get_asm_short_keyword() );             /* ne_pretthunks */
-    output( "\t%s 0\n", get_asm_short_keyword() );             /* ne_psegrefbytes */
-    output( "\t%s 0\n", get_asm_short_keyword() );             /* ne_swaparea */
-    output( "\t%s 0\n", get_asm_short_keyword() );             /* ne_expver */
+    output( "\t.short 0\n" );                                  /* ne_pretthunks */
+    output( "\t.short 0\n" );                                  /* ne_psegrefbytes */
+    output( "\t.short 0\n" );                                  /* ne_swaparea */
+    output( "\t.short 0\n" );                                  /* ne_expver */
 
     /* segment table */
 
@@ -639,23 +629,17 @@ static void output_module16( DLLSPEC *spec )
 
     /* code segment entry */
 
-    output( "\t%s .L__wine_spec_code_segment-.L__wine_spec_dos_header\n",  /* filepos */
-             get_asm_short_keyword() );
-    output( "\t%s .L__wine_spec_code_segment_end-.L__wine_spec_code_segment\n", /* size */
-             get_asm_short_keyword() );
-    output( "\t%s 0x2000\n", get_asm_short_keyword() ); /* flags = NE_SEGFLAGS_32BIT */
-    output( "\t%s .L__wine_spec_code_segment_end-.L__wine_spec_code_segment\n", /* minsize */
-             get_asm_short_keyword() );
+    output( "\t.short .L__wine_spec_code_segment-.L__wine_spec_dos_header\n" );         /* filepos */
+    output( "\t.short .L__wine_spec_code_segment_end-.L__wine_spec_code_segment\n" );   /* size */
+    output( "\t.short 0x2000\n" );                                                      /* flags = NE_SEGFLAGS_32BIT */
+    output( "\t.short .L__wine_spec_code_segment_end-.L__wine_spec_code_segment\n" );   /* minsize */
 
     /* data segment entry */
 
-    output( "\t%s .L__wine_spec_data_segment-.L__wine_spec_dos_header\n",  /* filepos */
-             get_asm_short_keyword() );
-    output( "\t%s .L__wine_spec_data_segment_end-.L__wine_spec_data_segment\n", /* size */
-             get_asm_short_keyword() );
-    output( "\t%s 0x0001\n", get_asm_short_keyword() ); /* flags = NE_SEGFLAGS_DATA */
-    output( "\t%s .L__wine_spec_data_segment_end-.L__wine_spec_data_segment\n", /* minsize */
-             get_asm_short_keyword() );
+    output( "\t.short .L__wine_spec_data_segment-.L__wine_spec_dos_header\n" );         /* filepos */
+    output( "\t.short .L__wine_spec_data_segment_end-.L__wine_spec_data_segment\n" );   /* size */
+    output( "\t.short 0x0001\n" );                                                      /* flags = NE_SEGFLAGS_DATA */
+    output( "\t.short .L__wine_spec_data_segment_end-.L__wine_spec_data_segment\n" );   /* minsize */
 
     /* resource directory */
 
@@ -762,7 +746,7 @@ static void output_module16( DLLSPEC *spec )
 
         /* the movl is here so that the code contains only valid instructions, */
         /* it's never actually executed, we only care about the arg_types[] values */
-        output( "\t%s 0x86c7\n", get_asm_short_keyword() );
+        output( "\t.short 0x86c7\n" );
         output( "\t.long 0x%08x,0x%08x\n", arg_types[0], arg_types[1] );
     }
 
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index ab69797..ae739d8 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -363,12 +363,11 @@ void output_exports( DLLSPEC *spec )
         output( "\n.L__wine_spec_exp_ordinals:\n" );
         for (i = 0; i < spec->nb_names; i++)
         {
-            output( "\t%s %d\n",
-                     get_asm_short_keyword(), spec->names[i]->ordinal - spec->base );
+            output( "\t.short %d\n", spec->names[i]->ordinal - spec->base );
         }
         if (spec->nb_names % 2)
         {
-            output( "\t%s 0\n", get_asm_short_keyword() );
+            output( "\t.short 0\n" );
         }
     }
 
@@ -517,20 +516,17 @@ void output_module( DLLSPEC *spec )
     case CPU_ARM:     machine = IMAGE_FILE_MACHINE_ARMNT; break;
     case CPU_ARM64:   machine = IMAGE_FILE_MACHINE_ARM64; break;
     }
-    output( "\t%s 0x%04x\n",              /* Machine */
-             get_asm_short_keyword(), machine );
-    output( "\t%s 0\n",                   /* NumberOfSections */
-             get_asm_short_keyword() );
+    output( "\t.short 0x%04x\n",          /* Machine */
+             machine );
+    output( "\t.short 0\n" );             /* NumberOfSections */
     output( "\t.long 0\n" );              /* TimeDateStamp */
     output( "\t.long 0\n" );              /* PointerToSymbolTable */
     output( "\t.long 0\n" );              /* NumberOfSymbols */
-    output( "\t%s %d\n",                  /* SizeOfOptionalHeader */
-             get_asm_short_keyword(),
+    output( "\t.short %d\n",              /* SizeOfOptionalHeader */
              get_ptr_size() == 8 ? IMAGE_SIZEOF_NT_OPTIONAL64_HEADER : IMAGE_SIZEOF_NT_OPTIONAL32_HEADER );
-    output( "\t%s 0x%04x\n",              /* Characteristics */
-             get_asm_short_keyword(), spec->characteristics );
-    output( "\t%s 0x%04x\n",              /* Magic */
-             get_asm_short_keyword(),
+    output( "\t.short 0x%04x\n",          /* Characteristics */
+             spec->characteristics );
+    output( "\t.short 0x%04x\n",          /* Magic */
              get_ptr_size() == 8 ? IMAGE_NT_OPTIONAL_HDR64_MAGIC : IMAGE_NT_OPTIONAL_HDR32_MAGIC );
     output( "\t.byte 0\n" );              /* MajorLinkerVersion */
     output( "\t.byte 0\n" );              /* MinorLinkerVersion */
@@ -549,21 +545,19 @@ void output_module( DLLSPEC *spec )
              get_asm_ptr_keyword() );
     output( "\t.long %u\n", page_size );  /* SectionAlignment */
     output( "\t.long %u\n", page_size );  /* FileAlignment */
-    output( "\t%s 1,0\n",                 /* Major/MinorOperatingSystemVersion */
-             get_asm_short_keyword() );
-    output( "\t%s 0,0\n",                 /* Major/MinorImageVersion */
-             get_asm_short_keyword() );
-    output( "\t%s %u,%u\n",               /* Major/MinorSubsystemVersion */
-             get_asm_short_keyword(), spec->subsystem_major, spec->subsystem_minor );
+    output( "\t.short 1,0\n" );           /* Major/MinorOperatingSystemVersion */
+    output( "\t.short 0,0\n" );           /* Major/MinorImageVersion */
+    output( "\t.short %u,%u\n",           /* Major/MinorSubsystemVersion */
+             spec->subsystem_major, spec->subsystem_minor );
     output( "\t.long 0\n" );                          /* Win32VersionValue */
     output( "\t.long %s-.L__wine_spec_rva_base\n",    /* SizeOfImage */
              asm_name("_end") );
     output( "\t.long %u\n", page_size );  /* SizeOfHeaders */
     output( "\t.long 0\n" );              /* CheckSum */
-    output( "\t%s 0x%04x\n",              /* Subsystem */
-             get_asm_short_keyword(), spec->subsystem );
-    output( "\t%s 0x%04x\n",              /* DllCharacteristics */
-            get_asm_short_keyword(), spec->dll_characteristics );
+    output( "\t.short 0x%04x\n",          /* Subsystem */
+             spec->subsystem );
+    output( "\t.short 0x%04x\n",          /* DllCharacteristics */
+            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 44bd92d..40a9afe 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -1109,14 +1109,6 @@ const char *get_asm_string_keyword(void)
     }
 }
 
-const char *get_asm_short_keyword(void)
-{
-    switch (target_platform)
-    {
-    default:            return ".short";
-    }
-}
-
 const char *get_asm_rodata_section(void)
 {
     switch (target_platform)
-- 
1.8.0



-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list