diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-12-01 04:44:17 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-12-01 04:44:17 +0000 |
commit | 134224bccda2b6b9dec7bcd76c706dae75e19920 (patch) | |
tree | 335db51af8966646a9eba8656289c1ef6c34cde1 /eclass/toolchain-funcs.eclass | |
parent | Version bump to 2.0.1 (diff) | |
download | gentoo-2-134224bccda2b6b9dec7bcd76c706dae75e19920.tar.gz gentoo-2-134224bccda2b6b9dec7bcd76c706dae75e19920.tar.bz2 gentoo-2-134224bccda2b6b9dec7bcd76c706dae75e19920.zip |
tc-has-tls: new thread local storage test function
Diffstat (limited to 'eclass/toolchain-funcs.eclass')
-rw-r--r-- | eclass/toolchain-funcs.eclass | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index d7457803eb61..ed6720fe09e6 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.96 2009/11/27 21:31:29 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.97 2009/12/01 04:44:17 vapier Exp $ # @ECLASS: toolchain-funcs.eclass # @MAINTAINER: @@ -170,6 +170,35 @@ tc-is-static-only() { return $([[ ${host} == *-mint* ]]) } +# @FUNCTION: tc-has-tls +# @USAGE: [-s|-c|-l] [toolchain prefix] +# @DESCRIPTION: +# See if the toolchain supports thread local storage (TLS). Use -s to test the +# compiler, -c to also test the assembler, and -l to also test the C library +# (the default). +tc-has-tls() { + local base="${T}/test-tc-tls" + cat <<-EOF > "${base}.c" + int foo(int *i) { + static __thread int j = 0; + return *i ? j : *i; + } + EOF + local flags + case $1 in + -s) flags="-S";; + -c) flags="-c";; + -l) ;; + -*) die "Usage: tc-has-tls [-c|-l] [toolchain prefix]";; + esac + : ${flags:=-fPIC -shared -Wl,-z,defs} + [[ $1 == -* ]] && shift + $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" >&/dev/null + local ret=$? + rm -f "${base}"* + return ${ret} +} + # Parse information from CBUILD/CHOST/CTARGET rather than # use external variables from the profile. |