1 |
commit: 589ce025faee90c57c76c0da6f8534f707132d8f |
2 |
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 1 20:18:52 2018 +0000 |
4 |
Commit: Andreas Hüttel <dilfridge <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 1 20:19:17 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=589ce025 |
7 |
|
8 |
sys-libs/glibc: Add new bootstrap files from stages, bug 647070 |
9 |
|
10 |
See https://github.com/gentoo/gcc-multilib-bootstrap/ for the source. |
11 |
This is as good as we can do at the moment. Tested by building an |
12 |
x32 glibc on a normal amd64 system. |
13 |
|
14 |
For the glibc-2.26 stabilization we still need new files for PowerPC. |
15 |
|
16 |
Current status: |
17 |
* amd64, x32, x86: Files from gcc-6.4 |
18 |
* s390, s390x: Files from gcc-5.4 (does this work?) |
19 |
* ppc, ppc64: no files, since only gcc-4.9 available |
20 |
* n32, n64, o32: no files, last mips stages are years old, not useful |
21 |
|
22 |
Bug: https://bugs.gentoo.org/647070 |
23 |
Package-Manager: Portage-2.3.31, Repoman-2.3.9 |
24 |
|
25 |
sys-libs/glibc/Manifest | 1 + |
26 |
.../{glibc-9999.ebuild => glibc-2.26-r7.ebuild} | 829 ++++----------------- |
27 |
.../{glibc-9999.ebuild => glibc-2.27-r2.ebuild} | 20 +- |
28 |
sys-libs/glibc/glibc-9999.ebuild | 8 +- |
29 |
4 files changed, 148 insertions(+), 710 deletions(-) |
30 |
|
31 |
diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest |
32 |
index 71fdce7bee9..767c577845d 100644 |
33 |
--- a/sys-libs/glibc/Manifest |
34 |
+++ b/sys-libs/glibc/Manifest |
35 |
@@ -1,4 +1,5 @@ |
36 |
DIST gcc-4.7.3-r1-multilib-bootstrap.tar.bz2 8064097 BLAKE2B 3cc5c82cd57d0fbd26d9a376ee8ca02f119fe9d653311cbe4d2b7b93aec2290adac3be271be19a7fdedae2e11e4b6e32360184e557204e100ad64357f5575d4b SHA512 40b93e194ad41a75d649d84d1c49070680f253a13f0617803243bc61c44fed1ca2d0a7572a97ebb79353f312b58b5f6360be916dd7435928cc53935082e15269 |
37 |
+DIST gcc-multilib-bootstrap-20180501.tar.xz 2128700 BLAKE2B edeb5447bf397dfeee1295beb10b0e34253da8b3e1816720b6cfc3300a1c685fa022c3b809402a86340bbd7b9488d22cfba4c042d530dcb05ec971a2b1580d34 SHA512 eb289c44c5dcabaa727612dd685801b61e1fbe94b39024ecb3e14c73f9eaff68e05949a8f277a86c7471955cc8ec6e0127623b9861be7ac85f63226618b6c9c2 |
38 |
DIST glibc-2.18-patches-4.tar.bz2 95165 BLAKE2B 70280e0f5fd0b1ee13cd0464aafaa9c9324528d0bee8024e6529d67d908991012066db6d8257b66983a1f52e32b3aad7718612fdab9ea199fef845db93347168 SHA512 d881c9c5fe32b967694d4ca5185ff5ffc964449f2ed49fd062e5d57a3c6d9f16eef2f591d2d8e98a1a95a6487f3436ef031839ed8766fd085404b288340b7933 |
39 |
DIST glibc-2.18.tar.xz 11150148 BLAKE2B 7848a5a50abedbd17085e05b6f6835959adb5e55a424d95fa8a49eeec999a6dd81a9382db85ef7e852ef1d7743c5d312dccbf42024e95edf0e802eb32928dfe5 SHA512 27218d2e7dd3bf3908d7af171c490933680e958c579ebd27b43b661e223fd5de2219cc1cf699170405280808c84de476d0ad86dbba35a488ef404e9438552327 |
40 |
DIST glibc-2.19-patches-3.tar.bz2 80664 BLAKE2B fb348c711941c1bd4dadd905e172dc4f239d8b63af1a1d14dcf4ec45c504bd47e10e9b24b38f9e01796016f2e97caeeb693213ae08147274ed0a4d9501293be0 SHA512 d281d6a2757920124cf8a3f02b97e75192598b08d96ae48840df34c7ffdcb212952d171f233e6f12a429b19437d0a296212fe1f2eae164d6a1c6793cb3cb69f0 |
41 |
|
42 |
diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.26-r7.ebuild |
43 |
similarity index 50% |
44 |
copy from sys-libs/glibc/glibc-9999.ebuild |
45 |
copy to sys-libs/glibc/glibc-2.26-r7.ebuild |
46 |
index ca23762e8d4..dad9a620a2c 100644 |
47 |
--- a/sys-libs/glibc/glibc-9999.ebuild |
48 |
+++ b/sys-libs/glibc/glibc-2.26-r7.ebuild |
49 |
@@ -3,40 +3,40 @@ |
50 |
|
51 |
EAPI=6 |
52 |
|
53 |
-inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \ |
54 |
- multilib systemd multiprocessing |
55 |
+inherit prefix toolchain-glibc |
56 |
|
57 |
DESCRIPTION="GNU libc C library" |
58 |
HOMEPAGE="https://www.gnu.org/software/libc/" |
59 |
+ |
60 |
LICENSE="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" |
61 |
RESTRICT="strip" # Strip ourself #46186 |
62 |
-SLOT="2.2" |
63 |
- |
64 |
EMULTILIB_PKG="true" |
65 |
|
66 |
+# Configuration variables |
67 |
+ |
68 |
if [[ ${PV} == 9999* ]]; then |
69 |
- EGIT_REPO_URI="https://sourceware.org/git/glibc.git" |
70 |
+ EGIT_REPO_URI="git://sourceware.org/git/glibc.git" |
71 |
inherit git-r3 |
72 |
else |
73 |
- # KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" |
74 |
+ #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" |
75 |
KEYWORDS="" |
76 |
SRC_URI="mirror://gnu/glibc/${P}.tar.xz" |
77 |
fi |
78 |
|
79 |
RELEASE_VER=${PV} |
80 |
|
81 |
-GCC_BOOTSTRAP_VER="4.7.3-r1" |
82 |
+GCC_BOOTSTRAP_VER=20180501 |
83 |
|
84 |
# Gentoo patchset |
85 |
-PATCH_VER=5 |
86 |
+PATCH_VER=7 |
87 |
|
88 |
SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2" |
89 |
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )" |
90 |
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" |
91 |
|
92 |
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla" |
93 |
+IUSE="audit caps debug doc gd hardened multilib nscd selinux systemtap profile suid vanilla headers-only" |
94 |
|
95 |
-# Minimum kernel version that glibc requires |
96 |
-MIN_KERN_VER="3.2.0" |
97 |
+# Min kernel version glibc requires |
98 |
+: ${NPTL_KERN_VER:="3.2.0"} |
99 |
|
100 |
# Here's how the cross-compile logic breaks down ... |
101 |
# CTARGET - machine that will target the binaries |
102 |
@@ -51,7 +51,7 @@ MIN_KERN_VER="3.2.0" |
103 |
# For install paths: |
104 |
# CHOST = CTARGET - install into / |
105 |
# CHOST != CTARGET - install into /usr/CTARGET/ |
106 |
-# |
107 |
+ |
108 |
export CBUILD=${CBUILD:-${CHOST}} |
109 |
export CTARGET=${CTARGET:-${CHOST}} |
110 |
if [[ ${CTARGET} == ${CHOST} ]] ; then |
111 |
@@ -60,8 +60,14 @@ if [[ ${CTARGET} == ${CHOST} ]] ; then |
112 |
fi |
113 |
fi |
114 |
|
115 |
-# We need a new-enough binutils/gcc to match upstream baseline. |
116 |
-# Also we need to make sure our binutils/gcc supports TLS. |
117 |
+is_crosscompile() { |
118 |
+ [[ ${CHOST} != ${CTARGET} ]] |
119 |
+} |
120 |
+ |
121 |
+SLOT="2.2" |
122 |
+ |
123 |
+# General: We need a new-enough binutils/gcc to match upstream baseline. |
124 |
+# arch: we need to make sure our binutils/gcc supports TLS. |
125 |
COMMON_DEPEND=" |
126 |
nscd? ( selinux? ( |
127 |
audit? ( sys-process/audit ) |
128 |
@@ -75,12 +81,11 @@ DEPEND="${COMMON_DEPEND} |
129 |
>=app-misc/pax-utils-0.1.10 |
130 |
!<sys-apps/sandbox-1.6 |
131 |
!<sys-apps/portage-2.1.2 |
132 |
- !<sys-devel/bison-2.7 |
133 |
doc? ( sys-apps/texinfo ) |
134 |
" |
135 |
RDEPEND="${COMMON_DEPEND} |
136 |
- sys-apps/gentoo-functions |
137 |
!sys-kernel/ps3-sources |
138 |
+ sys-apps/gentoo-functions |
139 |
!sys-libs/nss-db |
140 |
" |
141 |
|
142 |
@@ -101,495 +106,10 @@ else |
143 |
fi |
144 |
|
145 |
# |
146 |
-# Small helper functions |
147 |
+# the phases |
148 |
# |
149 |
|
150 |
-is_crosscompile() { |
151 |
- [[ ${CHOST} != ${CTARGET} ]] |
152 |
-} |
153 |
- |
154 |
-just_headers() { |
155 |
- is_crosscompile && use headers-only |
156 |
-} |
157 |
- |
158 |
-alt_prefix() { |
159 |
- is_crosscompile && echo /usr/${CTARGET} |
160 |
-} |
161 |
- |
162 |
-# We need to be able to set alternative headers for compiling for non-native |
163 |
-# platform. Will also become useful for testing kernel-headers without screwing |
164 |
-# up the whole system. |
165 |
-alt_headers() { |
166 |
- echo ${ALT_HEADERS:=$(alt_prefix)/usr/include} |
167 |
-} |
168 |
- |
169 |
-alt_build_headers() { |
170 |
- if [[ -z ${ALT_BUILD_HEADERS} ]] ; then |
171 |
- ALT_BUILD_HEADERS="${EPREFIX}$(alt_headers)" |
172 |
- if tc-is-cross-compiler ; then |
173 |
- ALT_BUILD_HEADERS=${SYSROOT}$(alt_headers) |
174 |
- if [[ ! -e ${ALT_BUILD_HEADERS}/linux/version.h ]] ; then |
175 |
- local header_path=$(echo '#include <linux/version.h>' | $(tc-getCPP ${CTARGET}) ${CFLAGS} 2>&1 | grep -o '[^"]*linux/version.h') |
176 |
- ALT_BUILD_HEADERS=${header_path%/linux/version.h} |
177 |
- fi |
178 |
- fi |
179 |
- fi |
180 |
- echo "${ALT_BUILD_HEADERS}" |
181 |
-} |
182 |
- |
183 |
-alt_libdir() { |
184 |
- echo $(alt_prefix)/$(get_libdir) |
185 |
-} |
186 |
-alt_usrlibdir() { |
187 |
- echo $(alt_prefix)/usr/$(get_libdir) |
188 |
-} |
189 |
- |
190 |
-builddir() { |
191 |
- echo "${WORKDIR}/build-${ABI}-${CTARGET}-$1" |
192 |
-} |
193 |
- |
194 |
-do_compile_test() { |
195 |
- local ret save_cflags=${CFLAGS} |
196 |
- CFLAGS+=" $1" |
197 |
- shift |
198 |
- |
199 |
- pushd "${T}" >/dev/null |
200 |
- |
201 |
- rm -f glibc-test* |
202 |
- printf '%b' "$*" > glibc-test.c |
203 |
- |
204 |
- nonfatal emake -s glibc-test |
205 |
- ret=$? |
206 |
- |
207 |
- popd >/dev/null |
208 |
- |
209 |
- CFLAGS=${save_cflags} |
210 |
- return ${ret} |
211 |
-} |
212 |
- |
213 |
-do_run_test() { |
214 |
- local ret |
215 |
- |
216 |
- if [[ ${MERGE_TYPE} == "binary" ]] ; then |
217 |
- # ignore build failures when installing a binary package #324685 |
218 |
- do_compile_test "" "$@" 2>/dev/null || return 0 |
219 |
- else |
220 |
- if ! do_compile_test "" "$@" ; then |
221 |
- ewarn "Simple build failed ... assuming this is desired #324685" |
222 |
- return 0 |
223 |
- fi |
224 |
- fi |
225 |
- |
226 |
- pushd "${T}" >/dev/null |
227 |
- |
228 |
- ./glibc-test |
229 |
- ret=$? |
230 |
- rm -f glibc-test* |
231 |
- |
232 |
- popd >/dev/null |
233 |
- |
234 |
- return ${ret} |
235 |
-} |
236 |
- |
237 |
-setup_target_flags() { |
238 |
- # This largely mucks with compiler flags. None of which should matter |
239 |
- # when building up just the headers. |
240 |
- just_headers && return 0 |
241 |
- |
242 |
- case $(tc-arch) in |
243 |
- x86) |
244 |
- # -march needed for #185404 #199334 |
245 |
- # TODO: When creating the first glibc cross-compile, this test will |
246 |
- # always fail as it does a full link which in turn requires glibc. |
247 |
- # Probably also applies when changing multilib profile settings (e.g. |
248 |
- # enabling x86 when the profile was amd64-only previously). |
249 |
- # We could change main to _start and pass -nostdlib here so that we |
250 |
- # only test the gcc code compilation. Or we could do a compile and |
251 |
- # then look for the symbol via scanelf. |
252 |
- if ! do_compile_test "" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then |
253 |
- local t=${CTARGET_OPT:-${CTARGET}} |
254 |
- t=${t%%-*} |
255 |
- filter-flags '-march=*' |
256 |
- export CFLAGS="-march=${t} ${CFLAGS}" |
257 |
- einfo "Auto adding -march=${t} to CFLAGS #185404" |
258 |
- fi |
259 |
- ;; |
260 |
- amd64) |
261 |
- # -march needed for #185404 #199334 |
262 |
- # Note: This test only matters when the x86 ABI is enabled, so we could |
263 |
- # optimize a bit and elide it. |
264 |
- # TODO: See cross-compile issues listed above for x86. |
265 |
- if ! do_compile_test "${CFLAGS_x86}" 'void f(int i, void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n' 2>/dev/null ; then |
266 |
- local t=${CTARGET_OPT:-${CTARGET}} |
267 |
- t=${t%%-*} |
268 |
- # Normally the target is x86_64-xxx, so turn that into the -march that |
269 |
- # gcc actually accepts. #528708 |
270 |
- [[ ${t} == "x86_64" ]] && t="x86-64" |
271 |
- filter-flags '-march=*' |
272 |
- # ugly, ugly, ugly. ugly. |
273 |
- CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags '-march=*'; echo "${CFLAGS}") |
274 |
- export CFLAGS_x86="${CFLAGS_x86} -march=${t}" |
275 |
- einfo "Auto adding -march=${t} to CFLAGS_x86 #185404" |
276 |
- fi |
277 |
- ;; |
278 |
- mips) |
279 |
- # The mips abi cannot support the GNU style hashes. #233233 |
280 |
- filter-ldflags -Wl,--hash-style=gnu -Wl,--hash-style=both |
281 |
- ;; |
282 |
- sparc) |
283 |
- # Both sparc and sparc64 can use -fcall-used-g6. -g7 is bad, though. |
284 |
- filter-flags "-fcall-used-g7" |
285 |
- append-flags "-fcall-used-g6" |
286 |
- |
287 |
- # If the CHOST is the basic one (e.g. not sparcv9-xxx already), |
288 |
- # try to pick a better one so glibc can use cpu-specific .S files. |
289 |
- # We key off the CFLAGS to get a good value. Also need to handle |
290 |
- # version skew. |
291 |
- # We can't force users to set their CHOST to their exact machine |
292 |
- # as many of these are not recognized by config.sub/gcc and such :(. |
293 |
- # Note: If the mcpu values don't scale, we might try probing CPP defines. |
294 |
- # Note: Should we factor in -Wa,-AvXXX flags too ? Or -mvis/etc... ? |
295 |
- |
296 |
- local cpu |
297 |
- case ${CTARGET} in |
298 |
- sparc64-*) |
299 |
- case $(get-flag mcpu) in |
300 |
- niagara[234]) |
301 |
- if version_is_at_least 2.8 ; then |
302 |
- cpu="sparc64v2" |
303 |
- elif version_is_at_least 2.4 ; then |
304 |
- cpu="sparc64v" |
305 |
- elif version_is_at_least 2.2.3 ; then |
306 |
- cpu="sparc64b" |
307 |
- fi |
308 |
- ;; |
309 |
- niagara) |
310 |
- if version_is_at_least 2.4 ; then |
311 |
- cpu="sparc64v" |
312 |
- elif version_is_at_least 2.2.3 ; then |
313 |
- cpu="sparc64b" |
314 |
- fi |
315 |
- ;; |
316 |
- ultrasparc3) |
317 |
- cpu="sparc64b" |
318 |
- ;; |
319 |
- *) |
320 |
- # We need to force at least v9a because the base build doesn't |
321 |
- # work with just v9. |
322 |
- # https://sourceware.org/bugzilla/show_bug.cgi?id=19477 |
323 |
- [[ -z ${cpu} ]] && append-flags "-Wa,-xarch=v9a" |
324 |
- ;; |
325 |
- esac |
326 |
- ;; |
327 |
- sparc-*) |
328 |
- case $(get-flag mcpu) in |
329 |
- niagara[234]) |
330 |
- if version_is_at_least 2.8 ; then |
331 |
- cpu="sparcv9v2" |
332 |
- elif version_is_at_least 2.4 ; then |
333 |
- cpu="sparcv9v" |
334 |
- elif version_is_at_least 2.2.3 ; then |
335 |
- cpu="sparcv9b" |
336 |
- else |
337 |
- cpu="sparcv9" |
338 |
- fi |
339 |
- ;; |
340 |
- niagara) |
341 |
- if version_is_at_least 2.4 ; then |
342 |
- cpu="sparcv9v" |
343 |
- elif version_is_at_least 2.2.3 ; then |
344 |
- cpu="sparcv9b" |
345 |
- else |
346 |
- cpu="sparcv9" |
347 |
- fi |
348 |
- ;; |
349 |
- ultrasparc3) |
350 |
- cpu="sparcv9b" |
351 |
- ;; |
352 |
- v9|ultrasparc) |
353 |
- cpu="sparcv9" |
354 |
- ;; |
355 |
- v8|supersparc|hypersparc|leon|leon3) |
356 |
- cpu="sparcv8" |
357 |
- ;; |
358 |
- esac |
359 |
- ;; |
360 |
- esac |
361 |
- [[ -n ${cpu} ]] && CTARGET_OPT="${cpu}-${CTARGET#*-}" |
362 |
- ;; |
363 |
- esac |
364 |
-} |
365 |
- |
366 |
-setup_flags() { |
367 |
- # Make sure host make.conf doesn't pollute us |
368 |
- if is_crosscompile || tc-is-cross-compiler ; then |
369 |
- CHOST=${CTARGET} strip-unsupported-flags |
370 |
- fi |
371 |
- |
372 |
- # Store our CFLAGS because it's changed depending on which CTARGET |
373 |
- # we are building when pulling glibc on a multilib profile |
374 |
- CFLAGS_BASE=${CFLAGS_BASE-${CFLAGS}} |
375 |
- CFLAGS=${CFLAGS_BASE} |
376 |
- CXXFLAGS_BASE=${CXXFLAGS_BASE-${CXXFLAGS}} |
377 |
- CXXFLAGS=${CXXFLAGS_BASE} |
378 |
- ASFLAGS_BASE=${ASFLAGS_BASE-${ASFLAGS}} |
379 |
- ASFLAGS=${ASFLAGS_BASE} |
380 |
- |
381 |
- # Over-zealous CFLAGS can often cause problems. What may work for one |
382 |
- # person may not work for another. To avoid a large influx of bugs |
383 |
- # relating to failed builds, we strip most CFLAGS out to ensure as few |
384 |
- # problems as possible. |
385 |
- strip-flags |
386 |
- strip-unsupported-flags |
387 |
- filter-flags -m32 -m64 '-mabi=*' |
388 |
- |
389 |
- # glibc aborts if rpath is set by LDFLAGS |
390 |
- filter-ldflags '-Wl,-rpath=*' |
391 |
- |
392 |
- # #492892 |
393 |
- filter-flags -frecord-gcc-switches |
394 |
- |
395 |
- unset CBUILD_OPT CTARGET_OPT |
396 |
- if use multilib ; then |
397 |
- CTARGET_OPT=$(get_abi_CTARGET) |
398 |
- [[ -z ${CTARGET_OPT} ]] && CTARGET_OPT=$(get_abi_CHOST) |
399 |
- fi |
400 |
- |
401 |
- setup_target_flags |
402 |
- |
403 |
- if [[ -n ${CTARGET_OPT} && ${CBUILD} == ${CHOST} ]] && ! is_crosscompile; then |
404 |
- CBUILD_OPT=${CTARGET_OPT} |
405 |
- fi |
406 |
- |
407 |
- # Lock glibc at -O2; we want to be conservative here. |
408 |
- # -fno-strict-aliasing is to work around #155906. |
409 |
- filter-flags '-O?' |
410 |
- append-flags -O2 -fno-strict-aliasing |
411 |
- |
412 |
- filter-flags '-fstack-protector*' |
413 |
- |
414 |
- # Starting with gcc-6 (and fully upstreamed pie patches) we control |
415 |
- # default enabled/disabled pie via use flags. So nothing to do |
416 |
- # here then. #618160 |
417 |
- if [[ $(gcc-major-version) -lt 6 ]]; then |
418 |
- if use hardened && tc-enables-pie ; then |
419 |
- # Force PIC macro definition for all compilations since they're all |
420 |
- # either -fPIC or -fPIE with the default-PIE compiler. |
421 |
- append-cppflags -DPIC |
422 |
- else |
423 |
- # Don't build -fPIE without the default-PIE compiler and the |
424 |
- # hardened-pie patch |
425 |
- filter-flags -fPIE |
426 |
- fi |
427 |
- fi |
428 |
-} |
429 |
- |
430 |
-want_tls() { |
431 |
- # Archs that can use TLS (Thread Local Storage) |
432 |
- case $(tc-arch) in |
433 |
- x86) |
434 |
- # requires i486 or better #106556 |
435 |
- [[ ${CTARGET} == i[4567]86* ]] && return 0 |
436 |
- return 1 |
437 |
- ;; |
438 |
- esac |
439 |
- return 0 |
440 |
-} |
441 |
- |
442 |
-want__thread() { |
443 |
- want_tls || return 1 |
444 |
- |
445 |
- # For some reason --with-tls --with__thread is causing segfaults on sparc32. |
446 |
- [[ ${PROFILE_ARCH} == "sparc" ]] && return 1 |
447 |
- |
448 |
- [[ -n ${WANT__THREAD} ]] && return ${WANT__THREAD} |
449 |
- |
450 |
- # only test gcc -- can't test linking yet |
451 |
- tc-has-tls -c ${CTARGET} |
452 |
- WANT__THREAD=$? |
453 |
- |
454 |
- return ${WANT__THREAD} |
455 |
-} |
456 |
- |
457 |
-use_multiarch() { |
458 |
- # Make sure binutils is new enough to support indirect functions, |
459 |
- # #336792. This funky sed supports gold and bfd linkers. |
460 |
- local bver nver |
461 |
- bver=$($(tc-getLD ${CTARGET}) -v | sed -n -r '1{s:[^0-9]*::;s:^([0-9.]*).*:\1:;p}') |
462 |
- case $(tc-arch ${CTARGET}) in |
463 |
- amd64|x86) nver="2.20" ;; |
464 |
- arm) nver="2.22" ;; |
465 |
- hppa) nver="2.23" ;; |
466 |
- ppc|ppc64) nver="2.20" ;; |
467 |
- # ifunc support was added in 2.23, but glibc also needs |
468 |
- # machinemode which is in 2.24. |
469 |
- s390) nver="2.24" ;; |
470 |
- sparc) nver="2.21" ;; |
471 |
- *) return 1 ;; |
472 |
- esac |
473 |
- version_is_at_least ${nver} ${bver} |
474 |
-} |
475 |
- |
476 |
-# Setup toolchain variables that had historically been defined in the |
477 |
-# profiles for these archs. |
478 |
-setup_env() { |
479 |
- # silly users |
480 |
- unset LD_RUN_PATH |
481 |
- unset LD_ASSUME_KERNEL |
482 |
- |
483 |
- if is_crosscompile || tc-is-cross-compiler ; then |
484 |
- multilib_env ${CTARGET_OPT:-${CTARGET}} |
485 |
- |
486 |
- if ! use multilib ; then |
487 |
- MULTILIB_ABIS=${DEFAULT_ABI} |
488 |
- else |
489 |
- MULTILIB_ABIS=${MULTILIB_ABIS:-${DEFAULT_ABI}} |
490 |
- fi |
491 |
- |
492 |
- # If the user has CFLAGS_<CTARGET> in their make.conf, use that, |
493 |
- # and fall back on CFLAGS. |
494 |
- local VAR=CFLAGS_${CTARGET//[-.]/_} |
495 |
- CFLAGS=${!VAR-${CFLAGS}} |
496 |
- einfo " $(printf '%15s' 'Manual CFLAGS:') ${CFLAGS}" |
497 |
- fi |
498 |
- |
499 |
- setup_flags |
500 |
- |
501 |
- export ABI=${ABI:-${DEFAULT_ABI:-default}} |
502 |
- |
503 |
- if use headers-only ; then |
504 |
- # Avoid mixing host's CC and target's CFLAGS_${ABI}: |
505 |
- # At this bootstrap stage we have only binutils for |
506 |
- # target but not compiler yet. |
507 |
- einfo "Skip CC ABI injection. We can't use (cross-)compiler yet." |
508 |
- return 0 |
509 |
- fi |
510 |
- local VAR=CFLAGS_${ABI} |
511 |
- # We need to export CFLAGS with abi information in them because glibc's |
512 |
- # configure script checks CFLAGS for some targets (like mips). Keep |
513 |
- # around the original clean value to avoid appending multiple ABIs on |
514 |
- # top of each other. |
515 |
- : ${__GLIBC_CC:=$(tc-getCC ${CTARGET_OPT:-${CTARGET}})} |
516 |
- export __GLIBC_CC CC="${__GLIBC_CC} ${!VAR}" |
517 |
- einfo " $(printf '%15s' 'Manual CC:') ${CC}" |
518 |
-} |
519 |
- |
520 |
-foreach_abi() { |
521 |
- setup_env |
522 |
- |
523 |
- local ret=0 |
524 |
- local abilist="" |
525 |
- if use multilib ; then |
526 |
- abilist=$(get_install_abis) |
527 |
- else |
528 |
- abilist=${DEFAULT_ABI} |
529 |
- fi |
530 |
- local -x ABI |
531 |
- for ABI in ${abilist:-default} ; do |
532 |
- setup_env |
533 |
- einfo "Running $1 for ABI ${ABI}" |
534 |
- $1 |
535 |
- : $(( ret |= $? )) |
536 |
- done |
537 |
- return ${ret} |
538 |
-} |
539 |
- |
540 |
-glibc_banner() { |
541 |
- local b="Gentoo ${PVR}" |
542 |
- [[ -n ${PATCH_VER} ]] && ! use vanilla && b+=" p${PATCH_VER}" |
543 |
- echo "${b}" |
544 |
-} |
545 |
- |
546 |
-check_devpts() { |
547 |
- # Make sure devpts is mounted correctly for use w/out setuid pt_chown. |
548 |
- |
549 |
- # If merely building the binary package, then there's nothing to verify. |
550 |
- [[ ${MERGE_TYPE} == "buildonly" ]] && return |
551 |
- |
552 |
- # Only sanity check when installing the native glibc. |
553 |
- [[ ${ROOT} != "/" ]] && return |
554 |
- |
555 |
- # If they're opting in to the old suid code, then no need to check. |
556 |
- use suid && return |
557 |
- |
558 |
- if awk '$3 == "devpts" && $4 ~ /[, ]gid=5[, ]/ { exit 1 }' /proc/mounts ; then |
559 |
- eerror "In order to use glibc with USE=-suid, you must make sure that" |
560 |
- eerror "you have devpts mounted at /dev/pts with the gid=5 option." |
561 |
- eerror "Openrc should do this for you, so you should check /etc/fstab" |
562 |
- eerror "and make sure you do not have any invalid settings there." |
563 |
- die "mount & fix your /dev/pts settings" |
564 |
- fi |
565 |
-} |
566 |
- |
567 |
-# The following Kernel version handling functions are mostly copied from portage |
568 |
-# source. It's better not to use linux-info.eclass here since a) it adds too |
569 |
-# much magic, see bug 326693 for some of the arguments, and b) some of the |
570 |
-# functions are just not provided. |
571 |
- |
572 |
-g_get_running_KV() { |
573 |
- uname -r |
574 |
- return $? |
575 |
-} |
576 |
- |
577 |
-g_KV_major() { |
578 |
- [[ -z $1 ]] && return 1 |
579 |
- local KV=$@ |
580 |
- echo "${KV%%.*}" |
581 |
-} |
582 |
- |
583 |
-g_KV_minor() { |
584 |
- [[ -z $1 ]] && return 1 |
585 |
- local KV=$@ |
586 |
- KV=${KV#*.} |
587 |
- echo "${KV%%.*}" |
588 |
-} |
589 |
- |
590 |
-g_KV_micro() { |
591 |
- [[ -z $1 ]] && return 1 |
592 |
- local KV=$@ |
593 |
- KV=${KV#*.*.} |
594 |
- echo "${KV%%[^[:digit:]]*}" |
595 |
-} |
596 |
- |
597 |
-g_KV_to_int() { |
598 |
- [[ -z $1 ]] && return 1 |
599 |
- local KV_MAJOR=$(g_KV_major "$1") |
600 |
- local KV_MINOR=$(g_KV_minor "$1") |
601 |
- local KV_MICRO=$(g_KV_micro "$1") |
602 |
- local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) |
603 |
- |
604 |
- # We make version 2.2.0 the minimum version we will handle as |
605 |
- # a sanity check ... if its less, we fail ... |
606 |
- if [[ ${KV_int} -ge 131584 ]] ; then |
607 |
- echo "${KV_int}" |
608 |
- return 0 |
609 |
- fi |
610 |
- return 1 |
611 |
-} |
612 |
- |
613 |
-g_int_to_KV() { |
614 |
- local version=$1 major minor micro |
615 |
- major=$((version / 65536)) |
616 |
- minor=$(((version % 65536) / 256)) |
617 |
- micro=$((version % 256)) |
618 |
- echo ${major}.${minor}.${micro} |
619 |
-} |
620 |
- |
621 |
-eend_KV() { |
622 |
- [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]] |
623 |
- eend $? |
624 |
-} |
625 |
- |
626 |
-get_kheader_version() { |
627 |
- printf '#include <linux/version.h>\nLINUX_VERSION_CODE\n' | \ |
628 |
- $(tc-getCPP ${CTARGET}) -I "${EPREFIX}/$(alt_build_headers)" - | \ |
629 |
- tail -n 1 |
630 |
-} |
631 |
- |
632 |
-# We collect all sanity checks here. Consistency is not guranteed between |
633 |
-# pkg_ and src_ phases, so we call this function both in pkg_pretend and in |
634 |
-# src_unpack. |
635 |
-sanity_prechecks() { |
636 |
+pkg_pretend() { |
637 |
# Make sure devpts is mounted correctly for use w/out setuid pt_chown |
638 |
check_devpts |
639 |
|
640 |
@@ -598,21 +118,30 @@ sanity_prechecks() { |
641 |
[[ ${ROOT} == "/" ]] && \ |
642 |
[[ ${CBUILD} == ${CHOST} ]] && \ |
643 |
[[ ${CHOST} == ${CTARGET} ]] ; then |
644 |
- |
645 |
- # The high rev # is to allow people to downgrade between -r# |
646 |
- # versions. We want to block 2.20->2.19, but 2.20-r3->2.20-r2 |
647 |
- # should be fine. Hopefully we never actually use a r# this |
648 |
- # high. |
649 |
+ # The high rev # is to allow people to downgrade between -r# versions. |
650 |
+ # We want to block 2.20->2.19, but 2.20-r3->2.20-r2 should be fine. |
651 |
+ # Hopefully we never actually use a r# this high. |
652 |
if has_version ">${CATEGORY}/${P}-r10000" ; then |
653 |
eerror "Sanity check to keep you from breaking your system:" |
654 |
- eerror " Downgrading glibc is not supported and a sure way to destruction." |
655 |
- die "Aborting to save your system." |
656 |
+ eerror " Downgrading glibc is not supported and a sure way to destruction" |
657 |
+ die "Aborting to save your system" |
658 |
+ fi |
659 |
+ |
660 |
+ if ! glibc_run_test '#include <pwd.h>\nint main(){return getpwuid(0)==0;}\n' |
661 |
+ then |
662 |
+ eerror "Your patched vendor kernel is broken. You need to get an" |
663 |
+ eerror "update from whoever is providing the kernel to you." |
664 |
+ eerror "https://sourceware.org/bugzilla/show_bug.cgi?id=5227" |
665 |
+ eerror "https://bugs.gentoo.org/262698" |
666 |
+ die "Keeping your system alive, say thank you" |
667 |
fi |
668 |
|
669 |
- if ! do_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' ; then |
670 |
- eerror "Your old kernel is broken. You need to update it to a newer" |
671 |
- eerror "version as syscall(<bignum>) will break. See bug 279260." |
672 |
- die "Old and broken kernel." |
673 |
+ if ! glibc_run_test '#include <unistd.h>\n#include <sys/syscall.h>\nint main(){return syscall(1000)!=-1;}\n' |
674 |
+ then |
675 |
+ eerror "Your old kernel is broken. You need to update it to" |
676 |
+ eerror "a newer version as syscall(<bignum>) will break." |
677 |
+ eerror "https://bugs.gentoo.org/279260" |
678 |
+ die "Keeping your system alive, say thank you" |
679 |
fi |
680 |
fi |
681 |
|
682 |
@@ -639,6 +168,30 @@ sanity_prechecks() { |
683 |
use hardened && ! tc-enables-pie && \ |
684 |
ewarn "PIE hardening not applied, as your compiler doesn't default to PIE" |
685 |
|
686 |
+ # Make sure host system is up to date #394453 |
687 |
+ if has_version '<sys-libs/glibc-2.13' && \ |
688 |
+ [[ -n $(scanelf -qys__guard -F'#s%F' "${EROOT}"/lib*/l*-*.so) ]] |
689 |
+ then |
690 |
+ ebegin "Scanning system for __guard to see if you need to rebuild first ..." |
691 |
+ local files=$( |
692 |
+ scanelf -qys__guard -F'#s%F' \ |
693 |
+ "${EROOT}"/*bin/ \ |
694 |
+ "${EROOT}"/lib* \ |
695 |
+ "${EROOT}"/usr/*bin/ \ |
696 |
+ "${EROOT}"/usr/lib* | \ |
697 |
+ egrep -v \ |
698 |
+ -e "^${EROOT}/lib.*/(libc|ld)-2.*.so$" \ |
699 |
+ -e "^${EROOT}/sbin/(ldconfig|sln)$" |
700 |
+ ) |
701 |
+ [[ -z ${files} ]] |
702 |
+ if ! eend $? ; then |
703 |
+ eerror "Your system still has old SSP __guard symbols. You need to" |
704 |
+ eerror "rebuild all the packages that provide these files first:" |
705 |
+ eerror "${files}" |
706 |
+ die "old __guard detected" |
707 |
+ fi |
708 |
+ fi |
709 |
+ |
710 |
# Check for sanity of /etc/nsswitch.conf |
711 |
if [[ -e ${EROOT}/etc/nsswitch.conf ]] ; then |
712 |
local entry |
713 |
@@ -653,97 +206,26 @@ sanity_prechecks() { |
714 |
fi |
715 |
done |
716 |
fi |
717 |
- |
718 |
- # ABI-specific checks follow here. Hey, we have a lot more specific conditions that |
719 |
- # we test for... |
720 |
- if ! is_crosscompile ; then |
721 |
- if use amd64 && use multilib && [[ ${MERGE_TYPE} != "binary" ]] ; then |
722 |
- ebegin "Checking that IA32 emulation is enabled in the running kernel" |
723 |
- echo 'int main(){return 0;}' > "${T}/check-ia32-emulation.c" |
724 |
- local STAT |
725 |
- if "${CC-${CHOST}-gcc}" ${CFLAGS_x86} "${T}/check-ia32-emulation.c" -o "${T}/check-ia32-emulation.elf32"; then |
726 |
- "${T}/check-ia32-emulation.elf32" |
727 |
- STAT=$? |
728 |
- else |
729 |
- # Don't fail here to allow single->multi ABI switch |
730 |
- # or recover from breakage like bug #646424 |
731 |
- ewarn "Failed to compile the ABI test. Broken host glibc?" |
732 |
- STAT=0 |
733 |
- fi |
734 |
- rm -f "${T}/check-ia32-emulation.elf32" |
735 |
- eend $STAT |
736 |
- [[ $STAT -eq 0 ]] || die "CONFIG_IA32_EMULATION must be enabled in the kernel to compile a multilib glibc." |
737 |
- fi |
738 |
- |
739 |
- fi |
740 |
- |
741 |
- # When we actually have to compile something... |
742 |
- if ! just_headers ; then |
743 |
- local run_kv build_kv want_kv |
744 |
- |
745 |
- run_kv=$(g_get_running_KV) |
746 |
- build_kv=$(g_int_to_KV $(get_kheader_version)) |
747 |
- want_kv=${MIN_KERN_VER} |
748 |
- |
749 |
- ebegin "Checking gcc for __thread support" |
750 |
- if ! eend $(want__thread ; echo $?) ; then |
751 |
- echo |
752 |
- eerror "Could not find a gcc that supports the __thread directive!" |
753 |
- eerror "Please update your binutils/gcc and try again." |
754 |
- die "No __thread support in gcc!" |
755 |
- fi |
756 |
- |
757 |
- if ! is_crosscompile && ! tc-is-cross-compiler ; then |
758 |
- # Building fails on an non-supporting kernel |
759 |
- ebegin "Checking running kernel version (${run_kv} >= ${want_kv})" |
760 |
- if ! eend_KV ${run_kv} ${want_kv} ; then |
761 |
- echo |
762 |
- eerror "You need a kernel of at least ${want_kv}!" |
763 |
- die "Kernel version too low!" |
764 |
- fi |
765 |
- fi |
766 |
- |
767 |
- ebegin "Checking linux-headers version (${build_kv} >= ${want_kv})" |
768 |
- if ! eend_KV ${build_kv} ${want_kv} ; then |
769 |
- echo |
770 |
- eerror "You need linux-headers of at least ${want_kv}!" |
771 |
- die "linux-headers version too low!" |
772 |
- fi |
773 |
- fi |
774 |
-} |
775 |
- |
776 |
-# |
777 |
-# the phases |
778 |
-# |
779 |
- |
780 |
-# pkg_pretend |
781 |
- |
782 |
-pkg_pretend() { |
783 |
- # All the checks... |
784 |
- einfo "Checking general environment sanity." |
785 |
- sanity_prechecks |
786 |
} |
787 |
|
788 |
-# src_unpack |
789 |
- |
790 |
src_unpack() { |
791 |
- # Consistency is not guaranteed between pkg_ and src_ ... |
792 |
- sanity_prechecks |
793 |
- |
794 |
- use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 |
795 |
+ use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz |
796 |
|
797 |
setup_env |
798 |
|
799 |
+ # Check NPTL support _before_ we unpack things to save some time |
800 |
+ check_nptl_support |
801 |
+ |
802 |
if [[ -n ${EGIT_REPO_URI} ]] ; then |
803 |
git-r3_src_unpack |
804 |
else |
805 |
unpack ${P}.tar.xz |
806 |
fi |
807 |
|
808 |
- cd "${S}" || die |
809 |
- touch locale/C-translit.h || die #185476 #218003 |
810 |
+ cd "${S}" |
811 |
+ touch locale/C-translit.h #185476 #218003 |
812 |
|
813 |
- cd "${WORKDIR}" || die |
814 |
+ cd "${WORKDIR}" |
815 |
unpack glibc-${RELEASE_VER}-patches-${PATCH_VER}.tar.bz2 |
816 |
} |
817 |
|
818 |
@@ -754,6 +236,16 @@ src_prepare() { |
819 |
einfo "Done." |
820 |
fi |
821 |
|
822 |
+ if just_headers ; then |
823 |
+ if [[ -e ports/sysdeps/mips/preconfigure ]] ; then |
824 |
+ # mips peeps like to screw with us. if building headers, |
825 |
+ # we don't have a real compiler, so we can't let them |
826 |
+ # insert -mabi on us. |
827 |
+ sed -i '/CPPFLAGS=.*-mabi/s|.*|:|' ports/sysdeps/mips/preconfigure || die |
828 |
+ find ports/sysdeps/mips/ -name Makefile -exec sed -i '/^CC.*-mabi=/s:-mabi=.*:-D_MIPS_SZPTR=32:' {} + |
829 |
+ fi |
830 |
+ fi |
831 |
+ |
832 |
default |
833 |
|
834 |
gnuconfig_update |
835 |
@@ -775,6 +267,14 @@ src_prepare() { |
836 |
einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler" |
837 |
cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die |
838 |
cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die |
839 |
+ |
840 |
+ if use debug ; then |
841 |
+ # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested. |
842 |
+ sed -i \ |
843 |
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ |
844 |
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ |
845 |
+ debug/Makefile || die |
846 |
+ fi |
847 |
fi |
848 |
} |
849 |
|
850 |
@@ -786,7 +286,7 @@ glibc_do_configure() { |
851 |
# we accumulate crap across abis |
852 |
unset CXX |
853 |
|
854 |
- einfo "Configuring glibc for nptl" |
855 |
+ einfo "Configuring glibc for $1" |
856 |
|
857 |
if use doc ; then |
858 |
export MAKEINFO=makeinfo |
859 |
@@ -811,6 +311,18 @@ glibc_do_configure() { |
860 |
|
861 |
local myconf=() |
862 |
|
863 |
+ # set addons |
864 |
+ pushd "${S}" > /dev/null |
865 |
+ local addons=$(echo */configure | sed \ |
866 |
+ -e 's:/configure::g' \ |
867 |
+ -e 's:\(linuxthreads\|nptl\|rtkaio\|glibc-compat\)\( \|$\)::g' \ |
868 |
+ -e 's: \+$::' \ |
869 |
+ -e 's! !,!g' \ |
870 |
+ -e 's!^!,!' \ |
871 |
+ -e '/^,\*$/d') |
872 |
+ [[ -d ports ]] && addons+=",ports" |
873 |
+ popd > /dev/null |
874 |
+ |
875 |
case ${CTARGET} in |
876 |
powerpc-*) |
877 |
# Currently gcc on powerpc32 generates invalid code for |
878 |
@@ -839,7 +351,12 @@ glibc_do_configure() { |
879 |
|
880 |
[[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp ) |
881 |
|
882 |
- myconf+=( --enable-kernel=${MIN_KERN_VER} ) |
883 |
+ if [[ $1 == "nptl" ]] ; then |
884 |
+ myconf+=( --enable-kernel=${NPTL_KERN_VER} ) |
885 |
+ else |
886 |
+ die "invalid pthread option" |
887 |
+ fi |
888 |
+ myconf+=( --enable-add-ons="${addons#,}" ) |
889 |
|
890 |
# Since SELinux support is only required for nscd, only enable it if: |
891 |
# 1. USE selinux |
892 |
@@ -908,7 +425,7 @@ glibc_do_configure() { |
893 |
# this overriding check. #347761 |
894 |
export libc_cv_hashstyle=no |
895 |
|
896 |
- local builddir=$(builddir nptl) |
897 |
+ local builddir=$(builddir "$1") |
898 |
mkdir -p "${builddir}" |
899 |
cd "${builddir}" |
900 |
set -- "${S}"/configure "${myconf[@]}" |
901 |
@@ -929,11 +446,10 @@ glibc_do_configure() { |
902 |
# to lie and use a local copy of gcc. Like if the system |
903 |
# is built with MULTILIB_ABIS="amd64 x86" but we want to |
904 |
# add x32 to it, gcc/glibc don't yet support x32. |
905 |
- # |
906 |
if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then |
907 |
echo 'main(){}' > "${T}"/test.c |
908 |
if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then |
909 |
- sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
910 |
+ sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
911 |
fi |
912 |
fi |
913 |
} |
914 |
@@ -954,7 +470,6 @@ glibc_headers_configure() { |
915 |
libc_cv_asm_cfi_directives=yes |
916 |
libc_cv_broken_visibility_attribute=no |
917 |
libc_cv_c_cleanup=yes |
918 |
- libc_cv_compiler_powerpc64le_binary128_ok=yes |
919 |
libc_cv_forced_unwind=yes |
920 |
libc_cv_gcc___thread=yes |
921 |
libc_cv_mlong_double_128=yes |
922 |
@@ -962,7 +477,6 @@ glibc_headers_configure() { |
923 |
libc_cv_ppc_machine=yes |
924 |
libc_cv_ppc_rel16=yes |
925 |
libc_cv_predef_fortify_source=no |
926 |
- libc_cv_target_power8_ok=yes |
927 |
libc_cv_visibility_attribute=yes |
928 |
libc_cv_z_combreloc=yes |
929 |
libc_cv_z_execstack=yes |
930 |
@@ -983,8 +497,6 @@ glibc_headers_configure() { |
931 |
export ${v} |
932 |
done |
933 |
|
934 |
- local headers_only_arch_CPPFLAGS=() |
935 |
- |
936 |
# Blow away some random CC settings that screw things up. #550192 |
937 |
if [[ -d ${S}/sysdeps/mips ]]; then |
938 |
pushd "${S}"/sysdeps/mips >/dev/null |
939 |
@@ -1001,25 +513,6 @@ glibc_headers_configure() { |
940 |
popd >/dev/null |
941 |
fi |
942 |
|
943 |
- case ${CTARGET} in |
944 |
- riscv*) |
945 |
- # RISC-V interrogates the compiler to determine which target to |
946 |
- # build. If building the headers then we don't strictly need a |
947 |
- # RISC-V compiler, so the built-in definitions that are provided |
948 |
- # along with all RISC-V compiler might not exist. This causes |
949 |
- # glibc's RISC-V preconfigure script to blow up. Since we're just |
950 |
- # building the headers any value will actually work here, so just |
951 |
- # pick the standard one (rv64g/lp64d) to make the build scripts |
952 |
- # happy for now -- the headers are all the same anyway so it |
953 |
- # doesn't matter. |
954 |
- headers_only_arch_CPPFLAGS+=( |
955 |
- -D__riscv_xlen=64 |
956 |
- -D__riscv_flen=64 |
957 |
- -D__riscv_float_abi_double=1 |
958 |
- -D__riscv_atomic=1 |
959 |
- ) ;; |
960 |
- esac |
961 |
- |
962 |
local myconf=() |
963 |
myconf+=( |
964 |
--disable-sanity-checks |
965 |
@@ -1034,11 +527,15 @@ glibc_headers_configure() { |
966 |
${EXTRA_ECONF} |
967 |
) |
968 |
|
969 |
+ local addons |
970 |
+ [[ -d ${S}/ports ]] && addons+=",ports" |
971 |
+ myconf+=( --enable-add-ons="${addons#,}" ) |
972 |
+ |
973 |
# Nothing is compiled here which would affect the headers for the target. |
974 |
# So forcing CC/CFLAGS is sane. |
975 |
local headers_only_CC=$(tc-getBUILD_CC) |
976 |
local headers_only_CFLAGS="-O1 -pipe" |
977 |
- local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE ${headers_only_arch_CPPFLAGS[*]}" |
978 |
+ local headers_only_CPPFLAGS="-U_FORTIFY_SOURCE" |
979 |
local headers_only_LDFLAGS="" |
980 |
set -- "${S}"/configure "${myconf[@]}" |
981 |
echo \ |
982 |
@@ -1079,14 +576,14 @@ src_compile() { |
983 |
} |
984 |
|
985 |
glibc_src_test() { |
986 |
- cd "$(builddir nptl)" |
987 |
+ cd "$(builddir $1)" |
988 |
emake check |
989 |
} |
990 |
|
991 |
do_src_test() { |
992 |
local ret=0 |
993 |
|
994 |
- glibc_src_test |
995 |
+ glibc_src_test nptl |
996 |
: $(( ret |= $? )) |
997 |
|
998 |
return ${ret} |
999 |
@@ -1096,26 +593,12 @@ src_test() { |
1000 |
if just_headers ; then |
1001 |
return |
1002 |
fi |
1003 |
- |
1004 |
# Give tests more time to complete. |
1005 |
export TIMEOUTFACTOR=5 |
1006 |
|
1007 |
foreach_abi do_src_test || die "tests failed" |
1008 |
} |
1009 |
|
1010 |
-run_locale_gen() { |
1011 |
- # if the host locales.gen contains no entries, we'll install everything |
1012 |
- local root="$1" |
1013 |
- local locale_list="${root}/etc/locale.gen" |
1014 |
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then |
1015 |
- ewarn "Generating all locales; edit /etc/locale.gen to save time/space" |
1016 |
- locale_list="${root}/usr/share/i18n/SUPPORTED" |
1017 |
- fi |
1018 |
- |
1019 |
- locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \ |
1020 |
- --destdir "${root}" |
1021 |
-} |
1022 |
- |
1023 |
glibc_do_src_install() { |
1024 |
local builddir=$(builddir nptl) |
1025 |
cd "${builddir}" |
1026 |
@@ -1274,19 +757,13 @@ glibc_do_src_install() { |
1027 |
echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc |
1028 |
doenvd "${T}"/00glibc |
1029 |
|
1030 |
- for d in BUGS ChangeLog CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do |
1031 |
+ for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do |
1032 |
[[ -s ${d} ]] && dodoc ${d} |
1033 |
done |
1034 |
- dodoc -r ChangeLog.old |
1035 |
|
1036 |
# Prevent overwriting of the /etc/localtime symlink. We'll handle the |
1037 |
# creation of the "factory" symlink in pkg_postinst(). |
1038 |
rm -f "${ED}"/etc/localtime |
1039 |
- |
1040 |
- # Generate all locales if this is a native build as locale generation |
1041 |
- if use compile-locales && ! is_crosscompile ; then |
1042 |
- run_locale_gen "${ED}" |
1043 |
- fi |
1044 |
} |
1045 |
|
1046 |
glibc_headers_install() { |
1047 |
@@ -1303,23 +780,6 @@ glibc_headers_install() { |
1048 |
dosym usr/include $(alt_prefix)/sys-include |
1049 |
} |
1050 |
|
1051 |
-src_strip() { |
1052 |
- # gdb is lame and requires some debugging information to remain in |
1053 |
- # libpthread, so we need to strip it by hand. libthread_db makes no |
1054 |
- # sense stripped as it is only used when debugging. |
1055 |
- local pthread=$(has splitdebug ${FEATURES} && echo "libthread_db" || echo "lib{pthread,thread_db}") |
1056 |
- env \ |
1057 |
- -uRESTRICT \ |
1058 |
- CHOST=${CTARGET} \ |
1059 |
- STRIP_MASK="/*/{,tls/}${pthread}*" \ |
1060 |
- prepallstrip |
1061 |
- # if user has stripping enabled and does not have split debug turned on, |
1062 |
- # then leave the debugging sections in libpthread. |
1063 |
- if ! has nostrip ${FEATURES} && ! has splitdebug ${FEATURES} ; then |
1064 |
- ${STRIP:-${CTARGET}-strip} --strip-debug "${ED}"$(alt_prefix)/*/libpthread-*.so |
1065 |
- fi |
1066 |
-} |
1067 |
- |
1068 |
src_install() { |
1069 |
if just_headers ; then |
1070 |
export ABI=default |
1071 |
@@ -1331,43 +791,6 @@ src_install() { |
1072 |
src_strip |
1073 |
} |
1074 |
|
1075 |
-# Simple test to make sure our new glibc isn't completely broken. |
1076 |
-# Make sure we don't test with statically built binaries since |
1077 |
-# they will fail. Also, skip if this glibc is a cross compiler. |
1078 |
-# |
1079 |
-# If coreutils is built with USE=multicall, some of these files |
1080 |
-# will just be wrapper scripts, not actual ELFs we can test. |
1081 |
-glibc_sanity_check() { |
1082 |
- cd / #228809 |
1083 |
- |
1084 |
- # We enter ${ED} so to avoid trouble if the path contains |
1085 |
- # special characters; for instance if the path contains the |
1086 |
- # colon character (:), then the linker will try to split it |
1087 |
- # and look for the libraries in an unexpected place. This can |
1088 |
- # lead to unsafe code execution if the generated prefix is |
1089 |
- # within a world-writable directory. |
1090 |
- # (e.g. /var/tmp/portage:${HOSTNAME}) |
1091 |
- pushd "${ED}"/$(get_libdir) >/dev/null |
1092 |
- |
1093 |
- local x striptest |
1094 |
- for x in cal date env free ls true uname uptime ; do |
1095 |
- x=$(type -p ${x}) |
1096 |
- [[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue |
1097 |
- striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue |
1098 |
- case ${striptest} in |
1099 |
- *"statically linked"*) continue;; |
1100 |
- *"ASCII text"*) continue;; |
1101 |
- esac |
1102 |
- # We need to clear the locale settings as the upgrade might want |
1103 |
- # incompatible locale data. This test is not for verifying that. |
1104 |
- LC_ALL=C \ |
1105 |
- ./ld-*.so --library-path . ${x} > /dev/null \ |
1106 |
- || die "simple run test (${x}) failed" |
1107 |
- done |
1108 |
- |
1109 |
- popd >/dev/null |
1110 |
-} |
1111 |
- |
1112 |
pkg_preinst() { |
1113 |
# nothing to do if just installing headers |
1114 |
just_headers && return |
1115 |
@@ -1400,7 +823,13 @@ pkg_postinst() { |
1116 |
# errors from this step #253697 |
1117 |
/sbin/telinit U 2>/dev/null |
1118 |
|
1119 |
- use compile-locales || run_locale_gen "${EROOT}" |
1120 |
+ # if the host locales.gen contains no entries, we'll install everything |
1121 |
+ local locale_list="${EROOT}etc/locale.gen" |
1122 |
+ if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then |
1123 |
+ ewarn "Generating all locales; edit /etc/locale.gen to save time/space" |
1124 |
+ locale_list="${EROOT}usr/share/i18n/SUPPORTED" |
1125 |
+ fi |
1126 |
+ locale-gen -j $(makeopts_jobs) --config "${locale_list}" |
1127 |
fi |
1128 |
|
1129 |
# Check for sanity of /etc/nsswitch.conf, take 2 |
1130 |
|
1131 |
diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-2.27-r2.ebuild |
1132 |
similarity index 98% |
1133 |
copy from sys-libs/glibc/glibc-9999.ebuild |
1134 |
copy to sys-libs/glibc/glibc-2.27-r2.ebuild |
1135 |
index ca23762e8d4..b45dd3a4921 100644 |
1136 |
--- a/sys-libs/glibc/glibc-9999.ebuild |
1137 |
+++ b/sys-libs/glibc/glibc-2.27-r2.ebuild |
1138 |
@@ -25,15 +25,15 @@ fi |
1139 |
|
1140 |
RELEASE_VER=${PV} |
1141 |
|
1142 |
-GCC_BOOTSTRAP_VER="4.7.3-r1" |
1143 |
+GCC_BOOTSTRAP_VER=20180501 |
1144 |
|
1145 |
# Gentoo patchset |
1146 |
-PATCH_VER=5 |
1147 |
+PATCH_VER=1 |
1148 |
|
1149 |
SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2" |
1150 |
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )" |
1151 |
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" |
1152 |
|
1153 |
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla" |
1154 |
+IUSE="audit caps compile-locales debug doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla" |
1155 |
|
1156 |
# Minimum kernel version that glibc requires |
1157 |
MIN_KERN_VER="3.2.0" |
1158 |
@@ -730,7 +730,7 @@ src_unpack() { |
1159 |
# Consistency is not guaranteed between pkg_ and src_ ... |
1160 |
sanity_prechecks |
1161 |
|
1162 |
- use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 |
1163 |
+ use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz |
1164 |
|
1165 |
setup_env |
1166 |
|
1167 |
@@ -775,6 +775,14 @@ src_prepare() { |
1168 |
einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler" |
1169 |
cp "${FILESDIR}"/2.20/glibc-2.20-gentoo-stack_chk_fail.c debug/stack_chk_fail.c || die |
1170 |
cp "${FILESDIR}"/2.25/glibc-2.25-gentoo-chk_fail.c debug/chk_fail.c || die |
1171 |
+ |
1172 |
+ if use debug ; then |
1173 |
+ # Allow SIGABRT to dump core on non-hardened systems, or when debug is requested. |
1174 |
+ sed -i \ |
1175 |
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-stack_chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ |
1176 |
+ -e '/^CFLAGS-backtrace.c/ iCPPFLAGS-chk_fail.c = -DSSP_SMASH_DUMPS_CORE' \ |
1177 |
+ debug/Makefile || die |
1178 |
+ fi |
1179 |
fi |
1180 |
} |
1181 |
|
1182 |
@@ -933,7 +941,7 @@ glibc_do_configure() { |
1183 |
if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then |
1184 |
echo 'main(){}' > "${T}"/test.c |
1185 |
if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then |
1186 |
- sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
1187 |
+ sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
1188 |
fi |
1189 |
fi |
1190 |
} |
1191 |
|
1192 |
diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild |
1193 |
index ca23762e8d4..7c5d09ab85a 100644 |
1194 |
--- a/sys-libs/glibc/glibc-9999.ebuild |
1195 |
+++ b/sys-libs/glibc/glibc-9999.ebuild |
1196 |
@@ -25,13 +25,13 @@ fi |
1197 |
|
1198 |
RELEASE_VER=${PV} |
1199 |
|
1200 |
-GCC_BOOTSTRAP_VER="4.7.3-r1" |
1201 |
+GCC_BOOTSTRAP_VER=20180501 |
1202 |
|
1203 |
# Gentoo patchset |
1204 |
PATCH_VER=5 |
1205 |
|
1206 |
SRC_URI+=" https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2" |
1207 |
-SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 )" |
1208 |
+SRC_URI+=" multilib? ( https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz )" |
1209 |
|
1210 |
IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd profile selinux suid systemtap vanilla" |
1211 |
|
1212 |
@@ -730,7 +730,7 @@ src_unpack() { |
1213 |
# Consistency is not guaranteed between pkg_ and src_ ... |
1214 |
sanity_prechecks |
1215 |
|
1216 |
- use multilib && unpack gcc-${GCC_BOOTSTRAP_VER}-multilib-bootstrap.tar.bz2 |
1217 |
+ use multilib && unpack gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz |
1218 |
|
1219 |
setup_env |
1220 |
|
1221 |
@@ -933,7 +933,7 @@ glibc_do_configure() { |
1222 |
if [[ -n ${GCC_BOOTSTRAP_VER} ]] && use multilib ; then |
1223 |
echo 'main(){}' > "${T}"/test.c |
1224 |
if ! $(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS} "${T}"/test.c -Wl,-emain -lgcc 2>/dev/null ; then |
1225 |
- sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
1226 |
+ sed -i -e '/^CC = /s:$: -B$(objdir)/../'"gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}/${ABI}:" config.make || die |
1227 |
fi |
1228 |
fi |
1229 |
} |