f34ecf
From e84d6f25015d36202fd524b8b8d85d2324348ddb Mon Sep 17 00:00:00 2001
f34ecf
From: Adam Jackson <ajax@redhat.com>
f34ecf
Date: Mon, 19 Nov 2018 11:27:09 -0500
f34ecf
Subject: [PATCH] link with -z now
f34ecf
f34ecf
Signed-off-by: Adam Jackson <ajax@redhat.com>
f34ecf
---
f34ecf
 hw/dmx/Makefile.am               | 2 +-
f34ecf
 hw/kdrive/ephyr/Makefile.am      | 2 +-
f34ecf
 hw/vfb/Makefile.am               | 2 +-
f34ecf
 hw/xfree86/Makefile.am           | 3 ++-
f34ecf
 hw/xfree86/dixmods/Makefile.am   | 6 +++---
f34ecf
 hw/xfree86/exa/Makefile.am       | 2 +-
f34ecf
 hw/xfree86/fbdevhw/Makefile.am   | 2 +-
f34ecf
 hw/xfree86/int10/Makefile.am     | 2 +-
f34ecf
 hw/xfree86/shadowfb/Makefile.am  | 2 +-
f34ecf
 hw/xfree86/utils/cvt/Makefile.am | 1 +
f34ecf
 hw/xfree86/utils/gtf/Makefile.am | 1 +
f34ecf
 hw/xfree86/vgahw/Makefile.am     | 2 +-
f34ecf
 hw/xnest/Makefile.am             | 2 +-
f34ecf
 hw/xwayland/Makefile.am          | 2 +-
f34ecf
 14 files changed, 17 insertions(+), 14 deletions(-)
f34ecf
f34ecf
diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
f34ecf
index eef84cb..9ab20cc 100644
f34ecf
--- a/hw/dmx/Makefile.am
f34ecf
+++ b/hw/dmx/Makefile.am
f34ecf
@@ -78,7 +78,7 @@ XDMX_LIBS = \
f34ecf
         input/libdmxinput.a \
f34ecf
         config/libdmxconfig.a
f34ecf
 
f34ecf
-Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
f34ecf
+Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -Wl,-z,now -pie
f34ecf
 Xdmx_DEPENDENCIES= $(XDMX_LIBS)
f34ecf
 Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS)
f34ecf
 
f34ecf
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
f34ecf
index d12559b..cc37add 100644
f34ecf
--- a/hw/kdrive/ephyr/Makefile.am
f34ecf
+++ b/hw/kdrive/ephyr/Makefile.am
f34ecf
@@ -78,7 +78,7 @@ Xephyr_LDADD = 						\
f34ecf
 
f34ecf
 Xephyr_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@ $(XEPHYR_GLAMOR_LIB)
f34ecf
 
f34ecf
-Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
f34ecf
+Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -W,-z,now -pie
f34ecf
 
f34ecf
 relink:
f34ecf
 	$(AM_V_at)rm -f $(bin_PROGRAMS) && $(MAKE) $(bin_PROGRAMS)
f34ecf
diff --git a/hw/vfb/Makefile.am b/hw/vfb/Makefile.am
f34ecf
index 7033397..c09a9c9 100644
f34ecf
--- a/hw/vfb/Makefile.am
f34ecf
+++ b/hw/vfb/Makefile.am
f34ecf
@@ -20,7 +20,7 @@ XVFB_LIBS = \
f34ecf
 
f34ecf
 Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS)
f34ecf
 Xvfb_DEPENDENCIES = $(XVFB_LIBS)
f34ecf
-Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
f34ecf
+Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -Wl,-z,now -pie
f34ecf
 
f34ecf
 relink:
f34ecf
 	$(AM_V_at)rm -f Xvfb$(EXEEXT) && $(MAKE) Xvfb$(EXEEXT)
f34ecf
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
f34ecf
index 32f98b5..5955148 100644
f34ecf
--- a/hw/xfree86/Makefile.am
f34ecf
+++ b/hw/xfree86/Makefile.am
f34ecf
@@ -78,12 +78,13 @@ Xorg_LDADD = \
f34ecf
             $(XSERVER_SYS_LIBS)
f34ecf
 Xorg_DEPENDENCIES = $(LOCAL_LIBS)
f34ecf
 
f34ecf
-Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
f34ecf
+Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -Wl,-z,now -pie
f34ecf
 
f34ecf
 if SUID_WRAPPER
f34ecf
 wrapexecdir = $(SUID_WRAPPER_DIR)
f34ecf
 wrapexec_PROGRAMS = Xorg.wrap
f34ecf
 Xorg_wrap_SOURCES = xorg-wrapper.c
f34ecf
+Xorg_wrap_LDFLAGS = -Wl,-z,now -pie
f34ecf
 endif
f34ecf
 
f34ecf
 BUILT_SOURCES = xorg.conf.example
f34ecf
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
f34ecf
index 856659f..6ab101b 100644
f34ecf
--- a/hw/xfree86/dixmods/Makefile.am
f34ecf
+++ b/hw/xfree86/dixmods/Makefile.am
f34ecf
@@ -17,17 +17,17 @@ AM_CPPFLAGS = @XORG_INCS@ \
f34ecf
            -I$(top_srcdir)/miext/shadow \
f34ecf
            -I$(top_srcdir)/glx
f34ecf
 
f34ecf
-libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
f34ecf
+libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -Wl,-z,now
f34ecf
 libfb_la_LIBADD = $(top_builddir)/fb/libfb.la
f34ecf
 libfb_la_SOURCES = fbmodule.c
f34ecf
 libfb_la_CFLAGS = $(AM_CFLAGS)
f34ecf
 
f34ecf
-libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
f34ecf
+libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -Wl,-z,now
f34ecf
 libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la
f34ecf
 libwfb_la_SOURCES = fbmodule.c
f34ecf
 libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
f34ecf
 
f34ecf
-libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
f34ecf
+libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -Wl,-z,now
f34ecf
 libglx_la_LIBADD = $(top_builddir)/glx/libglx.la $(GLX_SYS_LIBS)
f34ecf
 if DRI2
f34ecf
 libglx_la_LIBADD += $(top_builddir)/glx/libglxdri.la
f34ecf
diff --git a/hw/xfree86/exa/Makefile.am b/hw/xfree86/exa/Makefile.am
f34ecf
index ccbb305..7bf7137 100644
f34ecf
--- a/hw/xfree86/exa/Makefile.am
f34ecf
+++ b/hw/xfree86/exa/Makefile.am
f34ecf
@@ -2,7 +2,7 @@ SUBDIRS = man
f34ecf
 
f34ecf
 module_LTLIBRARIES = libexa.la
f34ecf
 
f34ecf
-libexa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
f34ecf
+libexa_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -Wl,-z,now
f34ecf
 
f34ecf
 AM_CPPFLAGS = \
f34ecf
 	$(XORG_INCS) \
f34ecf
diff --git a/hw/xfree86/fbdevhw/Makefile.am b/hw/xfree86/fbdevhw/Makefile.am
f34ecf
index 37cd88c..895cfab 100644
f34ecf
--- a/hw/xfree86/fbdevhw/Makefile.am
f34ecf
+++ b/hw/xfree86/fbdevhw/Makefile.am
f34ecf
@@ -2,7 +2,7 @@ SUBDIRS = man
f34ecf
 
f34ecf
 module_LTLIBRARIES = libfbdevhw.la
f34ecf
 
f34ecf
-libfbdevhw_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
f34ecf
+libfbdevhw_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -Wl,-z,now
f34ecf
 
f34ecf
 if FBDEVHW
f34ecf
 libfbdevhw_la_SOURCES = fbdevhw.c
f34ecf
diff --git a/hw/xfree86/int10/Makefile.am b/hw/xfree86/int10/Makefile.am
f34ecf
index 66cb14d..aad47a1 100644
f34ecf
--- a/hw/xfree86/int10/Makefile.am
f34ecf
+++ b/hw/xfree86/int10/Makefile.am
f34ecf
@@ -4,7 +4,7 @@ sdk_HEADERS = xf86int10.h
f34ecf
 
f34ecf
 EXTRA_CFLAGS =
f34ecf
 
f34ecf
-libint10_la_LDFLAGS = -avoid-version
f34ecf
+libint10_la_LDFLAGS = -avoid-version -Wl,-z,now
f34ecf
 libint10_la_LIBADD = $(PCIACCESS_LIBS)
f34ecf
 
f34ecf
 COMMON_SOURCES = \
f34ecf
diff --git a/hw/xfree86/shadowfb/Makefile.am b/hw/xfree86/shadowfb/Makefile.am
f34ecf
index 67fb2e4..a8c2d59 100644
f34ecf
--- a/hw/xfree86/shadowfb/Makefile.am
f34ecf
+++ b/hw/xfree86/shadowfb/Makefile.am
f34ecf
@@ -1,5 +1,5 @@
f34ecf
 module_LTLIBRARIES = libshadowfb.la
f34ecf
-libshadowfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
f34ecf
+libshadowfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -Wl,-z,now
f34ecf
 libshadowfb_la_SOURCES = sfbmodule.c shadowfb.c
f34ecf
 libshadowfb_la_LIBADD = $(PIXMAN_LIBS)
f34ecf
 
f34ecf
diff --git a/hw/xfree86/utils/cvt/Makefile.am b/hw/xfree86/utils/cvt/Makefile.am
f34ecf
index 26abeb4..19b0eba 100644
f34ecf
--- a/hw/xfree86/utils/cvt/Makefile.am
f34ecf
+++ b/hw/xfree86/utils/cvt/Makefile.am
f34ecf
@@ -33,3 +33,4 @@ cvt_SOURCES = cvt.c \
f34ecf
 	$(top_srcdir)/os/xprintf.c
f34ecf
 
f34ecf
 cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
f34ecf
+cvt_LDFLAGS = -Wl,-z,now -pie
f34ecf
diff --git a/hw/xfree86/utils/gtf/Makefile.am b/hw/xfree86/utils/gtf/Makefile.am
f34ecf
index f77bf60..f520fb9 100644
f34ecf
--- a/hw/xfree86/utils/gtf/Makefile.am
f34ecf
+++ b/hw/xfree86/utils/gtf/Makefile.am
f34ecf
@@ -25,3 +25,4 @@ bin_PROGRAMS = gtf
f34ecf
 gtf_SOURCES = gtf.c
f34ecf
 gtf_CFLAGS = $(XORG_CFLAGS)
f34ecf
 gtf_LDADD = -lm
f34ecf
+gtf_LDFLAGS = -Wl,-z,now -pie
f34ecf
diff --git a/hw/xfree86/vgahw/Makefile.am b/hw/xfree86/vgahw/Makefile.am
f34ecf
index b8196a6..37ac499 100644
f34ecf
--- a/hw/xfree86/vgahw/Makefile.am
f34ecf
+++ b/hw/xfree86/vgahw/Makefile.am
f34ecf
@@ -1,5 +1,5 @@
f34ecf
 module_LTLIBRARIES = libvgahw.la
f34ecf
-libvgahw_la_LDFLAGS = -avoid-version
f34ecf
+libvgahw_la_LDFLAGS = -avoid-version -Wl,-z,now
f34ecf
 libvgahw_la_LIBADD = $(PCIACCESS_LIBS)
f34ecf
 libvgahw_la_SOURCES = vgaHW.c vgaHWmodule.c
f34ecf
 AM_CPPFLAGS = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c
f34ecf
diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am
f34ecf
index c77da64..185803c 100644
f34ecf
--- a/hw/xnest/Makefile.am
f34ecf
+++ b/hw/xnest/Makefile.am
f34ecf
@@ -51,7 +51,7 @@ Xnest_SOURCES = $(SRCS)
f34ecf
 
f34ecf
 Xnest_DEPENDENCIES = $(XNEST_LIBS)
f34ecf
 Xnest_LDADD = $(XNEST_LIBS) $(XNEST_SYS_LIBS) $(XSERVER_SYS_LIBS)
f34ecf
-Xnest_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
f34ecf
+Xnest_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -Wl,-z,now -pie
f34ecf
 
f34ecf
 EXTRA_DIST = icon \
f34ecf
              screensaver
f34ecf
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
f34ecf
index bc1cb85..2f70cd1 100644
f34ecf
--- a/hw/xwayland/Makefile.am
f34ecf
+++ b/hw/xwayland/Makefile.am
f34ecf
@@ -28,7 +28,7 @@ Xwayland_LDADD =				\
f34ecf
 	$(XWAYLAND_SYS_LIBS)			\
f34ecf
 	$(top_builddir)/Xext/libXvidmode.la	\
f34ecf
 	$(XSERVER_SYS_LIBS)
f34ecf
-Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
f34ecf
+Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -Wl,-z,now -pie
f34ecf
 
f34ecf
 Xwayland_built_sources =
f34ecf
 
f34ecf
-- 
f34ecf
2.19.1
f34ecf