mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
Pass -no-pie to GCC only if GCC defaults to PIE [BZ #22614]
After --enable-static-pie is added to configure, libc_cv_pie_default is set to yes when either --enable-static-pie is used to configure glibc or GCC defaults to PIE. We should set no-pie-ldflag to -no-pie, which is supported on GCC 6 and later, only if GCC defaults to PIE, not when --enable-static-pie is used to configure glibc. Tested on x32 with --enable-static-pie using GCC 5 and without --enable-static-pie using GCC 7. [BZ #22614] * Makeconfig (no-pie-ldflag): Set to -no-pie only if $(cc-pie-default) == yes. * config.make.in (cc-pie-default): New. * configure.ac (libc_cv_pie_default): Renamed to ... (libc_cv_cc_pie_default): This. (libc_cv_pie_default): Set to $libc_cv_cc_pie_default. * configure: Regenerated.
This commit is contained in:
parent
8e1472d2c1
commit
00c714df39
5 changed files with 28 additions and 9 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2017-12-18 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
[BZ #22614]
|
||||||
|
* Makeconfig (no-pie-ldflag): Set to -no-pie only if
|
||||||
|
$(cc-pie-default) == yes.
|
||||||
|
* config.make.in (cc-pie-default): New.
|
||||||
|
* configure.ac (libc_cv_pie_default): Renamed to ...
|
||||||
|
(libc_cv_cc_pie_default): This.
|
||||||
|
(libc_cv_pie_default): Set to $libc_cv_cc_pie_default.
|
||||||
|
* configure: Regenerated.
|
||||||
|
|
||||||
2017-12-18 Florian Weimer <fweimer@redhat.com>
|
2017-12-18 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
[BZ #20204]
|
[BZ #20204]
|
||||||
|
|
|
@ -464,8 +464,10 @@ endif
|
||||||
# Commands for linking programs with the C library.
|
# Commands for linking programs with the C library.
|
||||||
ifndef +link
|
ifndef +link
|
||||||
ifeq (yes,$(build-shared))
|
ifeq (yes,$(build-shared))
|
||||||
ifeq (yes,$(build-pie-default))
|
ifeq (yes,$(cc-pie-default))
|
||||||
no-pie-ldflag = -no-pie
|
no-pie-ldflag = -no-pie
|
||||||
|
endif
|
||||||
|
ifeq (yes,$(build-pie-default))
|
||||||
+link = $(+link-pie)
|
+link = $(+link-pie)
|
||||||
+link-tests = $(+link-pie-tests)
|
+link-tests = $(+link-pie-tests)
|
||||||
+link-printers-tests = $(+link-pie-printers-tests)
|
+link-printers-tests = $(+link-pie-printers-tests)
|
||||||
|
|
|
@ -89,6 +89,7 @@ static-nss-crypt = @libc_cv_static_nss_crypt@
|
||||||
build-shared = @shared@
|
build-shared = @shared@
|
||||||
build-pic-default= @libc_cv_pic_default@
|
build-pic-default= @libc_cv_pic_default@
|
||||||
build-pie-default= @libc_cv_pie_default@
|
build-pie-default= @libc_cv_pie_default@
|
||||||
|
cc-pie-default= @libc_cv_cc_pie_default@
|
||||||
build-profile = @profile@
|
build-profile = @profile@
|
||||||
build-static-nss = @static_nss@
|
build-static-nss = @static_nss@
|
||||||
cross-compiling = @cross_compiling@
|
cross-compiling = @cross_compiling@
|
||||||
|
|
13
configure
vendored
13
configure
vendored
|
@ -596,6 +596,7 @@ static_nss
|
||||||
profile
|
profile
|
||||||
libc_cv_multidir
|
libc_cv_multidir
|
||||||
libc_cv_pie_default
|
libc_cv_pie_default
|
||||||
|
libc_cv_cc_pie_default
|
||||||
libc_cv_pic_default
|
libc_cv_pic_default
|
||||||
shared
|
shared
|
||||||
static
|
static
|
||||||
|
@ -6748,22 +6749,24 @@ $as_echo "$libc_cv_pic_default" >&6; }
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIE is default" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIE is default" >&5
|
||||||
$as_echo_n "checking whether -fPIE is default... " >&6; }
|
$as_echo_n "checking whether -fPIE is default... " >&6; }
|
||||||
if ${libc_cv_pie_default+:} false; then :
|
if ${libc_cv_cc_pie_default+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
libc_cv_pie_default=yes
|
libc_cv_cc_pie_default=yes
|
||||||
cat > conftest.c <<EOF
|
cat > conftest.c <<EOF
|
||||||
#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
|
#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
|
||||||
# error PIE is default.
|
# error PIE is default.
|
||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
if eval "${CC-cc} -S conftest.c 2>&5 1>&5"; then
|
if eval "${CC-cc} -S conftest.c 2>&5 1>&5"; then
|
||||||
libc_cv_pie_default=no
|
libc_cv_cc_pie_default=no
|
||||||
fi
|
fi
|
||||||
rm -f conftest.*
|
rm -f conftest.*
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_pie_default" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_pie_default" >&5
|
||||||
$as_echo "$libc_cv_pie_default" >&6; }
|
$as_echo "$libc_cv_cc_pie_default" >&6; }
|
||||||
|
libc_cv_pie_default=$libc_cv_cc_pie_default
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Set the `multidir' variable by grabbing the variable from the compiler.
|
# Set the `multidir' variable by grabbing the variable from the compiler.
|
||||||
|
|
|
@ -1794,17 +1794,19 @@ fi
|
||||||
rm -f conftest.*])
|
rm -f conftest.*])
|
||||||
AC_SUBST(libc_cv_pic_default)
|
AC_SUBST(libc_cv_pic_default)
|
||||||
|
|
||||||
AC_CACHE_CHECK([whether -fPIE is default], libc_cv_pie_default,
|
AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
|
||||||
[libc_cv_pie_default=yes
|
[libc_cv_cc_pie_default=yes
|
||||||
cat > conftest.c <<EOF
|
cat > conftest.c <<EOF
|
||||||
#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
|
#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
|
||||||
# error PIE is default.
|
# error PIE is default.
|
||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
|
if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
|
||||||
libc_cv_pie_default=no
|
libc_cv_cc_pie_default=no
|
||||||
fi
|
fi
|
||||||
rm -f conftest.*])
|
rm -f conftest.*])
|
||||||
|
libc_cv_pie_default=$libc_cv_cc_pie_default
|
||||||
|
AC_SUBST(libc_cv_cc_pie_default)
|
||||||
AC_SUBST(libc_cv_pie_default)
|
AC_SUBST(libc_cv_pie_default)
|
||||||
|
|
||||||
# Set the `multidir' variable by grabbing the variable from the compiler.
|
# Set the `multidir' variable by grabbing the variable from the compiler.
|
||||||
|
|
Loading…
Add table
Reference in a new issue