This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/pr17841/2.21 created. glibc-2.21-5-g9b1d32c
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 6 Mar 2015 23:55:34 -0000
- Subject: GNU C Library master sources branch hjl/pr17841/2.21 created. glibc-2.21-5-g9b1d32c
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/pr17841/2.21 has been created
at 9b1d32c794fe86f21fb534b8f808702b286c5059 (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9b1d32c794fe86f21fb534b8f808702b286c5059
commit 9b1d32c794fe86f21fb534b8f808702b286c5059
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Mar 6 04:55:56 2015 -0800
Replace __attribute__((visibility("protected")))
With copy relocation, address of protected data defined in the shared
library may be external. Compiler shouldn't asssume protected data will
be local. But due to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
__attribute__((visibility("protected"))) doesn't work correctly, we need
to use asm (".protected xxx") instead.
* elf/ifuncdep2.c (global): Replace
__attribute__((visibility("protected"))) with
asm (".protected global").
* elf/ifuncmod1.c (global): Likewise.
* elf/ifuncmod5.c (global): Likewise.
diff --git a/elf/ifuncdep2.c b/elf/ifuncdep2.c
index 99d1926..6e66d31 100644
--- a/elf/ifuncdep2.c
+++ b/elf/ifuncdep2.c
@@ -2,7 +2,13 @@
#include "ifunc-sel.h"
-int global __attribute__ ((visibility ("protected"))) = -1;
+int global = -1;
+/* Can't use __attribute__((visibility("protected"))) until the GCC bug:
+
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
+
+ is fixed. */
+asm (".protected global");
static int
one (void)
diff --git a/elf/ifuncmod1.c b/elf/ifuncmod1.c
index 2b8195c..0b61380 100644
--- a/elf/ifuncmod1.c
+++ b/elf/ifuncmod1.c
@@ -6,7 +6,13 @@
*/
#include "ifunc-sel.h"
-int global __attribute__ ((visibility ("protected"))) = -1;
+int global = -1;
+/* Can't use __attribute__((visibility("protected"))) until the GCC bug:
+
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
+
+ is fixed. */
+asm (".protected global");
static int
one (void)
diff --git a/elf/ifuncmod5.c b/elf/ifuncmod5.c
index 9a08e8c..0e65a63 100644
--- a/elf/ifuncmod5.c
+++ b/elf/ifuncmod5.c
@@ -1,7 +1,13 @@
/* Test STT_GNU_IFUNC symbols without direct function call. */
#include "ifunc-sel.h"
-int global __attribute__ ((visibility ("protected"))) = -1;
+int global = -1;
+/* Can't use __attribute__((visibility("protected"))) until the GCC bug:
+
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
+
+ is fixed. */
+asm (".protected global");
static int
one (void)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=420da75f11fcee9aef3bd1a39302449af91f571b
commit 420da75f11fcee9aef3bd1a39302449af91f571b
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Jan 14 06:29:04 2015 -0800
Support compilers defaulting to PIE
If PIE is the default, we need to build programs as PIE.
[BZ #17841]
* Makeconfig (+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.
diff --git a/Makeconfig b/Makeconfig
index 751e9ff..9bd0db3 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -425,6 +425,10 @@ endif
# Commands for linking programs with the C library.
ifndef +link
ifeq (yes,$(build-shared))
+ifeq (yes,$(build-pie-default))
++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) \
@@ -440,6 +444,7 @@ ifeq (yes,$(build-shared))
$(+link-after-libc)
+link-tests = $(+link-before-libc) $(rtld-tests-LDFLAGS) \
$(link-libc-tests) $(+link-after-libc)
+endif
else
+link = $(+link-static)
+link-tests = $(+link-static-tests)
diff --git a/config.make.in b/config.make.in
index ad4dd30..635932f 100644
--- a/config.make.in
+++ b/config.make.in
@@ -81,6 +81,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 ce0c6a0..3f5d207 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
@@ -7157,6 +7158,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 d89aaf0..cb37a83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2019,6 +2019,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)
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources