OSDN Git Service

Avoid deprecated specification of esp in asm clobber list.
authorKeith Marshall <keith@users.osdn.me>
Thu, 5 Mar 2020 10:27:46 +0000 (10:27 +0000)
committerKeith Marshall <keith@users.osdn.me>
Thu, 5 Mar 2020 10:27:46 +0000 (10:27 +0000)
mingwrt/ChangeLog
mingwrt/crt1.c

index 12dec09..204484e 100644 (file)
@@ -1,3 +1,12 @@
+2020-03-05  Keith Marshall  <keith@users.osdn.me>
+
+       Avoid deprecated specification of esp in asm clobber list.
+
+       * crt1.c (__mingw_CRTStartup): In inline assembly, forced modulo-16
+       alignment of esp is safe, but clobbered esp cannot be restored; GCC-9
+       deprecates its inclusion in clobber list; remove it.
+       [-masm=intel]: Support inline assembler syntax.
+
 2020-03-04  Keith Marshall  <keith@users.osdn.me>
 
        Disallow surrogates as printf() radix and grouping characters.
index 439f9e8..dfed41c 100644 (file)
@@ -8,7 +8,7 @@
  *
  * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
  * Copyright (C) 1997, 1999, 2002-2007, 2009, 2010, 2014, 2016,
- *   2017, MinGW.org Project.
+ *   2017, 2020, MinGW.org Project.
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -319,7 +319,6 @@ static __MINGW_ATTRIB_NORETURN  void __mingw_CRTStartup (void)
   /* Set up the top-level exception handler so that signal handling
    * works as expected. The mapping between ANSI/POSIX signals and
    * Win32 SE is not 1-to-1, so caveat emptor.
-   *
    */
   SetUnhandledExceptionFilter (_gnu_exception_handler);
 
@@ -342,10 +341,20 @@ static __MINGW_ATTRIB_NORETURN  void __mingw_CRTStartup (void)
    */
   _pei386_runtime_relocator ();
 
-  /* Align the stack to 16 bytes for the sake of SSE ops in main
+  /* Align the stack to 16 bytes for the benefit of SSE ops in main
    * or in functions inlined into main.
+   *
+   * FIXME: Do we actually need this?  Modern GCC may already align
+   * the stack appropriately; in any case, GCC-9 objects to the "%esp"
+   * specification in the "clobber-list" of this original statement:
+   *
+   *   asm  __volatile__  ("andl $-16, %%esp" : : : "%esp");
+   *
+   * and it appears to make no difference to the generated code, if
+   * the "clobber-list" is omitted entirely ... indeed, how might we
+   * expect GCC to restore the clobbered stack pointer anyway?
    */
-  asm  __volatile__  ("andl $-16, %%esp" : : : "%esp");
+  asm  __volatile__  ("and{l}\t{$-16, %%}esp{|, -16}":);
 
   /* From libgcc.a, __main() calls global class constructors via
    * __do_global_ctors(); this in turn registers __do_global_dtors()