scc

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

commit 9e9a2ce8223a9ad29cb1c4eb1b9aa09cc2db32ad
parent b04982f0e88be2575b99a53e9780a85fb0befa65
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 10 Mar 2022 13:08:03 +0100

build: Avoid using nopie when it is not needed

OpenBSD needs a nopie option for linking, but the same
option with other system can produce some problems.
For this reason is better to use no option by
default.

Diffstat:
Minclude/scc/scc/Makefile | 3++-
Mscripts/build/tool/gnu.mk | 1-
Msrc/cmd/cc/posix/cc.c | 6++----
3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/scc/scc/Makefile b/include/scc/scc/Makefile @@ -21,7 +21,8 @@ ldflags.h: set -e;\ rm -f $@;\ trap "rm -f $$$$.tmp" INT QUIT TERM HUP;\ - sed 's/%NOPIE%/"$(NOPIE_LDFLAGS)",/' ldflags.def.h > $$$$.tmp && \ + sed 's/%NOPIE%/"$(NOPIE_LDFLAGS)",/' ldflags.def.h | \ + sed 's/"",//' > $$$$.tmp && \ mv $$$$.tmp $@ syscrts.h: diff --git a/scripts/build/tool/gnu.mk b/scripts/build/tool/gnu.mk @@ -7,6 +7,5 @@ PRECOMP = cpp ARCHIVE_FLAGS = -U NOPIE_CFLAGS = -fno-pie -NOPIE_LDFLAGS = -nopie TOOL_CFLAGS = -std=c99 -fno-stack-protector -static TOOL_LIBC_CFLAGS = -ffreestanding diff --git a/src/cmd/cc/posix/cc.c b/src/cmd/cc/posix/cc.c @@ -192,10 +192,8 @@ inittool(int tool) die("cc: target tool path is too long"); break; case LD: - for (n = 0; ldflags[n]; ++n) { - if (ldflags[n][0] != '\n') - addarg(tool, ldflags[n]); - } + for (n = 0; ldflags[n]; ++n) + addarg(tool, ldflags[n]); addarg(tool, "-o"); t->outfile = outfile ? outfile : xstrdup("a.out"); addarg(tool, t->outfile);