about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--Makeconfig6
-rw-r--r--NEWS22
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure21
-rw-r--r--configure.ac13
-rw-r--r--elf/Makefile1
7 files changed, 65 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index f9cf634a44..7fe8b82196 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2015-06-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[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.
+
 2015-06-24  Roland McGrath  <roland@hack.frob.com>
 
 	* nptl/descr.h (struct pthread): Change type of field setxid_futex
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)
diff --git a/NEWS b/NEWS
index 727e21f770..58f85e79bb 100644
--- a/NEWS
+++ b/NEWS
@@ -14,17 +14,17 @@ Version 2.22
   16526, 16538, 16560, 16704, 16783, 16850, 17053, 17090, 17195, 17269,
   17293, 17322, 17403, 17523, 17542, 17569, 17581, 17588, 17596, 17620,
   17621, 17628, 17631, 17692, 17711, 17715, 17776, 17779, 17792, 17836,
-  17912, 17916, 17930, 17932, 17944, 17949, 17964, 17965, 17967, 17969,
-  17977, 17978, 17987, 17991, 17996, 17998, 17999, 18007, 18019, 18020,
-  18029, 18030, 18032, 18034, 18036, 18038, 18039, 18042, 18043, 18046,
-  18047, 18049, 18068, 18080, 18093, 18100, 18104, 18110, 18111, 18116,
-  18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210, 18211, 18217,
-  18219, 18220, 18221, 18234, 18244, 18245, 18247, 18287, 18319, 18324,
-  18333, 18346, 18371, 18397, 18409, 18410, 18412, 18418, 18422, 18434,
-  18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498,
-  18507, 18512, 18513, 18519, 18520, 18522, 18527, 18528, 18529, 18530,
-  18532, 18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545, 18546,
-  18547, 18553, 18558, 18569, 18583, 18585, 18586, 18593, 18594.
+  17841, 17912, 17916, 17930, 17932, 17944, 17949, 17964, 17965, 17967,
+  17969, 17977, 17978, 17987, 17991, 17996, 17998, 17999, 18007, 18019,
+  18020, 18029, 18030, 18032, 18034, 18036, 18038, 18039, 18042, 18043,
+  18046, 18047, 18049, 18068, 18080, 18093, 18100, 18104, 18110, 18111,
+  18116, 18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210, 18211,
+  18217, 18219, 18220, 18221, 18234, 18244, 18245, 18247, 18287, 18319,
+  18324, 18333, 18346, 18371, 18397, 18409, 18410, 18412, 18418, 18422,
+  18434, 18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497,
+  18498, 18507, 18512, 18513, 18519, 18520, 18522, 18527, 18528, 18529,
+  18530, 18532, 18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545,
+  18546, 18547, 18553, 18558, 18569, 18583, 18585, 18586, 18593, 18594.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
diff --git a/config.make.in b/config.make.in
index 5a18daed24..a9f5696077 100644
--- a/config.make.in
+++ b/config.make.in
@@ -82,6 +82,7 @@ nss-crypt = @libc_cv_nss_crypt@
 # Configuration options.
 build-shared = @shared@
 build-pic-default= @libc_cv_pic_default@
+build-pie-default= @libc_cv_pie_default@
 build-profile = @profile@
 build-static-nss = @static_nss@
 add-ons = @add_ons@
diff --git a/configure b/configure
index 1e4138b524..45cc7cba2b 100755
--- a/configure
+++ b/configure
@@ -596,6 +596,7 @@ mach_interface_list
 DEFINES
 static_nss
 profile
+libc_cv_pie_default
 libc_cv_pic_default
 shared
 static
@@ -7317,6 +7318,26 @@ fi
 $as_echo "$libc_cv_pic_default" >&6; }
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIE is default" >&5
+$as_echo_n "checking whether -fPIE is default... " >&6; }
+if ${libc_cv_pie_default+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  libc_cv_pie_default=yes
+cat > conftest.c <<EOF
+#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
+# error PIE is default.
+#endif
+EOF
+if eval "${CC-cc} -S conftest.c 2>&5 1>&5"; then
+  libc_cv_pie_default=no
+fi
+rm -f conftest.*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_pie_default" >&5
+$as_echo "$libc_cv_pie_default" >&6; }
+
+
 
 
 
diff --git a/configure.ac b/configure.ac
index ff66b875e3..7e9383a7f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2075,6 +2075,19 @@ fi
 rm -f conftest.*])
 AC_SUBST(libc_cv_pic_default)
 
+AC_CACHE_CHECK([whether -fPIE is default], libc_cv_pie_default,
+[libc_cv_pie_default=yes
+cat > conftest.c <<EOF
+#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
+# error PIE is default.
+#endif
+EOF
+if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
+  libc_cv_pie_default=no
+fi
+rm -f conftest.*])
+AC_SUBST(libc_cv_pie_default)
+
 AC_SUBST(profile)
 AC_SUBST(static_nss)
 
diff --git a/elf/Makefile b/elf/Makefile
index 4ea3ccf441..f21276c006 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -151,6 +151,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
 #	 reldep9
 ifeq ($(build-hardcoded-path-in-tests),yes)
 tests += tst-dlopen-aout
+LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
 endif
 test-srcs = tst-pathopt
 selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)