Commits

Iain Buclaw  committed 3ea4964

Issue #226 - GC from spawned threads segfaults on 64-bit

  • Participants
  • Parent commits 748ce28

Comments (0)

Files changed (2)

         VersionCondition::addPredefinedGlobalIdent("GNU_LongDouble128");
 #endif
 
+#ifdef STACK_GROWS_DOWNWARD
+    VersionCondition::addPredefinedGlobalIdent("GNU_StackGrowsDown");
+#endif
+
     if (d_have_inline_asm() && gen.useInlineAsm)
     {
         VersionCondition::addPredefinedGlobalIdent("D_InlineAsm");
         gen.emitTemplates = (supports_one_only()) ? TEall : TEprivate;
     }
     global.params.symdebug = write_symbols != NO_DEBUG;
-    //global.params.useInline = flag_inline_functions;
+    global.params.useInline = flag_inline_functions;
     global.params.obj = ! flag_syntax_only;
     global.params.pic = flag_pic != 0; // Has no effect yet.
     gen.originalOmitFramePointer = flag_omit_frame_pointer;

File d/druntime/core/thread.d

 
 
 // this should be true for most architectures
-version = StackGrowsDown;
+version( GNU_StackGrowsDown )
+    version = StackGrowsDown;
 
 
 ///////////////////////////////////////////////////////////////////////////////
             assert( obj.m_curr is &obj.m_main );
             // NOTE: For some reason this does not always work for threads.
             //obj.m_main.bstack = getStackBottom();
-            version( D_InlineAsm_X86 )
+            version( GNU )
+            {
+                version( StackGrowsDown )
+                    obj.m_main.bstack = &obj + 1;
+                else
+                    obj.m_main.bstack = &obj;
+            }
+            else version( D_InlineAsm_X86 )
             {
                 static void* getBasePtr()
                 {