This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs-1.1.2 miscompiles Linux (only) with glibc-2.1.1?!


I have now verified and am able to reproduce a pretty weird problem:

Unmodified egcs-1.1.2 when bootstrapped on i586-pc-linux against
glibc-2.1.1 miscompiles the ncr53c8xx driver in Linux-2.0.37, or at
least it compiles it in such a way that it doesn't work (kernel hangs
on boot when detecting SCSI devices).

Unmodified egcs-1.1.2 when bootstrapped on i586-pc-linux against
glibc-2.0.6 seems to compile Linux-2.0.37 just fine, at least
ncr53c8xx works.

Both of these compilers are _run_ with the same glibc-2.1.1 libc.so,
which suggests that the different include files (eg. 2.1.1 has inline
string functions) may be the cause for the differing behaviour.  Since
the Linux kernel uses nothing from libc, it may be that egcs-1.1.2 is
miscompiled when using the glibc-2.1.1 headers.

This is on a single system (with the same kernel configuration, of
course), I only need to change a couple of symlinks to flip between
glibc-2.0.6 and glibc-2.1.1.

What can I do now to track this down ?

Appended is the only noticable difference between the assembler
generated for ncr53c8xx.c from both of these egcs-1.1.2 compilers.
(/usr/src/linux-egcs-1.1.2/drivers/scsi/ncr53c8xx.s is the
`correct'/working version).

Regards,
Wolfram.

--- /usr/src/linux-egcs-1.1.2/drivers/scsi/ncr53c8xx.s  Tue Jun 22 23:57:44 1999
+++ ncr53c8xx.s Sun Jun 27 23:35:49 1999
@@ -4107,71 +4107,86 @@
        .align 4
        .type    ncr_wakeup_done,@function
 ncr_wakeup_done:
-       subl $4,%esp
+       subl $12,%esp
        pushl %ebp
        pushl %edi
        pushl %esi
        pushl %ebx
-       movl 24(%esp),%edi
-       leal 2464(%edi),%ebp
-       movl 2560(%edi),%ecx
-       movl %ecx,16(%esp)
+       movl 32(%esp),%ebx
+       movl 32(%esp),%edi
+       addl $2464,%edi
+       movl 2560(%ebx),%ebx
+       movl %ebx,16(%esp)
+       movl %edi,24(%esp)
        .p2align 2
 .L1411:
-       movl 16(%esp),%esi
-       incl %esi
-       cmpl $23,%esi
+       movl 16(%esp),%ebp
+       incl %ebp
+       cmpl $23,%ebp
        jle .L1412
-       xorl %esi,%esi
+       xorl %ebp,%ebp
 .L1412:
-       leal 0(,%esi,4),%eax
-       movl (%eax,%ebp),%ebx
-       cmpl $-1,%ebx
+       leal 0(,%ebp,4),%ebx
+       movl 24(%esp),%edi
+       movl %ebx,20(%esp)
+       movl (%ebx,%edi),%esi
+       movl %esi,%eax
+       xorl %edx,%edx
+       andl $0,%eax
+       andl $-1,%edx
+       movl %eax,%ecx
+       orl %edx,%ecx
        je .L1410
-       movl $-1,(%eax,%ebp)
-       leal 4(%esi,%eax),%edx
-       movl 2256(%edi),%eax
+       cmpl $-1,%esi
+       je .L1410
+       movl $-1,(%ebx,%edi)
+       leal 4(%ebp,%ebx),%edx
+       movl 32(%esp),%ebx
+       movl 2256(%ebx),%eax
        addl $1832,%eax
-       movl 2260(%edi),%ecx
-       addl $708,%ecx
-       movl %ecx,(%eax,%edx,4)
+       movl 2260(%ebx),%edi
+       addl $708,%edi
+       movl %edi,(%eax,%edx,4)
 #APP
 #NO_APP
-       movl 16(%esp),%ecx
-       leal 4(%ecx,%ecx,4),%edx
+       movl 16(%esp),%ebx
+       movl 32(%esp),%edi
+       leal 4(%ebx,%ebx,4),%edx
        movl 2256(%edi),%eax
        addl $1832,%eax
-       movl 2260(%edi),%ecx
-       addl $716,%ecx
-       movl %ecx,(%eax,%edx,4)
-       movb 29(%ebx),%al
+       movl 2260(%edi),%ebx
+       addl $716,%ebx
+       movl %ebx,(%eax,%edx,4)
+       movb 29(%esi),%al
        testb %al,%al
-       jge .L1414
-       pushl %ebx
+       jge .L1415
+       pushl %esi
        pushl %edi
        call ncr_complete
-       jmp .L1418
+       jmp .L1419
        .p2align 2
-.L1414:
+.L1415:
        testb $32,%al
-       je .L1415
-       pushl %ebx
+       je .L1416
+       pushl %esi
+       movl 36(%esp),%edi
        pushl %edi
        call ncr_ccb_skipped
-.L1418:
+.L1419:
        addl $8,%esp
-.L1415:
-       movl %esi,16(%esp)
+.L1416:
+       movl %ebp,16(%esp)
        jmp .L1411
        .p2align 2
 .L1410:
-       movl 16(%esp),%ecx
-       movl %ecx,2560(%edi)
+       movl 32(%esp),%edi
+       movl 16(%esp),%ebx
+       movl %ebx,2560(%edi)
        popl %ebx
        popl %esi
        popl %edi
        popl %ebp
-       popl %ecx
+       addl $12,%esp
        ret


-- 
`Surf the sea, not double-u three...'
wmglo@dent.med.uni-muenchen.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]