This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/pr17711 created. glibc-2.20-564-gb275127
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 24 Jan 2015 14:00:55 -0000
- Subject: GNU C Library master sources branch hjl/pr17711 created. glibc-2.20-564-gb275127
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/pr17711 has been created
at b275127fa78f05835e6637845547d8708fc409c9 (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b275127fa78f05835e6637845547d8708fc409c9
commit b275127fa78f05835e6637845547d8708fc409c9
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.
* 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)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=395669ffc85b06719a952aea48a29109daba2fa7
commit 395669ffc85b06719a952aea48a29109daba2fa7
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Jan 13 06:19:44 2015 -0800
Compile gcrt1.o with -fPIC
We compile gcrt1.o with -fPIC to support both "gcc -pg" and "gcc -pie -pg".
[BZ #17836]
* csu/Makefile (extra-objs): Add gmon-start.o if not builing
shared library. Add gmon-start.os otherwise.
($(objpfx)g$(start-installed-name)): Use $(objpfx)S%
$(objpfx)gmon-start.os if builing shared library.
($(objpfx)g$(static-start-installed-name)): Likewise.
diff --git a/csu/Makefile b/csu/Makefile
index f7cf4af..9f0855a 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -32,7 +32,7 @@ aux = errno
elide-routines.os = libc-tls
static-only-routines = elf-init
csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
-extra-objs = start.o gmon-start.o \
+extra-objs = start.o \
$(start-installed-name) g$(start-installed-name) $(csu-dummies) \
S$(start-installed-name)
omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \
@@ -46,9 +46,11 @@ tests := tst-empty tst-atomic tst-atomic-long
tests-static := tst-empty
ifeq (yes,$(build-shared))
-extra-objs += S$(start-installed-name)
+extra-objs += S$(start-installed-name) gmon-start.os
install-lib += S$(start-installed-name)
generated += start.os
+else
+extra-objs += gmon-start.o
endif
ifneq ($(start-installed-name),$(static-start-installed-name))
@@ -95,10 +97,17 @@ endif
# The profiling startfile is made by linking together the normal
# startfile with gmon-start.o, which defines a constructor function
# to turn on profiling code at startup.
+ifeq (yes,$(build-shared))
+$(addprefix $(objpfx),$(sort g$(start-installed-name) \
+ g$(static-start-installed-name))): \
+ $(objpfx)g%: $(objpfx)S% $(objpfx)gmon-start.os
+ $(link-relocatable)
+else
$(addprefix $(objpfx),$(sort g$(start-installed-name) \
g$(static-start-installed-name))): \
$(objpfx)g%: $(objpfx)% $(objpfx)gmon-start.o
$(link-relocatable)
+endif
# These extra files are sometimes expected by system standard linking
# procedures, but we have nothing for them to do. So compile empty files.
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bf155b64d93d3f052f32cfefe00591ba3d5d11a3
commit bf155b64d93d3f052f32cfefe00591ba3d5d11a3
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Dec 19 06:30:31 2014 -0800
Compile vismain with -fPIC and link with -pie
diff --git a/elf/Makefile b/elf/Makefile
index e5b142c..02ab9d9 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -130,7 +130,7 @@ endif
tests += $(tests-static)
ifeq (yes,$(build-shared))
tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
- constload1 order vismain noload filter unload \
+ constload1 order noload filter unload \
reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
nodlopen nodlopen2 neededtest neededtest2 \
neededtest3 neededtest4 unload2 lateglobal initfirst global \
@@ -218,6 +218,9 @@ ifeq (yesyes,$(have-fpie)$(build-shared))
modules-names += tst-piemod1
tests += tst-pie1 tst-pie2
tests-pie += tst-pie1 tst-pie2
+tests += vismain
+tests-pie += vismain
+CFLAGS-vismain.c = $(pic-ccflag)
endif
modules-execstack-yes = tst-execstack-mod
extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources