From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24505 invoked by alias); 20 Sep 2004 13:25:12 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 24486 invoked from network); 20 Sep 2004 13:25:11 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 20 Sep 2004 13:25:11 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i8KDOr3j015473; Mon, 20 Sep 2004 15:24:53 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i8KDOrZQ015471; Mon, 20 Sep 2004 15:24:53 +0200 Date: Mon, 20 Sep 2004 13:25:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Only use -z relro if it actually does something Message-ID: <20040920132453.GM30497@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2004-09/txt/msg00069.txt.bz2 Hi! On ia64 ATM -z relro does nothing (but increase the size of program headers). H.J. disabled it because it interferred with linker relaxation (not sure if that still applies or what the testcase was). This patch makes glibc use -z relro only when the linker does something with it. 2004-09-20 Jakub Jelinek * configure.in (libc_cv_z_relro): Only set to yes if linker script contains DATA_SEGMENT_RELRO_END. * configure: Rebuilt. --- libc/configure.in.jj 2004-09-20 15:16:27.000000000 +0200 +++ libc/configure.in 2004-09-20 15:19:51.950223522 +0200 @@ -1325,11 +1325,13 @@ EOF AC_CACHE_CHECK(for -z relro option, libc_cv_z_relro, [dnl + libc_cv_z_relro=no if AC_TRY_COMMAND([${CC-cc} -v --help 2>&1|grep "z relro" 1>&AS_MESSAGE_LOG_FD]) then - libc_cv_z_relro=yes - else - libc_cv_z_relro=no + if AC_TRY_COMMAND([${CC-cc} -Wl,--verbose 2>&1|grep DATA_SEGMENT_RELRO_END 1>&AS_MESSAGE_LOG_FD]) + then + libc_cv_z_relro=yes + fi fi]) AC_SUBST(libc_cv_z_relro) if test $libc_cv_z_relro = yes; then --- libc/configure.jj 2004-09-20 15:16:27.000000000 +0200 +++ libc/configure 2004-09-20 15:19:56.117482738 +0200 @@ -5549,16 +5549,23 @@ echo $ECHO_N "checking for -z relro opti if test "${libc_cv_z_relro+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if { ac_try='${CC-cc} -v --help 2>&1|grep "z relro" 1>&5' + libc_cv_z_relro=no + if { ac_try='${CC-cc} -v --help 2>&1|grep "z relro" 1>&5' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } then - libc_cv_z_relro=yes - else - libc_cv_z_relro=no + if { ac_try='${CC-cc} -Wl,--verbose 2>&1|grep DATA_SEGMENT_RELRO_END 1>&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + libc_cv_z_relro=yes + fi fi fi echo "$as_me:$LINENO: result: $libc_cv_z_relro" >&5 Jakub