From 53d9845ae7cc45776bb1d084ccf54ae58186ff5c Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 5 Nov 2003 01:44:16 +0000 Subject: Continue the conversion to using per-arch crti.S and crtn.S --- libc/sysdeps/linux/mips/Makefile | 28 +++++++++++++++++++++- libc/sysdeps/linux/mips/crti.S | 50 ++++++++++++++++++++++++++++++++++++++++ libc/sysdeps/linux/mips/crtn.S | 45 ++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 libc/sysdeps/linux/mips/crti.S create mode 100644 libc/sysdeps/linux/mips/crtn.S (limited to 'libc') diff --git a/libc/sysdeps/linux/mips/Makefile b/libc/sysdeps/linux/mips/Makefile index e3630039f..a10933c66 100644 --- a/libc/sysdeps/linux/mips/Makefile +++ b/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/ diff --git a/libc/sysdeps/linux/mips/crti.S b/libc/sysdeps/linux/mips/crti.S new file mode 100644 index 000000000..b0d523b2f --- /dev/null +++ b/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" diff --git a/libc/sysdeps/linux/mips/crtn.S b/libc/sysdeps/linux/mips/crtn.S new file mode 100644 index 000000000..7a5e4db6e --- /dev/null +++ b/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" -- cgit v1.2.3