[PATCH] asm: Separate .def/.scl/.type/.endef with newlines instead of semicolons

Martin Storsjo martin at martin.st
Fri Dec 18 16:34:34 CST 2020


When targeting arm64 in MSVC mode, LLVM treats semicolons in assembly
as comment char, instead of as statement separator (contrary to in
mingw mode, where semicolons still work as separator). In generated code,
there's no need to keep these directives on one single line though, so
just separate them with newlines.

Signed-off-by: Martin Storsjo <martin at martin.st>

---

(There's no reference for how msvc should interpret gas-style assembly,
so one could also think LLVM should change and treat semicolons as
statement separator there, like for other architectures. But when I
suggested fixing that a couple years ago, it was suggested to only
change it for GNU style targets, see [1]. I guess the matter could
be brought up again though.)

[1] https://reviews.llvm.org/D36366#833185
---
 include/wine/asm.h      | 2 +-
 tools/winebuild/utils.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/wine/asm.h b/include/wine/asm.h
index b5e6c6efd3d..ed44a7dd6dd 100644
--- a/include/wine/asm.h
+++ b/include/wine/asm.h
@@ -56,7 +56,7 @@
 #endif
 
 #ifdef _WIN32
-# define __ASM_FUNC_TYPE(name) ".def " name "; .scl 2; .type 32; .endef"
+# define __ASM_FUNC_TYPE(name) ".def " name "\n\t.scl 2\n\t.type 32\n\t.endef"
 #elif defined(__APPLE__)
 # define __ASM_FUNC_TYPE(name) ""
 #elif defined(__arm__) || defined(__arm64__)
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 1af42f10005..5cffc74accd 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -686,7 +686,7 @@ void output_standard_file_header(void)
     output( "/* This file can be copied, modified and distributed without restriction. */\n\n" );
     if (safe_seh)
     {
-        output( "\t.def    @feat.00; .scl 3; .type 0; .endef\n" );
+        output( "\t.def    @feat.00\n\t.scl 3\n\t.type 0\n\t.endef\n" );
         output( "\t.globl  @feat.00\n" );
         output( ".set @feat.00, 1\n" );
     }
@@ -1119,7 +1119,7 @@ const char *func_declaration( const char *func )
         return "";
     case PLATFORM_WINDOWS:
         free( buffer );
-        buffer = strmake( ".def %s; .scl 2; .type 32; .endef", asm_name(func) );
+        buffer = strmake( ".def %s\n\t.scl 2\n\t.type 32\n\t.endef", asm_name(func) );
         break;
     default:
         free( buffer );
-- 
2.17.1




More information about the wine-devel mailing list