Browse Source

Continue the conversion to using per-arch crti.S and crtn.S

Eric Andersen 20 years ago
parent
commit
ed2484a3dd
3 changed files with 79 additions and 1 deletions
  1. 26 1
      libc/sysdeps/linux/m68k/Makefile
  2. 27 0
      libc/sysdeps/linux/m68k/crti.S
  3. 26 0
      libc/sysdeps/linux/m68k/crtn.S

+ 26 - 1
libc/sysdeps/linux/m68k/Makefile

@@ -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"

+ 27 - 0
libc/sysdeps/linux/m68k/crti.S

@@ -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"

+ 26 - 0
libc/sysdeps/linux/m68k/crtn.S

@@ -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"