scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 44f728861fa35ba070e36bb60c2694e7e979a37f
parent a8cd756a8912fe2a544d67110ecbdb28a343bc95
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 30 May 2022 19:18:53 +0200

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.

Diffstat:
Minclude/scc/scc/syscrts.def.h | 6+++++-
Msrc/cmd/cc/posix/cc.c | 8+++++---
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git 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 +}; diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c @@ -201,8 +201,8 @@ inittool(int tool) 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 @@ int main(int argc, char *argv[]) { struct items linkchain = { .n = 0, }; - int link; + int link, n; atexit(terminate); @@ -652,6 +652,8 @@ operand: 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(); }