Explorar el Código

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

Eric Andersen hace 21 años
padre
commit
46c48a7091
Se han modificado 3 ficheros con 102 adiciones y 1 borrados
  1. 27 1
      libc/sysdeps/linux/sh64/Makefile
  2. 42 0
      libc/sysdeps/linux/sh64/crti.S
  3. 33 0
      libc/sysdeps/linux/sh64/crtn.S

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

@@ -27,6 +27,7 @@ TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine)
 
 CRT0_SRC = crt0.S
 CRT0_OBJ = crt0.o crt1.o
+CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
 
 SSRC = setjmp.S longjmp.S 
 SOBJS = $(patsubst %.S,%.o, $(SSRC))
@@ -41,7 +42,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/
 
@@ -57,6 +58,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:
 
 clean:

+ 42 - 0
libc/sysdeps/linux/sh64/crti.S

@@ -0,0 +1,42 @@
+	.file	"initfini.c"
+	.section	.text..SHmedia32,"ax"
+	.little
+	
+	.section .init
+	.hidden  _init
+	.align 2
+	.global	_init
+	.type	_init, @function
+_init:
+	addi.l	r15, -16, r15
+	st.l	r15, 4, r12
+	movi	(((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) >> 16) & 65535), r12
+	shori	((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) & 65535), r12
+	.LPCS0: ptrel/u	r12, tr0
+	st.l	r15, 8, r14
+	st.l	r15, 12, r18
+	add.l	r15, r63, r14
+	gettr	tr0, r12
+	
+	.align 2
+	
+	
+	.section .fini
+	.hidden  _fini
+	.align 2
+	.global	_fini
+	.type	_fini, @function
+_fini:
+	addi.l	r15, -16, r15
+	st.l	r15, 4, r12
+	movi	(((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS1-.)) >> 16) & 65535), r12
+	shori	((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS1-.)) & 65535), r12
+	.LPCS1: ptrel/u	r12, tr0
+	st.l	r15, 8, r14
+	st.l	r15, 12, r18
+	add.l	r15, r63, r14
+	gettr	tr0, r12
+	.align 2
+	
+	
+	.ident	"GCC: (GNU) 3.3.2"

+ 33 - 0
libc/sysdeps/linux/sh64/crtn.S

@@ -0,0 +1,33 @@
+	.file	"initfini.c"
+	.section	.text..SHmedia32,"ax"
+	.little
+	
+	.section .init
+	.hidden  _init
+	.align 2
+	.global	_init
+	.type	_init, @function
+	add.l	r14, r63, r15
+	ld.l	r15, 12, r18
+	ld.l	r15, 4, r12
+	ld.l	r15, 8, r14
+	ptabs	r18, tr0
+	addi.l	r15, 16, r15
+	blink	tr0, r63
+	.size	_init, .-_init
+	
+	.section .fini
+	.hidden  _fini
+	.align 2
+	.global	_fini
+	.type	_fini, @function
+	add.l	r14, r63, r15
+	ld.l	r15, 12, r18
+	ld.l	r15, 4, r12
+	ld.l	r15, 8, r14
+	ptabs	r18, tr0
+	addi.l	r15, 16, r15
+	blink	tr0, r63
+	.size	_fini, .-_fini
+	
+	.ident	"GCC: (GNU) 3.3.2"