1 |
commit: b954e8da3988230fd889d69536103e1fc0149813 |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 3 08:32:48 2016 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 3 08:32:48 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=b954e8da |
7 |
|
8 |
toolchain.eclass: sync with tree |
9 |
|
10 |
eclass/toolchain.eclass | 92 +++++++++++++++++++++++++++++++++++-------------- |
11 |
1 file changed, 66 insertions(+), 26 deletions(-) |
12 |
|
13 |
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass |
14 |
index 066fc42..a272810 100644 |
15 |
--- a/eclass/toolchain.eclass |
16 |
+++ b/eclass/toolchain.eclass |
17 |
@@ -104,6 +104,7 @@ INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include} |
18 |
|
19 |
if is_crosscompile ; then |
20 |
BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}} |
21 |
+ HOSTLIBPATH=${PREFIX}/${CHOST}/${CTARGET}/lib/${GCC_CONFIG_VER} |
22 |
else |
23 |
BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}} |
24 |
fi |
25 |
@@ -152,17 +153,13 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
26 |
# the older versions, we don't want to bother supporting it. #448024 |
27 |
tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize ) |
28 |
tc_version_is_at_least 4.9 && IUSE+=" cilk" |
29 |
+ tc_version_is_at_least 5.0 && IUSE+=" jit" |
30 |
tc_version_is_at_least 6.0 && IUSE+=" pie +ssp" |
31 |
fi |
32 |
|
33 |
IUSE+=" ${IUSE_DEF[*]/#/+}" |
34 |
|
35 |
-# Support upgrade paths here or people get pissed |
36 |
-if ! tc_version_is_at_least 4.7 || is_crosscompile || use multislot || [[ ${GCC_PV} == *_alpha* ]] ; then |
37 |
- SLOT="${GCC_CONFIG_VER}" |
38 |
-else |
39 |
- SLOT="${GCC_BRANCH_VER}" |
40 |
-fi |
41 |
+SLOT="${GCC_CONFIG_VER}" |
42 |
|
43 |
#---->> DEPEND <<---- |
44 |
|
45 |
@@ -656,7 +653,7 @@ make_gcc_hard() { |
46 |
ewarn "PIE has not been enabled by default" |
47 |
gcc_hard_flags+=" -DEFAULT_SSP" |
48 |
else |
49 |
- # do nothing if hardened is't supported, but don't die either |
50 |
+ # do nothing if hardened isn't supported, but don't die either |
51 |
ewarn "hardened is not supported for this arch in this gcc version" |
52 |
return 0 |
53 |
fi |
54 |
@@ -838,6 +835,7 @@ toolchain_src_configure() { |
55 |
is_d && GCC_LANG+=",d" |
56 |
is_gcj && GCC_LANG+=",java" |
57 |
is_go && GCC_LANG+=",go" |
58 |
+ is_jit && GCC_LANG+=",jit" |
59 |
if is_objc || is_objcxx ; then |
60 |
GCC_LANG+=",objc" |
61 |
if tc_version_is_at_least 4 ; then |
62 |
@@ -901,6 +899,9 @@ toolchain_src_configure() { |
63 |
confgcc+=( --enable-libstdcxx-time ) |
64 |
fi |
65 |
|
66 |
+ # The jit language requires this. |
67 |
+ is_jit && confgcc+=( --enable-host-shared ) |
68 |
+ |
69 |
# # Turn on the -Wl,--build-id flag by default for ELF targets. #525942 |
70 |
# # This helps with locating debug files. |
71 |
# case ${CTARGET} in |
72 |
@@ -1502,7 +1503,7 @@ toolchain_src_compile() { |
73 |
|
74 |
# Do not make manpages if we do not have perl ... |
75 |
[[ ! -x /usr/bin/perl ]] \ |
76 |
- && find "${WORKDIR}"/build -name '*.[17]' | xargs touch |
77 |
+ && find "${WORKDIR}"/build -name '*.[17]' -exec touch {} + |
78 |
|
79 |
gcc_do_make ${GCC_MAKE_TARGET} |
80 |
} |
81 |
@@ -1660,7 +1661,12 @@ toolchain_src_install() { |
82 |
for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do |
83 |
# For some reason, g77 gets made instead of ${CTARGET}-g77... |
84 |
# this should take care of that |
85 |
- [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x} |
86 |
+ if [[ -f ${x} ]] ; then |
87 |
+ # In case they're hardlinks, clear out the target first |
88 |
+ # otherwise the mv below will complain. |
89 |
+ rm -f ${CTARGET}-${x} |
90 |
+ mv ${x} ${CTARGET}-${x} |
91 |
+ fi |
92 |
|
93 |
if [[ -f ${CTARGET}-${x} ]] ; then |
94 |
if ! is_crosscompile ; then |
95 |
@@ -1678,9 +1684,18 @@ toolchain_src_install() { |
96 |
ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER} |
97 |
fi |
98 |
done |
99 |
+ # Rename the main go binaries as we don't want to clobber dev-lang/go |
100 |
+ # when gcc-config runs. #567806 |
101 |
+ if tc_version_is_at_least 5 && is_go ; then |
102 |
+ for x in go gofmt; do |
103 |
+ mv ${x} ${x}-${GCCMAJOR} || die |
104 |
+ done |
105 |
+ fi |
106 |
|
107 |
# Now do the fun stripping stuff |
108 |
env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}" |
109 |
+ is_crosscompile && \ |
110 |
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${D}/${HOSTLIBPATH}" |
111 |
env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}" |
112 |
# gcc used to install helper binaries in lib/ but then moved to libexec/ |
113 |
[[ -d ${D}${PREFIX}/libexec/gcc ]] && \ |
114 |
@@ -1710,9 +1725,8 @@ toolchain_src_install() { |
115 |
# install testsuite results |
116 |
if use regression-test; then |
117 |
docinto testsuite |
118 |
- find "${WORKDIR}"/build -type f -name "*.sum" -print0 | xargs -0 dodoc |
119 |
- find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -print0 \ |
120 |
- | xargs -0 dodoc |
121 |
+ find "${WORKDIR}"/build -type f -name "*.sum" -exec dodoc {} + |
122 |
+ find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -exec dodoc {} + |
123 |
fi |
124 |
|
125 |
# Rather install the script, else portage with changing $FILESDIR |
126 |
@@ -1762,6 +1776,17 @@ gcc_movelibs() { |
127 |
# older versions of gcc did not support --print-multi-os-directory |
128 |
tc_version_is_at_least 3.2 || return 0 |
129 |
|
130 |
+ # For non-target libs which are for CHOST and not CTARGET, we want to |
131 |
+ # move them to the compiler-specific CHOST internal dir. This is stuff |
132 |
+ # that you want to link against when building tools rather than building |
133 |
+ # code to run on the target. |
134 |
+ if tc_version_is_at_least 5 && is_crosscompile ; then |
135 |
+ dodir "${HOSTLIBPATH}" |
136 |
+ mv "${D}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die |
137 |
+ fi |
138 |
+ |
139 |
+ # For all the libs that are built for CTARGET, move them into the |
140 |
+ # compiler-specific CTARGET internal dir. |
141 |
local x multiarg removedirs="" |
142 |
for multiarg in $($(XGCC) -print-multi-lib) ; do |
143 |
multiarg=${multiarg#*;} |
144 |
@@ -1807,7 +1832,7 @@ gcc_movelibs() { |
145 |
for FROMDIR in ${removedirs} ; do |
146 |
rmdir "${D}"${FROMDIR} >& /dev/null |
147 |
done |
148 |
- find "${D}" -type d | xargs rmdir >& /dev/null |
149 |
+ find -depth "${D}" -type d -exec rmdir {} + >& /dev/null |
150 |
} |
151 |
|
152 |
# make sure the libtool archives have libdir set to where they actually |
153 |
@@ -1957,7 +1982,7 @@ toolchain_pkg_postinst() { |
154 |
echo |
155 |
ewarn "You might want to review the GCC upgrade guide when moving between" |
156 |
ewarn "major versions (like 4.2 to 4.3):" |
157 |
- ewarn "https://www.gentoo.org/doc/en/gcc-upgrading.xml" |
158 |
+ ewarn "https://wiki.gentoo.org/wiki/Upgrading_GCC" |
159 |
echo |
160 |
|
161 |
# Clean up old paths |
162 |
@@ -2025,26 +2050,36 @@ do_gcc_config() { |
163 |
return 0 |
164 |
fi |
165 |
|
166 |
- local current_gcc_config="" current_specs="" use_specs="" |
167 |
+ local current_gcc_config target |
168 |
|
169 |
current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null) |
170 |
if [[ -n ${current_gcc_config} ]] ; then |
171 |
+ local current_specs use_specs |
172 |
# figure out which specs-specific config is active |
173 |
current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}') |
174 |
[[ -n ${current_specs} ]] && use_specs=-${current_specs} |
175 |
- fi |
176 |
- if [[ -n ${use_specs} ]] && \ |
177 |
- [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]] |
178 |
- then |
179 |
- ewarn "The currently selected specs-specific gcc config," |
180 |
- ewarn "${current_specs}, doesn't exist anymore. This is usually" |
181 |
- ewarn "due to enabling/disabling hardened or switching to a version" |
182 |
- ewarn "of gcc that doesnt create multiple specs files. The default" |
183 |
- ewarn "config will be used, and the previous preference forgotten." |
184 |
- use_specs="" |
185 |
+ |
186 |
+ if [[ -n ${use_specs} ]] && \ |
187 |
+ [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]] |
188 |
+ then |
189 |
+ ewarn "The currently selected specs-specific gcc config," |
190 |
+ ewarn "${current_specs}, doesn't exist anymore. This is usually" |
191 |
+ ewarn "due to enabling/disabling hardened or switching to a version" |
192 |
+ ewarn "of gcc that doesnt create multiple specs files. The default" |
193 |
+ ewarn "config will be used, and the previous preference forgotten." |
194 |
+ use_specs="" |
195 |
+ fi |
196 |
+ |
197 |
+ target="${CTARGET}-${GCC_CONFIG_VER}${use_specs}" |
198 |
+ else |
199 |
+ # The curent target is invalid. Attempt to switch to a valid one. |
200 |
+ # Blindly pick the latest version. #529608 |
201 |
+ # TODO: Should update gcc-config to accept `-l ${CTARGET}` rather than |
202 |
+ # doing a partial grep like this. |
203 |
+ target=$(gcc-config -l 2>/dev/null | grep " ${CTARGET}-[0-9]" | tail -1 | awk '{print $2}') |
204 |
fi |
205 |
|
206 |
- gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs} |
207 |
+ gcc-config "${target}" |
208 |
} |
209 |
|
210 |
should_we_gcc_config() { |
211 |
@@ -2143,6 +2178,11 @@ is_go() { |
212 |
use cxx && use_if_iuse go |
213 |
} |
214 |
|
215 |
+is_jit() { |
216 |
+ gcc-lang-supported jit || return 1 |
217 |
+ use_if_iuse jit |
218 |
+} |
219 |
+ |
220 |
is_multilib() { |
221 |
tc_version_is_at_least 3 || return 1 |
222 |
use multilib |