Преглед на файлове

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

Eric Andersen преди 20 години
родител
ревизия
53d9845ae7
променени са 3 файла, в които са добавени 122 реда и са изтрити 1 реда
  1. 27 1
      libc/sysdeps/linux/mips/Makefile
  2. 50 0
      libc/sysdeps/linux/mips/crti.S
  3. 45 0
      libc/sysdeps/linux/mips/crtn.S

+ 27 - 1
libc/sysdeps/linux/mips/Makefile

@@ -22,6 +22,7 @@ ASFLAGS=$(CFLAGS)
 
 CRT0_SRC = crt0.S
 CRT0_OBJ = crt0.o crt1.o
+CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
 
 SSRC=bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S fork.S syscall.S pipe.S
 SOBJS=$(patsubst %.S,%.o, $(SSRC))
@@ -36,7 +37,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/
 
@@ -52,6 +53,31 @@ $(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:
 	$(LN) -fs ../libc/sysdeps/linux/mips/sgidefs.h $(TOPDIR)/include/
 #	$(LN) -fs ../libc/sysdeps/linux/mips/regdef.h $(TOPDIR)/include/

+ 50 - 0
libc/sysdeps/linux/mips/crti.S

@@ -0,0 +1,50 @@
+	.file	1 "initfini.c"
+	.section .mdebug.abi32
+	.previous
+	.abicalls
+#APP
+	
+	.section .init
+#NO_APP
+	.align	2
+	.globl	_init
+	.ent	_init
+	.type	_init, @function
+_init:
+	.frame	$sp,32,$31		# vars= 0, regs= 2/0, args= 16, extra= 8
+	.mask	0x90000000,-4
+	.fmask	0x00000000,0
+	.set	noreorder
+	.cpload	$25
+	.set	reorder
+	subu	$sp,$sp,32
+	.cprestore 16
+	sw	$31,28($sp)
+	sw	$28,24($sp)
+#APP
+	
+	.align 2
+	.end _init
+	
+	.section .fini
+#NO_APP
+	.align	2
+	.globl	_fini
+	.ent	_fini
+	.type	_fini, @function
+_fini:
+	.frame	$sp,32,$31		# vars= 0, regs= 2/0, args= 16, extra= 8
+	.mask	0x90000000,-4
+	.fmask	0x00000000,0
+	.set	noreorder
+	.cpload	$25
+	.set	reorder
+	subu	$sp,$sp,32
+	.cprestore 16
+	sw	$31,28($sp)
+	sw	$28,24($sp)
+#APP
+	.align 2
+	.end _fini
+	
+	.ident	"GCC: (GNU) 3.3.2"

+ 45 - 0
libc/sysdeps/linux/mips/crtn.S

@@ -0,0 +1,45 @@
+	.file	1 "initfini.c"
+	.section .mdebug.abi32
+	.previous
+	.abicalls
+#APP
+	
+	.section .init
+#NO_APP
+	.align	2
+	.globl	_init
+	.ent	_init
+	.type	_init, @function
+#NO_APP
+	lw	$31,28($sp)
+	#nop
+	.set	noreorder
+	.set	nomacro
+	j	$31
+	addu	$sp,$sp,32
+	.set	macro
+	.set	reorder
+
+	.end	_init
+#APP
+	
+	.section .fini
+#NO_APP
+	.align	2
+	.globl	_fini
+	.ent	_fini
+	.type	_fini, @function
+#NO_APP
+	lw	$31,28($sp)
+	#nop
+	.set	noreorder
+	.set	nomacro
+	j	$31
+	addu	$sp,$sp,32
+	.set	macro
+	.set	reorder
+
+	.end	_fini
+#APP
+	
+	.ident	"GCC: (GNU) 3.3.2"