Skip to content

Commit 6974faf

Browse files
committed
build as position independent executable
1 parent 2e5f466 commit 6974faf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ ifeq ($(CC),tcc)
3636
CCOPT:=-Wall -I.
3737
else
3838
ifeq ($(CC),clang)
39-
CCOPT:=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -I. --std=gnu89
39+
CCOPT:=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -I. --std=gnu89 -fPIE
4040
else
4141
ifeq ($(shell uname -s),OpenBSD)
4242
ifeq ($(CC),cc)
4343
CC:=egcc
4444
endif
4545
endif
46-
CCOPT:=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -I. --std=gnu89
46+
CCOPT:=-Wall -Wextra -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -I. --std=gnu89 -fPIE
4747
endif
4848
endif
4949
ifeq ($(CC),egcc)
@@ -61,7 +61,7 @@ endif
6161
endif
6262

6363
MYCFLAGS=$(DEBUG) $(CPPFLAGS) $(CFLAGS) $(CCOPT)
64-
MYLDFLAGS=$(LDFLAGS)
64+
MYLDFLAGS=$(LDFLAGS) -fPIE -pie
6565

6666
STRIP?=strip
6767

0 commit comments

Comments
 (0)