From da62f81bdd23bb5095cd54c0b34ae6d5a93df69e Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 13 May 2011 23:31:43 -0400 Subject: Add support for generated PIE link rules --- Rules | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'Rules') diff --git a/Rules b/Rules index 5ace24cee0..00f03df6da 100644 --- a/Rules +++ b/Rules @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2000,2002,2003,2004,2005,2006 +# Copyright (C) 1991-2000,2002,2003,2004,2005,2006,2011 # Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -106,12 +106,19 @@ endif ifeq ($(build-programs),yes) binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs) binaries-static = $(others-static) $(tests-static) $(xtests-static) +ifeq (yesyes,$(have-fpie)$(build-shared)) +binaries-pie = $(others-pie) $(tests-pie) $(xtests-pie) +else +binaries-pie = +endif else binaries-all = $(tests) $(xtests) $(test-srcs) binaries-static = +binaries-pie = endif -binaries-shared = $(filter-out $(binaries-static), $(binaries-all)) +binaries-shared = $(filter-out $(binaries-pie) $(binaries-static), \ + $(binaries-all)) ifneq "$(strip $(binaries-shared))" "" $(addprefix $(objpfx),$(binaries-shared)): %: %.o \ @@ -120,6 +127,13 @@ $(addprefix $(objpfx),$(binaries-shared)): %: %.o \ $(+link) endif +ifneq "$(strip $(binaries-pie))" "" +$(addprefix $(objpfx),$(binaries-pie)): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link-pie) +endif + ifneq "$(strip $(binaries-static))" "" $(addprefix $(objpfx),$(binaries-static)): %: %.o \ $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \ -- cgit v1.2.1