shithub: scc

Download patch

ref: 1db863722e91ee927e932eb6ba65637842e96098
parent: 129524453b2c951211118a818d4bf45c1bea840a
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Oct 6 10:24:32 EDT 2019

[scc] Add libcrt to the command line

Libcrt contains symbols that are needed by the other objects,
so it must go at the end of the command line.

--- a/src/cmd/cc/posix/scc.c
+++ b/src/cmd/cc/posix/scc.c
@@ -152,16 +152,6 @@
 				addarg(tool, syscrts[n]);
 			break;
 		}
-		n = snprintf(NULL, 0,
-		             "%s/lib/scc/%s-%s-%s/crt.o",
-		             prefix, arch, abi, sys);
-		if (n < 0)
-			die("scc: wrong crt file name");
-		crt = xmalloc(++n);
-		sprintf(crt,
-		        "%s/lib/scc/%s-%s-%s/crt.o",
-		        prefix, arch, abi, sys);
-		addarg(tool, crt);
 		break;
 	case AS:
 		addarg(tool, "-o");
@@ -613,6 +603,7 @@
 
 	if (link && !failure) {
 		addarg(LD, xstrdup("-lc"));
+		addarg(LD, xstrdup("-lcrt"));
 		spawn(settool(LD, NULL, LAST_TOOL));
 		validatetools();
 	}