ref: 44f728861fa35ba070e36bb60c2694e7e979a37f
parent: a8cd756a8912fe2a544d67110ecbdb28a343bc95
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon May 30 15:18:53 EDT 2022
driver/posix: Add support for crt begin and crt end Some systems need a set of crt files to be added at the beginning of the link stage and other set at the end. Currently scc only supported a set of crts files at the beginning of the link stage.
--- a/include/scc/scc/syscrts.def.h
+++ b/include/scc/scc/syscrts.def.h
@@ -1,5 +1,9 @@
/* configure below your system crts */
-char *syscrts[] = {
+char *syscrtsb[] = {
"%p/lib/scc/%a-%s/crt.o",
+ NULL
+};
+
+char *syscrtse[] = {
NULL
};
--- a/src/cmd/cc/posix/cc.c
+++ b/src/cmd/cc/posix/cc.c
@@ -201,8 +201,8 @@
addarg(tool, "-L");
addarg(tool, path(syslibs[n]));
}
- for (n = 0; syscrts[n]; ++n)
- addarg(tool, path(syscrts[n]));
+ for (n = 0; syscrtsb[n]; ++n)
+ addarg(tool, path(syscrtsb[n]));
break;
case AS:
addarg(tool, "-o");
@@ -525,7 +525,7 @@
main(int argc, char *argv[])
{
struct items linkchain = { .n = 0, };
- int link;
+ int link, n;
atexit(terminate);
@@ -652,6 +652,8 @@
if (link && !failure) {
addarg(LD, xstrdup("-lc"));
addarg(LD, xstrdup("-lcrt"));
+ for (n = 0; syscrtse[n]; ++n)
+ addarg(LD, path(syscrtse[n]));
spawn(settool(LD, NULL, LAST_TOOL));
validatetools();
}