On Friday 12 December 2008 16:12, Bernhard Reutner-Fischer wrote:
> On Fri, Dec 12, 2008 at 06:23:17AM -0800, [email protected] wrote:
> >Author: vda
> >Date: 2008-12-12 06:23:17 -0800 (Fri, 12 Dec 2008)
> >New Revision: 24394
> >
> >Log:
> >smaller brk() for i386. Inspected assembly to see it's still valid.
> > text data bss dec hex filename
> >- 44 0 4 48 30 libc/sysdeps/linux/i386/brk.o
> >+ 42 0 4 46 2e libc/sysdeps/linux/i386/brk.o
>
> That doesn't compile for me?
>
> /there/src/buildroot.git.pentium4/i686_build/staging/usr/bin/i686-linux-uclibc-gcc
> -c libc/sysdeps/linux/i386/brk.c -o libc/sysdeps/linux/i386/brk.os -include
> ./include/libc-symbols.h -Wall -Wstrict-prototypes -fno-strict-aliasing
> -ffunction-sections -fdata-sections -m32 -fno-stack-protector -fno-builtin
> -nostdinc -I./include -I. -I./libc/sysdeps/linux/i386 -fno-asm -Os -pipe
> -fno-builtin --sysroot=/there/src/buildroot.git.pentium4/i686_build/staging/
> -isysroot /there/src/buildroot.git.pentium4/i686_build/staging
> -I=/usr/include -DUCLIBC_INTERNAL -std=gnu99 -Os -funit-at-a-time
> -fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce
> -fomit-frame-pointer -mpreferred-stack-boundary=4 -falign-functions=1
> -falign-jumps=1 -falign-labels=1 -falign-loops=1
> -I./libpthread/linuxthreads/sysdeps/unix/sysv/linux/i386
> -I./libpthread/linuxthreads/sysdeps/i386
> -I./libpthread/linuxthreads/sysdeps/unix/sysv/linux
> -I./libpthread/linuxthreads/sysdeps/pthread -I./libpthread/linuxthreads
> -I./libpthread
> -I/there/src/buildroot.git.pentium4/i686_toolchain/linux/include/
> -I/there/src/buildroot.git.pentium4/i686_build/staging/usr/lib/gcc/i686-linux-uclibc/4.4.0//include-fixed
>
> -I/there/src/buildroot.git.pentium4/i686_build/staging/usr/lib/gcc/i686-linux-uclibc/4.4.0/include
> -DNDEBUG -fPIC -MT libc/sysdeps/linux/i386/brk.os -MD -MP -MF
> libc/sysdeps/linux/i386/.brk.os.dep
Aha! -fPIC!
> libc/sysdeps/linux/i386/brk.c: In function 'brk':
> libc/sysdeps/linux/i386/brk.c:32: error: can't find a register in class
> 'BREG' while reloading 'asm'
> libc/sysdeps/linux/i386/brk.c:32: error: 'asm' operand has impossible
> constraints
> make[1]: *** [libc/sysdeps/linux/i386/brk.os] Error 1
Stupid machine does not want to release its grip on %ebx
which is used for PIC purposes! :(
The attached patch helps, I applied it to svn. Sorry.
--
vda
diff -d -urpN uClibc.8/libc/sysdeps/linux/i386/brk.c uClibc.9/libc/sysdeps/linux/i386/brk.c
--- uClibc.8/libc/sysdeps/linux/i386/brk.c 2008-12-13 00:00:43.000000000 +0100
+++ uClibc.9/libc/sysdeps/linux/i386/brk.c 2008-12-13 00:25:50.000000000 +0100
@@ -25,14 +25,19 @@
void *__curbrk attribute_hidden = 0;
/* libc_hidden_proto(brk) */
-int brk (void *addr)
+int brk(void *addr)
{
- void *newbrk, *ebx;
+ void *newbrk;
- __asm__ (
- "int $0x80\n"
- : "=a" (newbrk), "=b" (ebx)
- : "0" (__NR_brk), "1" (addr)
+ /* %ebx is used in PIC code, need to save/restore it manually.
+ * gcc won't do it for us if we will request it in constraints
+ */
+ __asm__("pushl %%ebx\n"
+ "movl %2, %%ebx\n"
+ "int $0x80\n"
+ "popl %%ebx\n"
+ : "=a" (newbrk)
+ : "0" (__NR_brk), "g" (addr)
);
__curbrk = newbrk;
_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc