shithub: scc

Download patch

ref: 4cd120c00e9285d5900c7e5a568f82ba6413cb7e
parent: 44f728861fa35ba070e36bb60c2694e7e979a37f
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Jun 1 01:27:41 EDT 2022

driver/posix: Pass -s to ld

Scc was spawning a strip program to strip the symbols
of al the objects generated. It is not required to do
that because -s usually affect only to the linked
executable and it simplifies the code.

--- a/src/cmd/cc/posix/cc.c
+++ b/src/cmd/cc/posix/cc.c
@@ -40,7 +40,6 @@
 	TEEAS,
 	AS,
 	LD,
-	STRIP,
 	LAST_TOOL,
 };
 
@@ -61,7 +60,6 @@
 	[TEEAS]  = {.bin = "tee",   .cmd = "tee"},
 	[AS]     = {.bin = "as",    .cmd = "as"},
 	[LD]     = {.bin = "ld",    .cmd = "ld"},
-	[STRIP]  = {.bin = "strip", .cmd = "strip"},
 };
 
 char *argv0;
@@ -201,6 +199,9 @@
 			addarg(tool, "-L");
 			addarg(tool, path(syslibs[n]));
 		}
+		if (sflag)
+			addarg(tool, "-s");
+
 		for (n = 0; syscrtsb[n]; ++n)
 			addarg(tool, path(syscrtsb[n]));
 		break;
@@ -285,14 +286,6 @@
 		t->outfile = xstrdup(objfile);
 		addarg(tool, t->outfile);
 		break;
-	case STRIP:
-		if (cflag || kflag) {
-			for (i = 0; i < objout.n; ++i)
-				addarg(tool, xstrdup(objout.s[i]));
-		}
-		if (!cflag && tools[LD].outfile)
-			addarg(tool, tools[LD].outfile);
-		break;
 	default:
 		break;
 	}
@@ -654,12 +647,8 @@
 		addarg(LD, xstrdup("-lcrt"));
 		for (n = 0; syscrtse[n]; ++n)
 			addarg(LD, path(syscrtse[n]));
-		spawn(settool(LD, NULL, LAST_TOOL));
-		validatetools();
-	}
 
-	if (sflag) {
-		spawn(settool(inittool(STRIP), NULL, LAST_TOOL));
+		spawn(settool(LD, NULL, LAST_TOOL));
 		validatetools();
 	}