aboutsummaryrefslogtreecommitdiff
path: root/lib/csu
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csu')
-rw-r--r--lib/csu/Makefile.inc37
-rw-r--r--lib/csu/aarch64/Makefile31
-rw-r--r--lib/csu/amd64/Makefile32
-rw-r--r--lib/csu/arm/Makefile34
-rw-r--r--lib/csu/i386/Makefile34
-rw-r--r--lib/csu/mips/Makefile31
-rw-r--r--lib/csu/powerpc/Makefile32
-rw-r--r--lib/csu/powerpc64/Makefile32
-rw-r--r--lib/csu/riscv/Makefile31
9 files changed, 46 insertions, 248 deletions
diff --git a/lib/csu/Makefile.inc b/lib/csu/Makefile.inc
index 0870e2950706..7d7136e8c1a6 100644
--- a/lib/csu/Makefile.inc
+++ b/lib/csu/Makefile.inc
@@ -8,16 +8,53 @@ NO_WMISSING_VARIABLE_DECLARATIONS=
.if !defined(BUILDING_TESTS)
+OBJS+= Scrt1.o crt1.o gcrt1.o
OBJS+= crtbegin.o crtbeginS.o crtbeginT.o
OBJS+= crtend.o crtendS.o
+OBJS+= crti.o crtn.o
+
+CRT1OBJS+= crtbrand.o ignore_init_note.o
ACFLAGS+= -DLOCORE
CFLAGS+= -fno-asynchronous-unwind-tables
CFLAGS+= -fno-omit-frame-pointer
+CFLAGS+= -I${.CURDIR:H}/common \
+ -I${SRCTOP}/lib/libc/include
CFLAGS_CRTS= -DSHARED ${PICFLAG}
+FILES= ${OBJS}
+FILESMODE= ${LIBMODE}
+FILESOWN= ${LIBOWN}
+FILESGRP= ${LIBGRP}
+FILESDIR= ${LIBDIR}
+# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
+.undef LIBRARIES_ONLY
+
+CLEANFILES+= ${OBJS} ${CRT1OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o
+
+crt1.o: crt1_c.o ${CRT1OBJS}
+ ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
+.if ${MACHINE_ARCH} == "i386"
+ ${OBJCOPY} --localize-symbol _start1 crt1.o
+.endif
+
+gcrt1_c.o: crt1_c.c
+ ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
+
+gcrt1.o: gcrt1_c.o ${CRT1OBJS}
+ ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
+
+Scrt1_c.o: crt1_c.c
+ ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
+
+Scrt1.o: Scrt1_c.o ${CRT1OBJS}
+ ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
+.if ${MACHINE_ARCH} == "i386"
+ ${OBJCOPY} --localize-symbol _start1 crt1.o
+.endif
+
crtbegin.o: crtbegin.c
crtbeginS.o: crtbegin.c
crtbeginT.o: crtbegin.c
diff --git a/lib/csu/aarch64/Makefile b/lib/csu/aarch64/Makefile
index 4898b8286c01..666bf569b786 100644
--- a/lib/csu/aarch64/Makefile
+++ b/lib/csu/aarch64/Makefile
@@ -2,37 +2,8 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crti.S crtn.S
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o crt1.o gcrt1.o
-CFLAGS+= -I${.CURDIR:H}/common \
- -I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS
-FILES= ${OBJS}
-FILESMODE= ${LIBMODE}
-FILESOWN= ${LIBOWN}
-FILESGRP= ${LIBGRP}
-FILESDIR= ${LIBDIR}
-# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
-.undef LIBRARIES_ONLY
-
-CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
-CLEANFILES+= crtbrand.o ignore_init_note.o
-
-gcrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
-
-crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
-
-Scrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
+CRT1OBJS+= crt1_s.o
.include <bsd.lib.mk>
diff --git a/lib/csu/amd64/Makefile b/lib/csu/amd64/Makefile
index 9fe13057368f..19610749b59c 100644
--- a/lib/csu/amd64/Makefile
+++ b/lib/csu/amd64/Makefile
@@ -2,37 +2,7 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crti.S crtn.S
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o crt1.o gcrt1.o
-CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \
- -I${SRCTOP}/lib/libc/include
+CFLAGS+= -I${.CURDIR}
CFLAGS+= -fno-omit-frame-pointer -DCRT_IRELOC_RELA
-FILES= ${OBJS}
-FILESMODE= ${LIBMODE}
-FILESOWN= ${LIBOWN}
-FILESGRP= ${LIBGRP}
-FILESDIR= ${LIBDIR}
-# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
-.undef LIBRARIES_ONLY
-
-CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o
-CLEANFILES+= crtbrand.o ignore_init_note.o
-
-gcrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o
-
-crt1.o: crt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o
-
-Scrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o
-
.include <bsd.lib.mk>
diff --git a/lib/csu/arm/Makefile b/lib/csu/arm/Makefile
index c2f6c0dc09d9..666bf569b786 100644
--- a/lib/csu/arm/Makefile
+++ b/lib/csu/arm/Makefile
@@ -2,40 +2,8 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crti.S crtn.S
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o crt1.o gcrt1.o
-CFLAGS+= -I${.CURDIR:H}/common \
- -I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS
-FILES= ${OBJS}
-FILESMODE= ${LIBMODE}
-FILESOWN= ${LIBOWN}
-FILESGRP= ${LIBGRP}
-FILESDIR= ${LIBDIR}
-# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
-.undef LIBRARIES_ONLY
-
-CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
-CLEANFILES+= crtbrand.o ignore_init_note.o
-
-crt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
-
-gcrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
-
-Scrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
+CRT1OBJS+= crt1_s.o
.include <bsd.lib.mk>
diff --git a/lib/csu/i386/Makefile b/lib/csu/i386/Makefile
index f2c7abb4fd54..cfa7b4d5b399 100644
--- a/lib/csu/i386/Makefile
+++ b/lib/csu/i386/Makefile
@@ -2,39 +2,9 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crti.S crtn.S
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o crt1.o gcrt1.o
-CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \
- -I${SRCTOP}/lib/libc/include
+CFLAGS+= -I${.CURDIR}
CFLAGS+= -DCRT_IRELOC_REL
-FILES= ${OBJS}
-FILESMODE= ${LIBMODE}
-FILESOWN= ${LIBOWN}
-FILESGRP= ${LIBGRP}
-FILESDIR= ${LIBDIR}
-# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
-.undef LIBRARIES_ONLY
-
-CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
-CLEANFILES+= crtbrand.o ignore_init_note.o
-
-gcrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
-
-crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
- ${OBJCOPY} --localize-symbol _start1 crt1.o
-
-Scrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
- ${OBJCOPY} --localize-symbol _start1 Scrt1.o
+CRT1OBJS+= crt1_s.o
.include <bsd.lib.mk>
diff --git a/lib/csu/mips/Makefile b/lib/csu/mips/Makefile
index 18434ef75011..a0c6cdf0be53 100644
--- a/lib/csu/mips/Makefile
+++ b/lib/csu/mips/Makefile
@@ -2,37 +2,6 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crti.S crtn.S
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o crt1.o gcrt1.o
-CFLAGS+= -I${.CURDIR:H}/common \
- -I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS
-FILES= ${OBJS}
-FILESMODE= ${LIBMODE}
-FILESOWN= ${LIBOWN}
-FILESGRP= ${LIBGRP}
-FILESDIR= ${LIBDIR}
-# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
-.undef LIBRARIES_ONLY
-
-CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o
-CLEANFILES+= crtbrand.o ignore_init_note.o
-
-gcrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o
-
-crt1.o: crt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o
-
-Scrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o
-
.include <bsd.lib.mk>
diff --git a/lib/csu/powerpc/Makefile b/lib/csu/powerpc/Makefile
index 0294592f9e6d..44be804c7c3f 100644
--- a/lib/csu/powerpc/Makefile
+++ b/lib/csu/powerpc/Makefile
@@ -2,37 +2,7 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crti.S crtn.S crtsavres.S
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o crt1.o gcrt1.o
-CFLAGS+= -I${.CURDIR:H}/common \
- -I${SRCTOP}/lib/libc/include
+OBJS+= crtsavres.o
CFLAGS+= -DCRT_IRELOC_SUPPRESS
-FILES= ${OBJS}
-FILESMODE= ${LIBMODE}
-FILESOWN= ${LIBOWN}
-FILESGRP= ${LIBGRP}
-FILESDIR= ${LIBDIR}
-# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
-.undef LIBRARIES_ONLY
-
-CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o
-CLEANFILES+= crtbrand.o ignore_init_note.o
-
-gcrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o
-
-crt1.o: crt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o
-
-Scrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o
-
.include <bsd.lib.mk>
diff --git a/lib/csu/powerpc64/Makefile b/lib/csu/powerpc64/Makefile
index e69343b128b5..564e8dfbf288 100644
--- a/lib/csu/powerpc64/Makefile
+++ b/lib/csu/powerpc64/Makefile
@@ -2,42 +2,14 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crti.S crtn.S
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o crt1.o crtsavres.o gcrt1.o
-CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \
- -I${SRCTOP}/lib/libc/include \
+OBJS+= crtsavres.o
+CFLAGS+= -I${.CURDIR} \
-mlongcall -DCRT_IRELOC_RELA
-FILES= ${OBJS}
-FILESMODE= ${LIBMODE}
-FILESOWN= ${LIBOWN}
-FILESGRP= ${LIBGRP}
-FILESDIR= ${LIBDIR}
-# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
-.undef LIBRARIES_ONLY
-
-CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o
-CLEANFILES+= crtbrand.o ignore_init_note.o
CLEANFILES+= crtsavres.S
# On powerpc64 crtsavres is an empty file
crtsavres.S:
touch ${.TARGET}
-gcrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o
-
-crt1.o: crt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o
-
-Scrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o
-
.include <bsd.lib.mk>
diff --git a/lib/csu/riscv/Makefile b/lib/csu/riscv/Makefile
index 4898b8286c01..666bf569b786 100644
--- a/lib/csu/riscv/Makefile
+++ b/lib/csu/riscv/Makefile
@@ -2,37 +2,8 @@
.PATH: ${.CURDIR:H}/common
-SRCS= crti.S crtn.S
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-OBJS+= Scrt1.o crt1.o gcrt1.o
-CFLAGS+= -I${.CURDIR:H}/common \
- -I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS
-FILES= ${OBJS}
-FILESMODE= ${LIBMODE}
-FILESOWN= ${LIBOWN}
-FILESGRP= ${LIBGRP}
-FILESDIR= ${LIBDIR}
-# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
-.undef LIBRARIES_ONLY
-
-CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
-CLEANFILES+= crtbrand.o ignore_init_note.o
-
-gcrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
-
-crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
-
-Scrt1_c.o: crt1_c.c
- ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c
-
-Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o
- ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o}
+CRT1OBJS+= crt1_s.o
.include <bsd.lib.mk>