about summary refs log tree commit diff
path: root/Makeconfig
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2009-06-16 09:19:59 -0700
committerUlrich Drepper <drepper@redhat.com>2009-06-16 09:19:59 -0700
commit435aa54b3b9c1c87498e8bb3831394fd42220fa7 (patch)
treeb5de40c20afead258bbae697c625f86330c7ec52 /Makeconfig
parent25bfbb9e0e610afaf6b67e5ee1a1a5338018c42e (diff)
downloadglibc-435aa54b3b9c1c87498e8bb3831394fd42220fa7.tar.gz
glibc-435aa54b3b9c1c87498e8bb3831394fd42220fa7.tar.xz
glibc-435aa54b3b9c1c87498e8bb3831394fd42220fa7.zip
Consolidate PIE linking Makefile rules.
Diffstat (limited to 'Makeconfig')
-rw-r--r--Makeconfig16
1 files changed, 16 insertions, 0 deletions
diff --git a/Makeconfig b/Makeconfig
index 875fb679aa..9f134cc137 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -434,6 +434,19 @@ ifndef +link
 			   $(common-objpfx)libc% $(+postinit),$^) \
 	      $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
 endif
+# Command for linking PIE programs with the C library.
+ifndef +link-pie
++link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
+	     $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+	     $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
+	     $(addprefix $(csu-objpfx),S$(start-installed-name)) \
+	     $(+preinit) $(+prectorS) \
+	     $(filter-out $(addprefix $(csu-objpfx),start.o \
+	     S$(start-installed-name))\
+	     $(+preinit) $(link-extra-libs) \
+	     $(common-objpfx)libc% $(+postinit),$^) \
+	     $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
+endif
 # Command for statically linking programs with the C library.
 ifndef +link-static
 +link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
@@ -538,6 +551,9 @@ ifeq ($(elf),yes)
 +postinit = $(addprefix $(csu-objpfx),crtn.o)
 +prector = `$(CC) --print-file-name=crtbegin.o`
 +postctor = `$(CC) --print-file-name=crtend.o`
+# Variants of the two previous definitions for linking PIE programs.
++prectorS = `$(CC) --print-file-name=crtbeginS.o`
++postctorS = `$(CC) --print-file-name=crtendS.o`
 +interp = $(addprefix $(elf-objpfx),interp.os)
 endif
 csu-objpfx = $(common-objpfx)csu/