summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/common/Makefile9
-rw-r--r--libc/sysdeps/linux/i386/Makefile17
-rw-r--r--libc/sysdeps/linux/i386/clone.S11
3 files changed, 23 insertions, 14 deletions
diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile
index b4a922eb5..973531d98 100644
--- a/libc/sysdeps/linux/common/Makefile
+++ b/libc/sysdeps/linux/common/Makefile
@@ -25,13 +25,20 @@ TOPDIR=../../../
include $(TOPDIR)Rules.make
LIBC=$(TOPDIR)libc.a
+#The file makefile.objs defines $(COBJS)
include makefile.objs
+OBJ=$(COBJS)
+
all: $(OBJ) $(LIBC)
-$(LIBC): $(OBJ)
+$(LIBC): ar-target
+
+ar-target: $(OBJ)
$(AR) $(ARFLAGS) $(LIBC) $(OBJ)
+$(OBJ): Makefile
+
clean:
rm -f *.[oa] *~ core
diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile
index 3c32b6464..b91986b0b 100644
--- a/libc/sysdeps/linux/i386/Makefile
+++ b/libc/sysdeps/linux/i386/Makefile
@@ -25,28 +25,33 @@ include $(TOPDIR)Rules.make
LIBC=$(TOPDIR)libc.a
ASFLAGS=$(CFLAGS)
-MSRC=syscalls.S
+ASMSRC=syscalls.S
+#The file makefile.objs defines $(ASMOBJS)
include makefile.objs
-SSRC=setjmp.S longjmp.S _start.S _exit.S #fork.S
+SSRC=_start.S setjmp.S longjmp.S #fork.S #clone.S
SOBJS=$(patsubst %.S,%.o, $(SSRC))
CSRC=readdir.c #select.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
+OBJS=$(SOBJS) $(ASMOBJS) $(COBJS)
-all: $(MOBJ) $(SOBJS) $(COBJS) $(LIBC)
+all: $(OBJS) $(LIBC)
-$(LIBC): $(MOBJ) $(SOBJS) $(COBJS)
- $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(SOBJS) $(COBJS)
+$(LIBC): ar-target
-$(MOBJ): $(MSRC)
+ar-target: $(OBJS)
+ $(AR) $(ARFLAGS) $(LIBC) $(OBJS)
+
+$(ASMOBJS): $(ASMSRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
$(SOBJS): $(SSRC)
$(COBJS): $(CSRC)
+$(OBJS): Makefile
clean:
rm -f *.[oa] *~ core
diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S
index 7a2025b53..5db30b8e3 100644
--- a/libc/sysdeps/linux/i386/clone.S
+++ b/libc/sysdeps/linux/i386/clone.S
@@ -21,9 +21,8 @@
and invokes a function in the right context after its all over. */
#include <sysdep.h>
-#define _ERRNO_H 1
-#include <bits/errno.h>
-#include <asm-syntax.h>
+#include <asm/errno.h>
+
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
@@ -59,7 +58,7 @@ ENTRY(__clone)
/* Do the system call */
pushl %ebx
movl 16(%esp),%ebx
- movl $SYS_ify(clone),%eax
+ movl $__NR_clone,%eax
int $0x80
popl %ebx
@@ -80,8 +79,6 @@ L(here):
addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx
#endif
pushl %eax
- call JUMPTARGET (_exit)
+ call _exit
-PSEUDO_END (__clone)
-weak_alias (__clone, clone)