Browse Source

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

Eric Andersen 21 years ago
parent
commit
e16f9ab53b
3 changed files with 99 additions and 1 deletions
  1. 26 1
      libc/sysdeps/linux/alpha/Makefile
  2. 43 0
      libc/sysdeps/linux/alpha/crti.S
  3. 30 0
      libc/sysdeps/linux/alpha/crtn.S

+ 26 - 1
libc/sysdeps/linux/alpha/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=__longjmp.S brk.S bsd-_setjmp.S bsd-setjmp.S clone.S \
     setjmp.S divl.S reml.S remq.S divq.S 
@@ -37,7 +38,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/
 
@@ -53,6 +54,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:
 	$(LN) -fs ../libc/sysdeps/linux/alpha/fpu_control.h $(TOPDIR)/include/
 

+ 43 - 0
libc/sysdeps/linux/alpha/crti.S

@@ -0,0 +1,43 @@
+	.set noat
+	.set noreorder
+	.set nomacro
+	.set	macro
+	
+	.section .init
+	.set	nomacro
+	.align 2
+	.globl _init
+	.ent _init
+_init:
+	.frame $30,0,$26,0
+	.mask 0x4000000,0
+	ldah $29,0($27)		!gpdisp!3
+	lda $29,0($29)		!gpdisp!3
+$_init..ng:
+	lda $30,-16($30)
+	stq $26,0($30)
+	.prologue 1
+	.set	macro
+	
+	.align 2
+	.end _init
+	
+	.section .fini
+	.set	nomacro
+	.align 2
+	.globl _fini
+	.ent _fini
+_fini:
+	.frame $30,0,$26,0
+	.mask 0x4000000,0
+	ldah $29,0($27)		!gpdisp!6
+	lda $29,0($29)		!gpdisp!6
+$_fini..ng:
+	lda $30,-16($30)
+	stq $26,0($30)
+	.prologue 1
+	.set	macro
+	.align 2
+	.end _fini
+	
+	.ident	"GCC: (GNU) 3.3.2"

+ 30 - 0
libc/sysdeps/linux/alpha/crtn.S

@@ -0,0 +1,30 @@
+	.set noat
+	.set noreorder
+	.set nomacro
+	.set	macro
+	
+	.section .init
+	.set	nomacro
+	.align 2
+	.globl _init
+	.ent _init
+	.set	nomacro
+	ldq $26,0($30)
+	lda $30,16($30)
+	ret $31,($26),1
+	.end _init
+	.set	macro
+	
+	.section .fini
+	.set	nomacro
+	.align 2
+	.globl _fini
+	.ent _fini
+	.set	nomacro
+	ldq $26,0($30)
+	lda $30,16($30)
+	ret $31,($26),1
+	.end _fini
+	.set	macro
+	
+	.ident	"GCC: (GNU) 3.3.2"