summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/cris
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-01-23 17:30:12 +0000
committerEric Andersen <andersen@codepoet.org>2003-01-23 17:30:12 +0000
commit1bad089bf9f29240e11216eab1109bd6a7a952fd (patch)
treeb34f9915052ae1c88ccb84bcbcb507f005fbc0bf /libc/sysdeps/linux/cris
parent1cb64284ed8fd159fdc10ef927f03110196d9796 (diff)
Hopefully this will work as expected. I have no way to
test but this should be correct.
Diffstat (limited to 'libc/sysdeps/linux/cris')
-rw-r--r--libc/sysdeps/linux/cris/Makefile9
-rw-r--r--libc/sysdeps/linux/cris/crt0.c13
2 files changed, 16 insertions, 6 deletions
diff --git a/libc/sysdeps/linux/cris/Makefile b/libc/sysdeps/linux/cris/Makefile
index 6b9931ebb..b3d7d16c5 100644
--- a/libc/sysdeps/linux/cris/Makefile
+++ b/libc/sysdeps/linux/cris/Makefile
@@ -16,8 +16,8 @@ TOPDIR=../../../../
include $(TOPDIR)Rules.mak
ASFLAGS=$(CFLAGS)
-CRT0=crt0.c
-CRT0_OBJ=$(patsubst %.c,%.o, $(CRT0))
+CRT0_SRC = crt0.c
+CRT0_OBJ = crt0.o crt1.o
SSRC= setjmp.S __longjmp.S clone.S sysdep.S syscall.S
ifeq ($(UNIFIED_SYSCALL),y)
@@ -39,8 +39,8 @@ ar-target: $(OBJS) $(CRT0_OBJ)
$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ)
-$(CRT0_OBJ): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
+$(CRT0_OBJ): $(CRT0_SRC)
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
$(STRIPTOOL) -x -R .note -R .comment $*.o
$(SOBJS): %.o : %.S
@@ -52,7 +52,6 @@ $(COBJS): %.o : %.c
$(STRIPTOOL) -x -R .note -R .comment $*.o
headers:
- @(TOPDIR=$(TOPDIR) CC=$(CC) /bin/sh $(TOPDIR)/extra/scripts/gen_bits_syscall_h.sh > bits/syscall.h )
clean:
rm -f *.[oa] *~ core
diff --git a/libc/sysdeps/linux/cris/crt0.c b/libc/sysdeps/linux/cris/crt0.c
index 4fe68ce05..442a1c9ec 100644
--- a/libc/sysdeps/linux/cris/crt0.c
+++ b/libc/sysdeps/linux/cris/crt0.c
@@ -23,8 +23,15 @@ _start ()
__asm__ volatile("jump start1");
}
-void __uClibc_main(int argc, char **argv, char **envp)
+#include <features.h>
+
+extern void __uClibc_main(int argc, char **argv, char **envp)
+ __attribute__ ((__noreturn__));
+extern void __uClibc_start_main(int argc, char **argv, char **envp,
+ void (*app_init)(void), void (*app_fini)(void))
__attribute__ ((__noreturn__));
+extern void weak_function _init(void);
+extern void weak_function _fini(void);
static void
start1 (int argc, char **argv)
@@ -45,6 +52,10 @@ start1 (int argc, char **argv)
*/
--environ;
+#if defined L_crt0 || ! defined __UCLIBC_CTOR_DTOR__
/* Leave control to the libc */
__uClibc_main(argc, argv, environ);
+#else
+ __uClibc_start_main(argc, argv, environ, _init, _fini);
+#endif
}