scc

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

commit 4cd120c00e9285d5900c7e5a568f82ba6413cb7e
parent 44f728861fa35ba070e36bb60c2694e7e979a37f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed,  1 Jun 2022 05:27:41 +0200

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.

Diffstat:
Msrc/cmd/cc/posix/cc.c | 19++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c @@ -40,7 +40,6 @@ enum { TEEAS, AS, LD, - STRIP, LAST_TOOL, }; @@ -61,7 +60,6 @@ static struct tool { [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 @@ inittool(int tool) 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 @@ settool(int tool, char *infile, int nexttool) 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 @@ operand: 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(); }