diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-06-10 23:08:43 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-06-10 23:08:43 +0000 |
commit | 2286fa954c4aa873c2486c2820f520dd94c174ca (patch) | |
tree | 85c7b1e1655d5d1ffd638e3c0ea6cfac76a2a3a0 /eclass | |
parent | * bump (diff) | |
download | historical-2286fa954c4aa873c2486c2820f520dd94c174ca.tar.gz historical-2286fa954c4aa873c2486c2820f520dd94c174ca.tar.bz2 historical-2286fa954c4aa873c2486c2820f520dd94c174ca.zip |
make the libc.so locating code more robust by taking a page from the sandbox configure script #136296
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/toolchain.eclass | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 76d9f77157ae..2bb909f8e37b 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.287 2006/06/10 16:19:54 swegener Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.288 2006/06/10 23:08:43 vapier Exp $ HOMEPAGE="http://gcc.gnu.org/" LICENSE="GPL-2 LGPL-2.1" @@ -483,33 +483,30 @@ glibc_have_pie() { # This function determines whether or not libc has been patched with stack # smashing protection support. libc_has_ssp() { - local libc_prefix - [[ $(tc-arch) == "ppc64" ]] && [[ -z ${ABI} ]] && libc_prefix="lib64" - libc_prefix=${libc_prefix:-$(get_libdir)} - libc_prefix=${libc_prefix:-lib} + [[ ${ROOT} != "/" ]] && return 0 + # lib hacks taken from sandbox configure echo 'int main(){}' > "${T}"/libctest.c - gcc "${T}"/libctest.c -lc -o libctest - local libc_file=$(readelf -d libctest | grep 'NEEDED.*\[libc\.so[0-9\.]*\]' | awk '{print $NF}') - libc_file=${libc_file:1:${#libc_file}-2} + gcc "${T}"/libctest.c -lc -o libctest -Wl,-verbose &> "${T}"/libctest.log || return 1 + local libc_file=$(awk '/attempt to open/ { if (($4 ~ /\/libc\.so/) && ($5 == "succeeded")) LIBC = $4; }; END {print LIBC}' "${T}"/libctest.log) - local my_libc=${ROOT}/${libc_prefix}/${libc_file} + [[ -z ${libc_file} ]] && die "Unable to find a libc !?" # Check for gcc-4.x style ssp support - if [[ -n $(readelf -s "${my_libc}" 2>/dev/null | \ + if [[ -n $(readelf -s "${libc_file}" 2>/dev/null | \ grep 'FUNC.*GLOBAL.*__stack_chk_fail') ]] then return 0 else # Check for gcc-3.x style ssp support - if [[ -n $(readelf -s "${my_libc}" 2>/dev/null | \ + if [[ -n $(readelf -s "${libc_file}" 2>/dev/null | \ grep 'OBJECT.*GLOBAL.*__guard') ]] && \ - [[ -n $(readelf -s "${my_libc}" 2>/dev/null | \ + [[ -n $(readelf -s "${libc_file}" 2>/dev/null | \ grep 'FUNC.*GLOBAL.*__stack_smash_handler') ]] then return 0 elif is_crosscompile ; then - die "'${my_libc}' was detected w/out ssp, that sucks (a lot)" + die "'${libc_file}' was detected w/out ssp, that sucks (a lot)" else return 1 fi |