1 |
vapier 09/12/01 04:44:17 |
2 |
|
3 |
Modified: toolchain-funcs.eclass |
4 |
Log: |
5 |
tc-has-tls: new thread local storage test function |
6 |
|
7 |
Revision Changes Path |
8 |
1.97 eclass/toolchain-funcs.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/toolchain-funcs.eclass?rev=1.97&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/toolchain-funcs.eclass?rev=1.97&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/toolchain-funcs.eclass?r1=1.96&r2=1.97 |
13 |
|
14 |
Index: toolchain-funcs.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v |
17 |
retrieving revision 1.96 |
18 |
retrieving revision 1.97 |
19 |
diff -u -r1.96 -r1.97 |
20 |
--- toolchain-funcs.eclass 27 Nov 2009 21:31:29 -0000 1.96 |
21 |
+++ toolchain-funcs.eclass 1 Dec 2009 04:44:17 -0000 1.97 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2007 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.96 2009/11/27 21:31:29 vapier Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.97 2009/12/01 04:44:17 vapier Exp $ |
27 |
|
28 |
# @ECLASS: toolchain-funcs.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -170,6 +170,35 @@ |
31 |
return $([[ ${host} == *-mint* ]]) |
32 |
} |
33 |
|
34 |
+# @FUNCTION: tc-has-tls |
35 |
+# @USAGE: [-s|-c|-l] [toolchain prefix] |
36 |
+# @DESCRIPTION: |
37 |
+# See if the toolchain supports thread local storage (TLS). Use -s to test the |
38 |
+# compiler, -c to also test the assembler, and -l to also test the C library |
39 |
+# (the default). |
40 |
+tc-has-tls() { |
41 |
+ local base="${T}/test-tc-tls" |
42 |
+ cat <<-EOF > "${base}.c" |
43 |
+ int foo(int *i) { |
44 |
+ static __thread int j = 0; |
45 |
+ return *i ? j : *i; |
46 |
+ } |
47 |
+ EOF |
48 |
+ local flags |
49 |
+ case $1 in |
50 |
+ -s) flags="-S";; |
51 |
+ -c) flags="-c";; |
52 |
+ -l) ;; |
53 |
+ -*) die "Usage: tc-has-tls [-c|-l] [toolchain prefix]";; |
54 |
+ esac |
55 |
+ : ${flags:=-fPIC -shared -Wl,-z,defs} |
56 |
+ [[ $1 == -* ]] && shift |
57 |
+ $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" >&/dev/null |
58 |
+ local ret=$? |
59 |
+ rm -f "${base}"* |
60 |
+ return ${ret} |
61 |
+} |
62 |
+ |
63 |
|
64 |
# Parse information from CBUILD/CHOST/CTARGET rather than |
65 |
# use external variables from the profile. |