ref: d47bc8e5d2a7ad460b7cd2f6028ddf79b22049f9
parent: 186e05bb5830df614015417a929d44db151af1e9
author: Quentin Rameau <quinq@fifth.space>
date: Wed Feb 21 13:00:16 EST 2018
Let the user configure system crts
--- a/driver/posix/Makefile
+++ b/driver/posix/Makefile
@@ -9,6 +9,7 @@
HDR = config.h \
$(PROJECTDIR)/inc/scc.h \
$(PROJECTDIR)/inc/arg.h \
+ $(PROJECTDIR)/inc/syscrts.h \
$(PROJECTDIR)/inc/sysincludes.h \
$(PROJECTDIR)/inc/syslibs.h \
$(PROJECTDIR)/inc/ldflags.h
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -16,6 +16,7 @@
#include "config.h"
#include "../../inc/arg.h"
#include "../../inc/scc.h"
+#include "../../inc/syscrts.h"
#include "../../inc/sysincludes.h"
#include "../../inc/syslibs.h"
#include "../../inc/ldflags.h"
@@ -143,6 +144,11 @@
for (n = 0; syslibs[n]; ++n) {
addarg(tool, "-L");
addarg(tool, syslibs[n]);
+ }
+ if (syscrts[0]) {
+ for (n = 0; syscrts[n]; ++n)
+ addarg(tool, syscrts[n]);
+ break;
}
n = snprintf(NULL, 0,
"%s/lib/scc/crt/%s-%s-%s/crt.o",
--- a/inc/Makefile
+++ b/inc/Makefile
@@ -4,7 +4,7 @@
include $(PROJECTDIR)/rules.mk
-HDR = ldflags.h sysincludes.h syslibs.h
+HDR = ldflags.h syscrts.h sysincludes.h syslibs.h
all:
@@ -14,6 +14,12 @@
rm -f $@ ; \
trap "rm -f $$$$.h" 0 2 3; \
cat < ldflags.def.h > $$$$.h; \
+ mv $$$$.h $@
+
+syscrts.h:
+ rm -f $@ ; \
+ trap "rm -f $$$$.h" 0 2 3; \
+ sed 's,PREFIX,"$(PREFIX)",g' < syscrts.def.h > $$$$.h && \
mv $$$$.h $@
sysincludes.h:
--- /dev/null
+++ b/inc/syscrts.def.h
@@ -1,0 +1,5 @@
+char *syscrts[] = {
+ /* configure below your system crts */
+ /* PREFIX "/lib/scc/crt0.o", */
+ NULL
+};