From 6974faf4a19b46280b7b683f7356aeda430eb69e Mon Sep 17 00:00:00 2001 From: Boian Bonev Date: Tue, 13 Oct 2020 04:14:04 +0300 Subject: [PATCH] build as position independent executable --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 38db280..f451ba4 100644 --- a/Makefile +++ b/Makefile @@ -36,14 +36,14 @@ ifeq ($(CC),tcc) CCOPT:=-Wall -I. else ifeq ($(CC),clang) -CCOPT:=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -I. --std=gnu89 +CCOPT:=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -I. --std=gnu89 -fPIE else ifeq ($(shell uname -s),OpenBSD) ifeq ($(CC),cc) CC:=egcc endif endif -CCOPT:=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -I. --std=gnu89 +CCOPT:=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -I. --std=gnu89 -fPIE endif endif ifeq ($(CC),egcc) @@ -61,7 +61,7 @@ endif endif MYCFLAGS=$(DEBUG) $(CPPFLAGS) $(CFLAGS) $(CCOPT) -MYLDFLAGS=$(LDFLAGS) +MYLDFLAGS=$(LDFLAGS) -fPIE -pie STRIP?=strip