ref: b1d89be9c61f4ab4c470dc480077fc90a00c4294
parent: 349ceccbc07453503347623eea9476c815473d01
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Mar 10 08:08:03 EST 2022
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.
--- a/include/scc/scc/Makefile
+++ b/include/scc/scc/Makefile
@@ -21,7 +21,8 @@
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:
--- a/scripts/build/tool/gnu.mk
+++ b/scripts/build/tool/gnu.mk
@@ -7,6 +7,5 @@
ARCHIVE_FLAGS = -U
NOPIE_CFLAGS = -fno-pie
-NOPIE_LDFLAGS = -nopie
TOOL_CFLAGS = -std=c99 -fno-stack-protector -static
TOOL_LIBC_CFLAGS = -ffreestanding
--- a/src/cmd/cc/posix/cc.c
+++ b/src/cmd/cc/posix/cc.c
@@ -192,10 +192,8 @@
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);