OSDN Git Service

Continue the conversion to using per-arch crti.S and crtn.S
authorEric Andersen <andersen@codepoet.org>
Wed, 5 Nov 2003 03:32:14 +0000 (03:32 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 5 Nov 2003 03:32:14 +0000 (03:32 -0000)
libc/sysdeps/linux/m68k/Makefile
libc/sysdeps/linux/m68k/crti.S [new file with mode: 0644]
libc/sysdeps/linux/m68k/crtn.S [new file with mode: 0644]

index 5c8d3e3..bff5144 100644 (file)
@@ -29,6 +29,7 @@ else
 CRT0_SRC = crt0.S
 endif
 CRT0_OBJ = crt0.o crt1.o
+CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
 
 SSRC= __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S
 SOBJS=$(patsubst %.S,%.o, $(SSRC))
@@ -44,7 +45,7 @@ all: $(OBJS) $(LIBC)
 
 $(LIBC): ar-target 
 
-ar-target: $(OBJS) $(CRT0_OBJ)
+ar-target: $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS)
        $(AR) $(ARFLAGS) $(LIBC) $(OBJS)
        cp $(CRT0_OBJ) $(TOPDIR)lib/
 
@@ -60,6 +61,30 @@ $(COBJS): %.o : %.c
        $(CC) $(CFLAGS) -c $< -o $@
        $(STRIPTOOL) -x -R .note -R .comment $*.o
 
+ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
+crti.o: crti.S
+       $(CC) $(SAFECFLAGS) -c crti.S -o crti.o
+
+$(TOPDIR)lib/crti.o: crti.o
+       $(INSTALL) -d $(TOPDIR)lib/
+       cp crti.o $(TOPDIR)lib/
+
+crtn.o: crtn.S
+       $(CC) $(SAFECFLAGS) -c crtn.S -o crtn.o
+
+$(TOPDIR)lib/crtn.o: crtn.o
+       $(INSTALL) -d $(TOPDIR)lib/
+       cp crtn.o $(TOPDIR)lib/
+else
+$(TOPDIR)lib/crti.o:
+       $(INSTALL) -d $(TOPDIR)lib/
+       $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
+$(TOPDIR)lib/crtn.o:
+       $(INSTALL) -d $(TOPDIR)lib/
+       $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o
+endif
+
+
 headers:
 ifneq ($(strip $(HAVE_ELF)),y)
        echo "Working around compiler bug in the m68k-pic-coff toolchain"
diff --git a/libc/sysdeps/linux/m68k/crti.S b/libc/sysdeps/linux/m68k/crti.S
new file mode 100644 (file)
index 0000000..ccfe991
--- /dev/null
@@ -0,0 +1,27 @@
+       .file   "initfini.c"
+#APP
+       
+       .section .init
+#NO_APP
+       .align  2
+       .globl  _init
+       .type   _init, @function
+_init:
+       link.w %a6,#0
+#APP
+       
+       .align 2
+       
+       
+       .section .fini
+#NO_APP
+       .align  2
+       .globl  _fini
+       .type   _fini, @function
+_fini:
+       link.w %a6,#0
+#APP
+       .align 2
+       
+       
+       .ident  "GCC: (GNU) 3.3.2"
diff --git a/libc/sysdeps/linux/m68k/crtn.S b/libc/sysdeps/linux/m68k/crtn.S
new file mode 100644 (file)
index 0000000..d29c02d
--- /dev/null
@@ -0,0 +1,26 @@
+       .file   "initfini.c"
+#APP
+       
+       .section .init
+#NO_APP
+       .align  2
+       .globl  _init
+       .type   _init, @function
+#NO_APP
+       unlk %a6
+       rts
+       .size   _init, .-_init
+#APP
+       
+       .section .fini
+#NO_APP
+       .align  2
+       .globl  _fini
+       .type   _fini, @function
+#NO_APP
+       unlk %a6
+       rts
+       .size   _fini, .-_fini
+#APP
+       
+       .ident  "GCC: (GNU) 3.3.2"