------- Comment #7 from ktietz at gcc dot gnu dot org  2009-03-15 20:13 -------
The following patch solves this problem and prevents the name collision for 32
and 64 bits win32 systems.

ChangeLog

        * config/i386/i386.md (allocate_stack_worker_32): Use
        ___gnu_chkstk.
        (allocate_stack_worker_64): Likewise.
        * config/i386/cygwin.asm (__alloca): Renamed to __gnu_alloca.
        (___chkstk): Renamed to ___gnu_chkstk.

Index: gcc/gcc/config/i386/cygwin.asm
===================================================================
--- gcc.orig/gcc/config/i386/cygwin.asm
+++ gcc/gcc/config/i386/cygwin.asm
@@ -40,11 +40,11 @@
    increments is necessary to ensure that the guard pages used
    by the OS virtual memory manger are allocated in correct sequence.  */

-       .global ___chkstk
-       .global __alloca
 #ifndef _WIN64
-___chkstk:
-__alloca:
+       .global ___gnu_chkstk
+       .global ___gnu_alloca
+___gnu_chkstk:
+__gnu_alloca:
        pushl   %ecx            /* save temp */
        leal    8(%esp), %ecx   /* point past return addr */
        cmpl    $0x1000, %eax   /* > 4k ?*/
@@ -72,9 +72,11 @@ Ldone:
        pushl   %eax
        ret
 #else
+       .global ___gnu_chkstk
+       .global __gnu_alloca
 /* __alloca is a normal function call, which uses %rcx as the argument.  And
stack space
    for the argument is saved.  */
-__alloca:
+__gnu_alloca:
        movq    %rcx, %rax
        addq    $0x7, %rax
        andq    $0xfffffffffffffff8, %rax
@@ -107,7 +109,7 @@ Ldone_alloca:
 /* ___chkstk is a *special* function call, which uses %rax as the argument.
    We avoid clobbering the 4 integer argument registers, %rcx, %rdx,
    %r8 and %r9, which leaves us with %rax, %r10, and %r11 to use.  */
-___chkstk:
+___gnu_chkstk:
        addq    $0x7, %rax      /* Make sure stack is on alignment of 8.  */
        andq    $0xfffffffffffffff8, %rax
        popq    %r11            /* pop return address */
Index: gcc/gcc/config/i386/i386.md
===================================================================
--- gcc.orig/gcc/config/i386/i386.md
+++ gcc/gcc/config/i386/i386.md
@@ -20297,7 +20297,7 @@
    (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (match_dup 1)))
    (clobber (reg:CC FLAGS_REG))]
   "!TARGET_64BIT && TARGET_STACK_PROBE"
-  "call\t___chkstk"
+  "call\t___gnu_chkstk"
   [(set_attr "type" "multi")
    (set_attr "length" "5")])

@@ -20310,7 +20310,7 @@
    (clobber (reg:DI R11_REG))
    (clobber (reg:CC FLAGS_REG))]
   "TARGET_64BIT && TARGET_STACK_PROBE"
-  "call\t___chkstk"
+  "call\t___gnu_chkstk"
   [(set_attr "type" "multi")
    (set_attr "length" "5")])


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39356

Reply via email to