Clang got support for the .rva assembler directive soon before
the clang 7.0 release branch was made.

This breaks use of mingw-w64 with older SVN snapshot versions of
clang 7, if building with SEH enabled. However, most such users
probably build with DWARF exception handling instead of SEH, since
clang-bootstrapped environments have been missing other bits for
SEH until recently.

Signed-off-by: Martin Storsjö <mar...@martin.st>
---
Deduplicated the ifdef.
---
 mingw-w64-crt/crt/crtexe.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c
index 91f3b5a..5f72f16 100644
--- a/mingw-w64-crt/crt/crtexe.c
+++ b/mingw-w64-crt/crt/crtexe.c
@@ -21,6 +21,10 @@
 #include <sect_attribs.h>
 #include <locale.h>
 
+#if defined(__SEH__) && (!defined(__clang__) || __clang_major__ >= 7)
+#define SEH_INLINE_ASM
+#endif
+
 #ifndef __winitenv
 extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
 #define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv))
@@ -171,7 +175,7 @@ int WinMainCRTStartup (void);
 int WinMainCRTStartup (void)
 {
   int ret = 255;
-#if defined(__SEH__) && !defined(__clang__)
+#ifdef SEH_INLINE_ASM
   asm ("\t.l_startw:\n"
     "\t.seh_handler __C_specific_handler, @except\n"
     "\t.seh_handlerdata\n"
@@ -183,7 +187,7 @@ int WinMainCRTStartup (void)
   mingw_app_type = 1;
   __security_init_cookie ();
   ret = __tmainCRTStartup ();
-#if defined(__SEH__) && !defined(__clang__)
+#ifdef SEH_INLINE_ASM
   asm ("\tnop\n"
     "\t.l_endw: nop\n");
 #endif
@@ -199,7 +203,7 @@ int __mingw_init_ehandler (void);
 int mainCRTStartup (void)
 {
   int ret = 255;
-#if defined(__SEH__) && !defined(__clang__)
+#ifdef SEH_INLINE_ASM
   asm ("\t.l_start:\n"
     "\t.seh_handler __C_specific_handler, @except\n"
     "\t.seh_handlerdata\n"
@@ -211,7 +215,7 @@ int mainCRTStartup (void)
   mingw_app_type = 0;
   __security_init_cookie ();
   ret = __tmainCRTStartup ();
-#if defined(__SEH__) && !defined(__clang__)
+#ifdef SEH_INLINE_ASM
   asm ("\tnop\n"
     "\t.l_end: nop\n");
 #endif
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to