From b72e9d3a933fd72eb4c08f13f5a3d3a7259a7741 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 18 Sep 2014 18:14:21 +0200 Subject: [PATCH] makefiles: fix linking of PIE code PIE documentation: : https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html http://lfs.osuosl.org/hlfs/view/unstable/glibc/chapter02/pie.html suggest to suply -fPIE (or -fpie) with -pie during executable compilation. When -fPIC and -fPIE are used together - -fPIE wins Drop usage of -DPIE - we are not using this flag anywhere TODO: cleanup linking flags --- make.tmpl.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make.tmpl.in b/make.tmpl.in index 7a178ad02..7efe46b9c 100644 --- a/make.tmpl.in +++ b/make.tmpl.in @@ -158,8 +158,8 @@ endif ifneq ("@STATIC_LINK@", "yes") ifeq ("@HAVE_PIE@", "yes") ifeq ("@HAVE_FULL_RELRO@", "yes") - EXTRA_EXEC_CFLAGS += -fPIE -DPIE - EXTRA_EXEC_LDFLAGS += -Wl,-z,relro,-z,now -pie + EXTRA_EXEC_CFLAGS += -fPIE + EXTRA_EXEC_LDFLAGS += -Wl,-z,relro,-z,now -pie -fPIE CLDFLAGS += -Wl,-z,relro endif endif