minix/lib/csu/i386-elf/Makefile
Ben Gras 8b69d04fff csu: add code to call constructors to be used by clang
. clang-linked binaries were not calling global constructors, as the
	  code to do so wasn't in csu/ and linked
	. it does work for gcc as it uses its self-supplied crt{begin,end} code
	. this commit copies netbsd's crt{begin,end}.S, which contains
	  constructor/destructor calling code, called from .init and .fini
	  sections already accumulated by the linker. the _init function was already
	  called by the C startup code before calling main.
	. based on work by Antoine Leca
2011-11-20 20:20:51 +01:00

30 lines
745 B
Makefile

.include <bsd.own.mk>
SRCS= crti.S crtn.S crtbegin.S crtend.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g} gcrt1.o crt1.o Scrt1.o
realall: ${OBJS}
FILES=${OBJS}
FILESDIR=${LIBDIR}
CLEANFILES=${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
gcrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -DGCRT -c -o gcrt1_c.o ${.CURDIR}/crt1_c.c
gcrt1.o: gcrt1_c.o crt1_s.o
${LD} ${LDFLAGS} -o gcrt1.o -r crt1_s.o gcrt1_c.o
crt1.o: crt1_c.o crt1_s.o
${LD} ${LDFLAGS} -o crt1.o -r crt1_s.o crt1_c.o
${OBJCOPY} --localize-symbol _start1 crt1.o
Scrt1_c.o: crt1_c.c
${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1_c.o ${.CURDIR}/crt1_c.c
Scrt1.o: Scrt1_c.o crt1_s.o
${LD} ${LDFLAGS} -o Scrt1.o -r crt1_s.o Scrt1_c.o
${OBJCOPY} --localize-symbol _start1 Scrt1.o
.include <bsd.prog.mk>