This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: "error: bp cannot be used in asm here"
- From: "Alfred M. Szmidt" <ams at kemisten dot nu>
- To: Roland McGrath <roland at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Tue, 24 Aug 2004 14:13:28 +0200
- Subject: Re: "error: bp cannot be used in asm here"
- References: <200408142018.i7EKI1pj018438@magilla.sf.frob.com>
> What happens if you just remove the "bp" clobber?
>
> Seems to work, though I haven't tested the compiled result yet.
> Want me todo that before you commit the changes?
At least examine the assembly code and see if it changed any from
what gcc produced without the clobber.
It did change a bit. But I don't grok x86 assembly to well to
understand the changes though.
,----[ Without "bp" clobbering ]
| 000001d0 <_hurd_stack_setup>:
| 1d0: 55 push %ebp
| 1d1: 89 e5 mov %esp,%ebp
| 1d3: 8d 45 08 lea 0x8(%ebp),%eax
| 1d6: 53 push %ebx
| 1d7: 8d 55 f8 lea 0xfffffff8(%ebp),%edx
| 1da: 83 ec 24 sub $0x24,%esp
| 1dd: 89 45 f4 mov %eax,0xfffffff4(%ebp)
| 1e0: bb 00 00 00 00 mov $0x0,%ebx
| 1e5: b8 86 01 00 00 mov $0x186,%eax
| 1ea: c6 45 e8 b9 movb $0xb9,0xffffffe8(%ebp)
| 1ee: 29 d0 sub %edx,%eax
| 1f0: 89 55 e9 mov %edx,0xffffffe9(%ebp)
| 1f3: c6 45 ed e9 movb $0xe9,0xffffffed(%ebp)
| 1f7: 89 45 ee mov %eax,0xffffffee(%ebp)
| 1fa: e8 fc ff ff ff call 1fb <_hurd_stack_setup+0x2b>
| 1ff: 81 fb 00 00 00 00 cmp $0x0,%ebx
| 205: 72 19 jb 220 <_hurd_stack_setup+0x50>
| 207: 8d 45 e8 lea 0xffffffe8(%ebp),%eax
| 20a: 89 44 24 04 mov %eax,0x4(%esp,1)
| 20e: 8d 45 08 lea 0x8(%ebp),%eax
| 211: 89 04 24 mov %eax,(%esp,1)
| 214: e8 fc ff ff ff call 215 <_hurd_stack_setup+0x45>
| 219: 83 c4 24 add $0x24,%esp
| 21c: 5b pop %ebx
| 21d: 5d pop %ebp
| 21e: c3 ret
| 21f: 90 nop
| 220: ff 13 call *(%ebx)
| 222: 83 c3 04 add $0x4,%ebx
| 225: 81 fb 00 00 00 00 cmp $0x0,%ebx
| 22b: 72 f3 jb 220 <_hurd_stack_setup+0x50>
| 22d: eb d8 jmp 207 <_hurd_stack_setup+0x37>
| 22f: 90 nop
`----
,----[ With "bp" clobbering ]
| 00000310 <_hurd_stack_setup>:
| 310: 55 push %ebp
| 311: 89 e5 mov %esp,%ebp
| 313: 8d 45 08 lea 0x8(%ebp),%eax
| 316: 53 push %ebx
| 317: 83 ec 14 sub $0x14,%esp
| 31a: 8d 55 f8 lea 0xfffffff8(%ebp),%edx
| 31d: 89 45 f4 mov %eax,0xfffffff4(%ebp)
| 320: b8 d2 02 00 00 mov $0x2d2,%eax
| 325: 29 d0 sub %edx,%eax
| 327: bb 00 00 00 00 mov $0x0,%ebx
| 32c: c6 45 e8 b9 movb $0xb9,0xffffffe8(%ebp)
| 330: 89 55 e9 mov %edx,0xffffffe9(%ebp)
| 333: c6 45 ed e9 movb $0xe9,0xffffffed(%ebp)
| 337: 89 45 ee mov %eax,0xffffffee(%ebp)
| 33a: e8 fc ff ff ff call 33b <_hurd_stack_setup+0x2b>
| 33f: 81 fb 00 00 00 00 cmp $0x0,%ebx
| 345: 73 0e jae 355 <_hurd_stack_setup+0x45>
| 347: 90 nop
| 348: ff 13 call *(%ebx)
| 34a: 83 c3 04 add $0x4,%ebx
| 34d: 81 fb 00 00 00 00 cmp $0x0,%ebx
| 353: 72 f3 jb 348 <_hurd_stack_setup+0x38>
| 355: 83 ec 08 sub $0x8,%esp
| 358: 8d 45 e8 lea 0xffffffe8(%ebp),%eax
| 35b: 50 push %eax
| 35c: 8d 45 08 lea 0x8(%ebp),%eax
| 35f: 50 push %eax
| 360: e8 fc ff ff ff call 361 <_hurd_stack_setup+0x51>
| 365: 8b 5d fc mov 0xfffffffc(%ebp),%ebx
| 368: c9 leave
| 369: c3 ret
| 36a: 89 f6 mov %esi,%esi
`----
> > ../sysdeps/mach/hurd/i386/init-first.c:224: warning: use of cast expressions as lvalues is deprecated
>
> This you should be able to fix by changing the type of NEWSP
> to int * and adding casts to (void *) its other uses. Want to
> try that?
>
> Done.
Did this in fact eliminate that warning and not introduce any
others?
Yes.
,----
| 16:i386-unknown-gnu0.3-gcc ../sysdeps/mach/hurd/i386/init-first.c -c -std=gnu99 -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g -Wno-parentheses -mpreferred-stack-boundary=4 -I../include -I. -I/home/ams/libc.obj/csu -I.. -I../libio -I../hurd -I/home/ams/libc.obj/hurd/ -I../mach -I/home/ams/libc.obj/mach/ -I/home/ams/libc.obj -I../sysdeps/i386/elf -I../sysdeps/mach/hurd/i386 -I../sysdeps/mach/hurd -I../sysdeps/gnu -I../sysdeps/unix/bsd/bsd4.4 -I../sysdeps/unix/mman -I../sysdeps/mach/i386 -I../sysdeps/mach -I../sysdeps/i386/fpu -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/unix/bsd -I../sysdeps/unix/common -I../sysdeps/unix/inet -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DHAVE_INITFINI -o /home/ams/libc.obj/csu/init-first.o -MD -MP -MF /home/ams/lib
c.obj/csu/init-first.o.dt -MT /home/ams/libc.obj/csu/init-first.o
| 17:../sysdeps/mach/hurd/i386/init-first.c: In function `init1':
| 18:../sysdeps/mach/hurd/i386/init-first.c:130: warning: implicit declaration of function `__vm_deallocate'
| 19:../sysdeps/mach/hurd/i386/init-first.c: In function `_hurd_stack_setup':
| 20:../sysdeps/mach/hurd/i386/init-first.c:356: warning: dereferencing type-punned pointer will break strict-aliasing rules
|
|
| 60:i386-unknown-gnu0.3-gcc ../sysdeps/mach/hurd/i386/init-first.c -c -std=gnu99 -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g -Wno-parentheses -mpreferred-stack-boundary=4 -fPIC -I../include -I. -I/home/ams/libc.obj/csu -I.. -I../libio -I../hurd -I/home/ams/libc.obj/hurd/ -I../mach -I/home/ams/libc.obj/mach/ -I/home/ams/libc.obj -I../sysdeps/i386/elf -I../sysdeps/mach/hurd/i386 -I../sysdeps/mach/hurd -I../sysdeps/gnu -I../sysdeps/unix/bsd/bsd4.4 -I../sysdeps/unix/mman -I../sysdeps/mach/i386 -I../sysdeps/mach -I../sysdeps/i386/fpu -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/unix/bsd -I../sysdeps/unix/common -I../sysdeps/unix/inet -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPIC -DSHARED -DHAVE_INITFINI -o /home/ams/libc.obj/csu/init-first.os -MD
-MP -MF /home/ams/libc.obj/csu/init-first.os.dt -MT /home/ams/libc.obj/csu/init-first.os
| 61:../sysdeps/mach/hurd/i386/init-first.c: In function `init1':
| 62:../sysdeps/mach/hurd/i386/init-first.c:130: warning: implicit declaration of function `__vm_deallocate'
|
|
| 72:i386-unknown-gnu0.3-gcc ../sysdeps/mach/hurd/i386/init-first.c -c -std=gnu99 -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g -Wno-parentheses -mpreferred-stack-boundary=4 -pg -I../include -I. -I/home/ams/libc.obj/csu -I.. -I../libio -I../hurd -I/home/ams/libc.obj/hurd/ -I../mach -I/home/ams/libc.obj/mach/ -I/home/ams/libc.obj -I../sysdeps/i386/elf -I../sysdeps/mach/hurd/i386 -I../sysdeps/mach/hurd -I../sysdeps/gnu -I../sysdeps/unix/bsd/bsd4.4 -I../sysdeps/unix/mman -I../sysdeps/mach/i386 -I../sysdeps/mach -I../sysdeps/i386/fpu -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/unix/bsd -I../sysdeps/unix/common -I../sysdeps/unix/inet -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -D_LIBC_REENTRANT -include ../include/libc-symbols.h -DPROF -DHAVE_INITFINI -o /home/ams/libc.obj/csu/init-first.op -MD -MP -MF /h
ome/ams/libc.obj/csu/init-first.op.dt -MT /home/ams/libc.obj/csu/init-first.op
| 73:../sysdeps/mach/hurd/i386/init-first.c: In function `init1':
| 74:../sysdeps/mach/hurd/i386/init-first.c:130: warning: implicit declaration of function `__vm_deallocate'
| 75:../sysdeps/mach/hurd/i386/init-first.c: In function `_hurd_stack_setup':
| 76:../sysdeps/mach/hurd/i386/init-first.c:356: warning: dereferencing type-punned pointer will break strict-aliasing rules
`----
I regenerated both.
Thanks.