summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/sysdeps/linux/m68k/Makefile27
-rw-r--r--libc/sysdeps/linux/m68k/crti.S27
-rw-r--r--libc/sysdeps/linux/m68k/crtn.S26
3 files changed, 79 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/m68k/Makefile b/libc/sysdeps/linux/m68k/Makefile
index 5c8d3e381..bff5144a6 100644
--- a/libc/sysdeps/linux/m68k/Makefile
+++ b/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"
diff --git a/libc/sysdeps/linux/m68k/crti.S b/libc/sysdeps/linux/m68k/crti.S
new file mode 100644
index 000000000..ccfe99133
--- /dev/null
+++ b/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"
diff --git a/libc/sysdeps/linux/m68k/crtn.S b/libc/sysdeps/linux/m68k/crtn.S
new file mode 100644
index 000000000..d29c02dec
--- /dev/null
+++ b/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"