summaryrefslogtreecommitdiff
path: root/Makeconfig
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-06-25 02:37:04 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-06-25 02:49:53 -0700
commitcc08749b2d1c68284b25b157fbbe1ff219495cae (patch)
tree0b0f104c2866770c1983e521184869f3829b40f6 /Makeconfig
parent45a8f0e6629d7772b9fa1aef0389bc51a094424d (diff)
downloadglibc-cc08749b2d1c68284b25b157fbbe1ff219495cae.tar.gz
Support compilers defaulting to PIE
To support building glibc with GCC 6 configured with --enable-default-pie, which generates PIE by default, we need to build programs as PIE. But elf/tst-dlopen-aout must not be built as PIE since it tests dlopen on ET_EXEC file and PIE is ET_DYN. [BZ #17841] * Makeconfig (no-pie-ldflag): New. (+link): Set to $(+link-pie) if default to PIE. (+link-tests): Set to $(+link-pie-tests) if default to PIE. * config.make.in (build-pie-default): New. * configure.ac (libc_cv_pie_default): New. Set to yes if -fPIE is default. AC_SUBST. * configure: Regenerated. * elf/Makefile (LDFLAGS-tst-dlopen-aout): New.
Diffstat (limited to 'Makeconfig')
-rw-r--r--Makeconfig6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makeconfig b/Makeconfig
index 0f4b5497c1..7b46323bd2 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -442,6 +442,11 @@ endif
# Commands for linking programs with the C library.
ifndef +link
ifeq (yes,$(build-shared))
+ifeq (yes,$(build-pie-default))
+no-pie-ldflag = -no-pie
++link = $(+link-pie)
++link-tests = $(+link-pie-tests)
+else
+link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
@@ -462,6 +467,7 @@ $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
$(+link-after-libc)
$(call after-link,$@)
endef
+endif
else
+link = $(+link-static)
+link-tests = $(+link-static-tests)