[lvm-devel] master - makefiles: fix linking of PIE code

Zdenek Kabelac zkabelac at fedoraproject.org
Thu Sep 18 16:18:48 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b72e9d3a933fd72eb4c08f13f5a3d3a7259a7741
Commit:        b72e9d3a933fd72eb4c08f13f5a3d3a7259a7741
Parent:        d450c7fb102652985a7271f3ea76ed72235060e7
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Thu Sep 18 18:14:21 2014 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Thu Sep 18 18:14:21 2014 +0200

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 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/make.tmpl.in b/make.tmpl.in
index 7a178ad..7efe46b 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




More information about the lvm-devel mailing list