crti.o
crtbegin.o
crtend.o
crtn.o
這五個檔案分別是 startup, initialization, constructor, destructor, finalization
它們通常會被自動地連結( link )到我們的程式。經由這些檔案,我們程式的 main() 才能被呼叫。
當我們告訴編繹器不要使用標準的連結( LDFLAGS = -nostdlib -L${TARGET_PREFIX}/lib ),那我們必須明確地指定這些檔案到編譯參數中。例如
STARTUP_FILES = ${TARGET_PREFIX}/lib/crt1.o \
${TARGET_PREFIX}/lib/crti.o \
${PREFIX}/lib/gcc-lib/${TARGET}/2.95.3/crtbegin.o
END_FILES = ${PREFIX}/lib/gcc-lib/${TARGET}/2.95.3/crtend. \
${TARGET_PREFIX}/lib/crtn.o
LIBS = -lc
OBJS = daemon.o
LINKED_FILES = ${STARTUP_FILES} ${OBJS} ${LIBS} ${END_FILES}
...
daemon: ${OBJS}
$(CC) -o $(EXEC_NAME) ${LINKED_FILES} $(LDFLAGS)