Update the newlib devel branch with stuf from /trunk.
-------- diffstat follows --------
/devel/newlib/configure | 8 4 4 0
/devel/newlib/scripts/build/kernel/linux.sh | 2 1 1 0
/devel/newlib/scripts/build/cc/gcc.sh | 34 22 12 0 +
/devel/newlib/scripts/build/debug/300-gdb.sh | 52 45 7 0 +
/devel/newlib/scripts/build/libc/uClibc.sh | 6 3 3 0
/devel/newlib/scripts/build/mpfr.sh | 2 1 1 0
/devel/newlib/scripts/crosstool-NG.sh.in | 20 18 2 0 +
/devel/newlib/scripts/functions | 44 34 10 0 +
/devel/newlib/patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch | 414 0 414 0 ----------
/devel/newlib/patches/glibc/2_9/140-regex-BZ9697.patch | 111 0 111 0 ---
/devel/newlib/patches/glibc/2_9/190-queue-header-updates.patch | 89 0 89 0 --
/devel/newlib/patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch | 249 0 249 0 ------
/devel/newlib/patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch | 32 0 32 0 -
/devel/newlib/patches/glibc/2_9/330-2.3.3-china.patch | 35 0 35 0 -
/devel/newlib/patches/glibc/2_9/270-ldbl-nexttowardf.patch | 68 0 68 0 --
/devel/newlib/patches/glibc/2_9/410-2.9-fnmatch.patch | 64 0 64 0 --
/devel/newlib/patches/glibc/2_9/340-new-valencian-locale.patch | 120 0 120 0 ---
/devel/newlib/patches/glibc/2_9/350-2.4-undefine-__i686.patch | 47 0 47 0 -
/devel/newlib/patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch | 53 0 53 0 -
/devel/newlib/patches/glibc/2_9/150-regex-BZ697.patch | 28 0 28 0 -
/devel/newlib/patches/glibc/2_9/420-dont-build-timezone.patch | 19 0 19 0 -
/devel/newlib/patches/glibc/2_9/290-no-inline-gmon.patch | 38 0 38 0 -
/devel/newlib/patches/glibc/2_9/280-section-comments.patch | 29 0 29 0 -
/devel/newlib/patches/glibc/2_9/180-math-tests.patch | 72 0 72 0 --
/devel/newlib/patches/glibc/2_9/250-resolv-dynamic.patch | 44 0 44 0 -
/devel/newlib/patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch | 35 0 35 0 -
/devel/newlib/patches/glibc/2_9/300-2.9-check_native-headers.patch | 22 0 22 0 -
/devel/newlib/patches/glibc/2_9/130-add_prio-macros.patch | 26 0 26 0 -
/devel/newlib/patches/glibc/2_9/310-2.3.6-fix-pr631.patch | 50 0 50 0 -
/devel/newlib/patches/glibc/2_9/510-sh-no-asm-user-header.patch | 70 0 70 0 --
/devel/newlib/patches/glibc/2_9/260-fadvise64_64.patch | 30 0 30 0 -
/devel/newlib/patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch | 249 0 249 0 ------
/devel/newlib/patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch | 35 0 35 0 -
/devel/newlib/patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch | 74 0 74 0 --
/devel/newlib/patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch | 18 0 18 0 -
/devel/newlib/patches/glibc/2_9/360-2.8-nscd-one-fork.patch | 45 0 45 0 -
/devel/newlib/patches/glibc/2_9/210-2.9-strlen-hack.patch | 109 0 109 0 ---
/devel/newlib/patches/glibc/2_9/320-2.9-assume-pipe2.patch | 59 0 59 0 -
/devel/newlib/patches/glibc/2_9/100-ssp-compat.patch | 193 0 193 0 -----
/devel/newlib/patches/glibc/2_9/110-respect-env-CPPFLAGS.patch | 30 0 30 0 -
/devel/newlib/patches/glibc/2_9/220-manual-no-perl.patch | 29 0 29 0 -
/devel/newlib/patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch | 35 0 35 0 -
/devel/newlib/patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch | 38 0 38 0 -
/devel/newlib/patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch | 198 0 198 0 -----
/devel/newlib/patches/glibc/2_9/520-sh-no-asm-elf-header.patch | 27 0 27 0 -
/devel/newlib/patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch | 23 0 23 0 -
/devel/newlib/patches/glibc/2_9/200-awk-in-C-locale.patch | 23 0 23 0 -
/devel/newlib/patches/glibc/2_9/430-2.7-cross-compile-nptl.patch | 57 0 57 0 -
/devel/newlib/patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch | 71 0 71 0 --
/devel/newlib/patches/glibc/2_9/490-ptr-mangling.patch | 114 0 114 0 ---
/devel/newlib/patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch | 19 0 19 0 -
/devel/newlib/patches/glibc/ports-2_9/100-arm_linux_tls.patch | 14 0 14 0 -
/devel/newlib/patches/uClibc/0.9.30.1/140-gnu89-inline.patch | 2 1 1 0
/devel/newlib/docs/known-issues.txt | 16 15 1 0 +
/devel/newlib/docs/overview.txt | 2 1 1 0
/devel/newlib/samples/armeb-unknown-linux-uclibc/uClibc-0.9.30.config | 243 0 243 0 ------
/devel/newlib/samples/armeb-unknown-linux-uclibc/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/sh4-unknown-linux-gnu/crosstool.config | 35 18 17 0 +
/devel/newlib/samples/x86_64-unknown-linux-gnu/crosstool.config | 104 68 36 0 +--
/devel/newlib/samples/arm-unknown-elf/crosstool.config | 54 47 7 0 +
/devel/newlib/samples/armeb-unknown-eabi/crosstool.config | 54 47 7 0 +
/devel/newlib/samples/arm-unknown-linux-gnueabi/crosstool.config | 113 73 40 0 +--
/devel/newlib/samples/ia64-unknown-linux-gnu/crosstool.config | 91 61 30 0 +-
/devel/newlib/samples/x86_64-unknown-linux-uclibc/uClibc-0.9.30.config | 245 0 245 0 ------
/devel/newlib/samples/x86_64-unknown-linux-uclibc/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/armeb-unknown-linux-gnueabi/crosstool.config | 105 69 36 0 +--
/devel/newlib/samples/powerpc-e500v2-linux-gnuspe/crosstool.config | 96 63 33 0 +-
/devel/newlib/samples/i686-nptl-linux-gnu/crosstool.config | 78 48 30 0 +-
/devel/newlib/samples/arm-unknown-linux-gnu/crosstool.config | 105 69 36 0 +--
/devel/newlib/samples/powerpc-unknown-linux-gnu/crosstool.config | 103 67 36 0 +-
/devel/newlib/samples/mips-unknown-linux-uclibc/uClibc-0.9.30.config | 254 0 254 0 ------
/devel/newlib/samples/mips-unknown-linux-uclibc/crosstool.config | 77 54 23 0 +-
/devel/newlib/samples/arm-unknown-linux-uclibcgnueabi/uClibc-0.9.30.config | 253 0 253 0 ------
/devel/newlib/samples/arm-unknown-linux-uclibcgnueabi/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/arm-iphone-linux-gnueabi/crosstool.config | 84 57 27 0 +-
/devel/newlib/samples/armeb-unknown-linux-gnu/crosstool.config | 105 69 36 0 +--
/devel/newlib/samples/powerpc-unknown_nofpu-linux-gnu/crosstool.config | 104 68 36 0 +--
/devel/newlib/samples/i586-geode-linux-uclibc/uClibc-0.9.30.config | 263 0 263 0 ------
/devel/newlib/samples/i586-geode-linux-uclibc/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/arm-unknown-linux-uclibc/uClibc-0.9.30.config | 253 0 253 0 ------
/devel/newlib/samples/arm-unknown-linux-uclibc/crosstool.config | 78 55 23 0 +-
/devel/newlib/samples/powerpc-unknown-linux-uclibc/uClibc-0.9.30.config | 248 0 248 0 ------
/devel/newlib/samples/powerpc-unknown-linux-uclibc/crosstool.config | 77 54 23 0 +-
/devel/newlib/samples/mips-unknown-elf/crosstool.config | 54 47 7 0 +
/devel/newlib/samples/powerpc-405-linux-gnu/crosstool.config | 104 68 36 0 +--
/devel/newlib/samples/armeb-unknown-linux-uclibcgnueabi/crosstool.config | 26 13 13 0
/devel/newlib/samples/arm-unknown-eabi/crosstool.config | 54 47 7 0 +
/devel/newlib/samples/mipsel-unknown-linux-gnu/crosstool.config | 104 68 36 0 +--
/devel/newlib/samples/powerpc64-unknown-linux-gnu/crosstool.config | 75 49 26 0 +-
/devel/newlib/samples/alphaev56-unknown-linux-gnu/crosstool.config | 94 63 31 0 +-
/devel/newlib/samples/powerpc-860-linux-gnu/crosstool.config | 102 67 35 0 +-
/devel/newlib/config/kernel/linux.in | 87 46 41 0 +-
/devel/newlib/config/cc/gcc.in | 35 30 5 0 +
/devel/newlib/config/debug/gdb.in | 2 1 1 0
94 files changed, 1851 insertions(+), 5813 deletions(-)
1 # This file adds functions to build glibc
2 # Copyright 2007 Yann E. MORIN
3 # Licensed under the GPL v2. See COPYING in the root of this package
10 if [ "${CT_LIBC_GLIBC_TARBALL}" = "y" ]; then
11 # Use release tarballs
12 CT_GetFile "glibc-${CT_LIBC_VERSION}" \
13 {ftp,http}://ftp.gnu.org/gnu/glibc \
14 ftp://gcc.gnu.org/pub/glibc/releases \
15 ftp://gcc.gnu.org/pub/glibc/snapshots
18 for addon in $(do_libc_add_ons_list " "); do
19 # NPTL addon is not to be downloaded, in any case
20 [ "${addon}" = "nptl" ] && continue || true
21 CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
22 {ftp,http}://ftp.gnu.org/gnu/glibc \
23 ftp://gcc.gnu.org/pub/glibc/releases \
24 ftp://gcc.gnu.org/pub/glibc/snapshots
26 elif [ "${CT_LIBC_GLIBC_CVS}" = "y" ]; then
28 version="${CT_LIBC_VERSION//./_}"
29 date="${CT_LIBC_GLIBC_CVS_date}"
31 CT_GetCVS "glibc-cvs-${CT_LIBC_VERSION}" \
32 ":pserver:anoncvs@sources.redhat.com:/cvs/glibc" \
34 "glibc-${version}-branch${date:+:}${date}" \
35 "glibc-cvs-${CT_LIBC_VERSION}"
38 for addon in $(do_libc_add_ons_list " "); do
39 # NPTL addon is not to be downloaded, in any case
40 [ "${addon}" = "nptl" ] && continue || true
41 CT_GetCVS "glibc-${addon}-cvs-${CT_LIBC_VERSION}" \
42 ":pserver:anoncvs@sources.redhat.com:/cvs/glibc" \
44 "glibc-${version}-branch${date:+:}${date}" \
45 "glibc-${addon}-cvs-${CT_LIBC_VERSION}"
47 # elif [ "${CT_LIBC_GLIBC_SNAPSHOT}" = "y" ]; then
48 # : # Not yet handled...
58 [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
60 CT_Extract "glibc-${cvs}${CT_LIBC_VERSION}"
62 CT_Pushd "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}"
63 CT_Patch "glibc-${CT_LIBC_VERSION}" nochdir
66 for addon in $(do_libc_add_ons_list " "); do
67 # NPTL addon is not to be extracted, in any case
68 [ "${addon}" = "nptl" ] && continue || true
69 CT_Extract "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" nochdir
71 # Some addons have the 'long' name, while others have the
72 # 'short' name, but patches are non-uniformly built with
73 # either the 'long' or 'short' name, whatever the addons name
74 # so we have to make symlinks from the existing to the missing
75 # Fortunately for us, [ -d foo ], when foo is a symlink to a
76 # directory, returns true!
77 [ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" "${addon}"
78 [ -d "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${cvs}${CT_LIBC_VERSION}"
79 CT_Patch "glibc-${addon}-${CT_LIBC_VERSION}" nochdir
82 # The configure files may be older than the configure.in files
83 # if using a snapshot (or even some tarballs). Fake them being
85 find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
92 # There is nothing to do for glibc check config
93 do_libc_check_config() {
97 # This function installs the glibc headers needed to build the core compiler
101 CT_DoStep INFO "Installing C library headers"
103 [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
105 mkdir -p "${CT_BUILD_DIR}/build-libc-headers"
106 cd "${CT_BUILD_DIR}/build-libc-headers"
108 CT_DoLog EXTRA "Configuring C library"
110 # The following three things have to be done to build glibc-2.3.x, but they don't hurt older versions.
111 # 1. override CC to keep glibc's configure from using $TARGET-gcc.
112 # 2. disable linuxthreads, which needs a real cross-compiler to generate tcb-offsets.h properly
113 # 3. build with gcc 3.2 or later
114 # Compare these options with the ones used when building glibc for real below - they're different.
115 # As of glibc-2.3.2, to get this step to work for hppa-linux, you need --enable-hacker-mode
116 # so when configure checks to make sure gcc has access to the assembler you just built...
117 # Alternately, we could put ${PREFIX}/${TARGET}/bin on the path.
118 # Set --build so maybe we don't have to specify "cross-compiling=yes" below (haven't tried yet)
120 # "*** WARNING: Are you sure you do not want to use the `linuxthreads'"
122 # is ok here, since all we want are the basic headers at this point.
123 # Override libc_cv_ppc_machine so glibc-cvs doesn't complain
124 # 'a version of binutils that supports .machine "altivec" is needed'.
126 addons_list="$(do_libc_add_ons_list ,)"
127 # We need to remove any threading addon when installing headers
128 addons_list="${addons_list//nptl/}"
129 addons_list="${addons_list//linuxthreads/}"
130 # Remove duplicate, leading and trailing separators
131 addons_config="--enable-add-ons=$(echo "${addons_list}" |sed -r -e 's/,+/,/; s/^,//; s/,$//g;')"
133 extra_config="${addons_config} $(do_libc_min_kernel_config)"
135 # Pre-seed the configparms file with values from the config option
136 echo "${CT_LIBC_GLIBC_CONFIGPARMS}" > configparms
138 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
139 CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
140 CT_DoLog DEBUG "Extra config passed : '${extra_config}'"
142 libc_cv_ppc_machine=yes \
145 "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/configure" \
146 --build="${CT_BUILD}" \
147 --host="${CT_TARGET}" \
149 --with-headers="${CT_HEADERS_DIR}" \
151 --disable-sanity-checks \
152 --enable-hacker-mode \
156 CT_DoLog EXTRA "Installing C library headers"
158 if grep -q GLIBC_2.3 "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/ChangeLog"; then
159 # glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c,
160 # which fails without a real cross-compiler.
161 # Fortunately, we don't need errlist-compat.c, since we just need .h
162 # files, so work around this by creating a fake errlist-compat.c and
163 # satisfying its dependencies.
164 # Another workaround might be to tell configure to not use any cross
166 # The real fix would be to get install-headers to not generate
168 # Note: BOOTSTRAP_GCC is used by:
169 # patches/glibc-2.3.5/glibc-mips-bootstrap-gcc-header-install.patch
171 libc_cv_ppc_machine=yes \
173 make CFLAGS="-O -DBOOTSTRAP_GCC" \
174 OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
175 sysdeps/gnu/errlist.c
176 mkdir -p stdio-common
178 # sleep for 2 seconds for benefit of filesystems with lousy time
179 # resolution, like FAT, so make knows for sure errlist-compat.c doesn't
182 CT_DoExecLog ALL touch stdio-common/errlist-compat.c
184 # Note: BOOTSTRAP_GCC (see above)
185 libc_cv_ppc_machine=yes \
187 make cross-compiling=yes \
188 install_root=${CT_SYSROOT_DIR} \
189 CFLAGS="-O -DBOOTSTRAP_GCC" \
190 ${LIBC_SYSROOT_ARG} \
191 OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
194 # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
195 # so do them by hand. We can tolerate an empty stubs.h for the moment.
196 # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
197 mkdir -p "${CT_HEADERS_DIR}/gnu"
198 CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
199 CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/include/features.h" \
200 "${CT_HEADERS_DIR}/features.h"
202 # Building the bootstrap gcc requires either setting inhibit_libc, or
203 # having a copy of stdio_lim.h... see
204 # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html
205 CT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h"
207 # Following error building gcc-4.0.0's gcj:
208 # error: bits/syscall.h: No such file or directory
209 # solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html
210 # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html
211 [ "${CT_ARCH}" != "arm" ] && CT_DoExecLog ALL cp -v misc/syscall-list.h "${CT_HEADERS_DIR}/bits/syscall.h" || true
213 # Those headers are to be manually copied so gcc can build properly
214 pthread_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
216 case "${CT_THREADS}" in
218 # NOTE: for some archs, the pathes are different, but they are not
219 # supported by crosstool-NG right now. See original crosstool when they are.
220 pthread_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/${CT_THREADS}/sysdeps/pthread/pthread.h"
221 pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/nptl/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/bits/pthreadtypes.h"
222 if [ ! -f "${pthreadtypes_h}" ]; then
223 pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/ports/sysdeps/unix/sysv/linux/${CT_KERNEL_ARCH}/nptl/bits/pthreadtypes.h"
227 pthreadtypes_h="${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h"
234 if [ -n "${pthread_h}" ]; then
235 CT_DoExecLog ALL cp -v "${pthread_h}" "${CT_HEADERS_DIR}/pthread.h"
237 if [ -n "${pthreadtypes_h}" ]; then
238 CT_DoExecLog ALL cp -v "${pthreadtypes_h}" "${CT_HEADERS_DIR}/bits/pthreadtypes.h"
244 # Build and install start files
245 do_libc_start_files() {
248 # Needed only in the NPTL case. Otherwise, return.
249 [ "${CT_THREADS}" = "nptl" ] || return 0
251 CT_DoStep INFO "Installing C library start files"
253 [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
255 mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
256 cd "${CT_BUILD_DIR}/build-libc-startfiles"
258 CT_DoLog EXTRA "Configuring C library"
260 # Add some default glibc config options if not given by user.
262 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
264 *) extra_config="${extra_config} --with-tls"
266 case "${CT_SHARED_LIBS}" in
267 y) extra_config="${extra_config} --enable-shared";;
268 *) extra_config="${extra_config} --disable-shared";;
270 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
271 y,) extra_config="${extra_config} --with-fp";;
272 ,y) extra_config="${extra_config} --without-fp";;
274 # Obviously, we want threads, as we come here only for NPTL
275 extra_config="${extra_config} --with-__thread"
277 addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
278 extra_config="${extra_config} ${addons_config}"
280 extra_config="${extra_config} $(do_libc_min_kernel_config)"
282 # Add some default CC args
283 glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([[:digit:]]+).*/\1/')
284 glibc_version_minor=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^[[:digit:]]+[\.-_]([[:digit:]]+).*/\1/')
285 # In case we're using a snapshot, fake a >=2.6 version.
286 if [ "${CT_LIBC_V_LATEST}" = "y" \
287 -o "${CT_LIBC_V_date}" = "y" ]; then
288 glibc_version_major=3
289 glibc_version_minor=0
291 if [ ${glibc_version_major} -eq 2 -a ${glibc_version_minor} -ge 6 \
292 -o ${glibc_version_major} -gt 2 ]; then
293 # Don't use -pipe: configure chokes on it for glibc >= 2.6.
294 CT_Test 'Removing "-pipe" for use with glibc>=2.6' "${CT_USE_PIPES}" = "y"
295 extra_cc_args="${CT_CFLAGS_FOR_HOST/-pipe}"
297 extra_cc_args="${CT_CFLAGS_FOR_HOST}"
299 extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
301 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
302 CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
303 CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
304 CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
305 CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
307 # Pre-seed the configparms file with values from the config option
308 echo "${CT_LIBC_GLIBC_CONFIGPARMS}" > configparms
310 echo "libc_cv_forced_unwind=yes" > config.cache
311 echo "libc_cv_c_cleanup=yes" >> config.cache
313 # Please see the comment for the configure step in do_libc().
315 BUILD_CC="${CT_BUILD}-gcc" \
316 CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O " \
317 CC="${cross_cc} ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
319 RANLIB=${CT_TARGET}-ranlib \
321 "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/configure" \
323 --build="${CT_BUILD}" \
324 --host=${CT_TARGET} \
329 --with-headers="${CT_HEADERS_DIR}" \
330 --cache-file=config.cache \
332 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
335 #TODO: should check whether slibdir has been set in configparms to */lib64
336 # and copy the startfiles into the appropriate libdir.
337 CT_DoLog EXTRA "Building C library start files"
338 CT_DoExecLog ALL make OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" csu/subdir_lib
340 CT_DoLog EXTRA "Installing C library start files"
341 if [ "${CT_USE_SYSROOT}" = "y" ]; then
342 CT_DoExecLog ALL cp -fpv csu/crt[1in].o "${CT_SYSROOT_DIR}/usr/lib/"
344 CT_DoExecLog ALL cp -fpv csu/crt[1in].o "${CT_SYSROOT_DIR}/lib/"
350 # This function builds and install the full glibc
354 CT_DoStep INFO "Installing C library"
356 [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
358 mkdir -p "${CT_BUILD_DIR}/build-libc"
359 cd "${CT_BUILD_DIR}/build-libc"
361 CT_DoLog EXTRA "Configuring C library"
363 # Add some default glibc config options if not given by user.
364 # We don't need to be conditional on wether the user did set different
365 # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
368 case "${CT_THREADS}" in
369 nptl) extra_config="${extra_config} --with-__thread --with-tls";;
370 linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
371 none) extra_config="${extra_config} --without-__thread --without-nptl"
372 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
374 *) extra_config="${extra_config} --without-tls";;
379 case "${CT_SHARED_LIBS}" in
380 y) extra_config="${extra_config} --enable-shared";;
381 *) extra_config="${extra_config} --disable-shared";;
384 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
385 y,) extra_config="${extra_config} --with-fp";;
386 ,y) extra_config="${extra_config} --without-fp";;
389 case "$(do_libc_add_ons_list ,)" in
391 *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
394 extra_config="${extra_config} $(do_libc_min_kernel_config)"
396 # Add some default CC args
397 glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([[:digit:]]+).*/\1/')
398 glibc_version_minor=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^[[:digit:]]+[\.-_]([[:digit:]]+).*/\1/')
399 # In case we're using a snapshot, fake a >=2.6 version.
400 if [ "${CT_LIBC_V_LATEST}" = "y" \
401 -o "${CT_LIBC_V_date}" = "y" ]; then
402 glibc_version_major=3
403 glibc_version_minor=0
405 if [ ${glibc_version_major} -eq 2 -a ${glibc_version_minor} -ge 6 \
406 -o ${glibc_version_major} -gt 2 ]; then
407 # Don't use -pipe: configure chokes on it for glibc >= 2.6.
408 CT_Test 'Removing "-pipe" for use with glibc>=2.6' "${CT_USE_PIPES}" = "y"
409 extra_cc_args="${CT_CFLAGS_FOR_HOST/-pipe}"
411 extra_cc_args="${CT_CFLAGS_FOR_HOST}"
413 extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
415 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
416 CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
417 CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
418 CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
419 CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
421 # Pre-seed the configparms file with values from the config option
422 echo "${CT_LIBC_GLIBC_CONFIGPARMS}" > configparms
424 # For glibc 2.3.4 and later we need to set some autoconf cache
425 # variables, because nptl/sysdeps/pthread/configure.in does not
426 # work when cross-compiling.
427 if [ "${CT_THREADS}" = "nptl" ]; then
428 echo libc_cv_forced_unwind=yes
429 echo libc_cv_c_cleanup=yes
432 # Configure with --prefix the way we want it on the target...
433 # There are a whole lot of settings here. You'll probably want
434 # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG
435 # Compare these options with the ones used when installing the glibc headers above - they're different.
436 # Adding "--without-gd" option to avoid error "memusagestat.c:36:16: gd.h: No such file or directory"
437 # See also http://sources.redhat.com/ml/libc-alpha/2000-07/msg00024.html.
438 # Set BUILD_CC, or you won't be able to build datafiles
439 # Set --build, else glibc-2.3.2 will think you're not cross-compiling, and try to run the test programs
441 # OK. I'm fed up with those folks telling me what I should do.
442 # I don't configure nptl? Well, maybe that's purposedly because
443 # I don't want nptl! --disable-sanity-checks will shut up those
444 # silly messages. GNU folks again, he?
446 BUILD_CC="${CT_BUILD}-gcc" \
447 CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O" \
448 CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
450 RANLIB=${CT_TARGET}-ranlib \
452 "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/configure" \
454 --build=${CT_BUILD} \
455 --host=${CT_TARGET} \
460 --disable-sanity-checks \
461 --cache-file=config.cache \
462 --with-headers="${CT_HEADERS_DIR}" \
464 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
466 if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/Makerules" > /dev/null; then
468 # If the install-lib-all target (which is added by our make-install-lib-all.patch)
469 # is present, it means we're building glibc-2.3.3 or later, and we can't
470 # build programs yet, as they require libeh, which won't be installed
471 # until full build of gcc
472 # YEM-FIXME: This comment is misleading: latest glibc-s do not have the
473 # make-install-lib-all.patch applied, so do not pass through this
474 # part of the if statement; nonetheless, they do build, and
475 # the result is useable (maybe the dual-pass core gcc is
476 # responsible for this).
477 GLIBC_INITIAL_BUILD_RULE=lib
478 GLIBC_INITIAL_INSTALL_RULE="install-lib-all install-headers"
479 GLIBC_INSTALL_APPS_LATER=yes
482 # We can build and install everything with the bootstrap compiler.
483 # YEM-FIXME: See the above FIXME as well.
484 GLIBC_INITIAL_BUILD_RULE=all
485 GLIBC_INITIAL_INSTALL_RULE=install
486 GLIBC_INSTALL_APPS_LATER=no
489 # glibc initial build hacks
490 # http://sourceware.org/ml/crossgcc/2008-10/msg00068.html
491 case "${CT_ARCH},${CT_ARCH_CPU}" in
493 CT_DoLog DEBUG "Activating support for memset on broken ppc-8xx (CPU15 erratum)"
494 GLIBC_INITIAL_BUILD_ASFLAGS="-DBROKEN_PPC_8xx_CPU15";;
497 # If this fails with an error like this:
498 # ... linux/autoconf.h: No such file or directory
499 # then you need to set the KERNELCONFIG variable to point to a .config file for this arch.
500 # The following architectures are known to need kernel .config: alpha, arm, ia64, s390, sh, sparc
501 # Note: LD and RANLIB needed by glibc-2.1.3's c_stub directory, at least on macosx
502 # No need for PARALLELMFLAGS here, Makefile already reads this environment variable
503 CT_DoLog EXTRA "Building C library"
504 CT_DoExecLog ALL make LD=${CT_TARGET}-ld \
505 RANLIB=${CT_TARGET}-ranlib \
506 OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
507 ASFLAGS="${GLIBC_INITIAL_BUILD_ASFLAGS}" \
508 ${GLIBC_INITIAL_BUILD_RULE}
510 CT_DoLog EXTRA "Installing C library"
511 CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}" \
512 ${LIBC_SYSROOT_ARG} \
513 OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
514 ${GLIBC_INITIAL_INSTALL_RULE}
516 # This doesn't seem to work when building a crosscompiler,
517 # as it tries to execute localedef using the just-built ld.so!?
518 #CT_DoLog EXTRA "Installing locales"
519 #make localedata/install-locales install_root=${SYSROOT} 2>&1 |CT_DoLog ALL
521 # Fix problems in linker scripts.
523 # Remove lines containing BUG per http://sources.redhat.com/ml/bug-glibc/2003-05/msg00055.html,
524 # needed to fix gcc-3.2.3/glibc-2.3.2 targeting arm
525 # No need to look into the lib64/ dirs here and there, they point to the
526 # corresponding lib/ directories.
528 # To make "strip *.so.*" not fail (ptxdist does this), rename to .so_orig rather than .so.orig
529 CT_DoLog EXTRA "Fixing C library linker scripts"
530 for file in libc.so libpthread.so libgcc_s.so; do
531 for dir in lib usr/lib; do
532 if [ -f "${CT_SYSROOT_DIR}/${dir}/${file}" -a ! -L ${CT_SYSROOT_DIR}/$lib/$file ]; then
533 CT_DoExecLog ALL cp -v "${CT_SYSROOT_DIR}/${dir}/${file}" "${CT_SYSROOT_DIR}/${dir}/${file}_orig"
534 CT_DoLog DEBUG "Fixing '${CT_SYS_ROOT_DIR}/${dir}/${file}'"
535 CT_DoExecLog ALL sed -i -r -e '/BUG in libc.scripts.output-format.sed/d' "${CT_SYSROOT_DIR}/${dir}/${file}"
543 # This function finishes the glibc install
545 # Finally, build and install glibc programs, now that libeh (if any) is installed
546 # Don't do this unless needed, 'cause it causes glibc-2.{1.3,2.2} to fail here with
547 # .../gcc-3.4.1-glibc-2.1.3/build-glibc/libc.so.6: undefined reference to `__deregister_frame_info'
548 # .../gcc-3.4.1-glibc-2.1.3/build-glibc/libc.so.6: undefined reference to `__register_frame_info'
549 [ "${GLIBC_INSTALL_APPS_LATER}" = "yes" ] || return 0
551 CT_DoStep INFO "Finishing C library"
553 cd "${CT_BUILD_DIR}/build-libc"
555 CT_DoLog EXTRA "Re-building C library"
556 CT_DoExecLog ALL make LD=${CT_TARGET}-ld RANLIB=${CT_TARGET}-ranlib
558 CT_DoLog EXTRA "Installing missing C library components"
559 # note: should do full install and then fix linker scripts, but this is faster
560 for t in bin rootsbin sbin data others; do
561 CT_DoExecLog ALL make install_root="${CT_SYSROOT_DIR}" \
562 ${LIBC_SYSROOT_ARG} \
563 OBJDUMP_FOR_HOST="${CT_TARGET}-objdump" \
570 # Build up the addons list, separated with $1
571 do_libc_add_ons_list() {
573 local addons_list=$(echo "${CT_LIBC_ADDONS_LIST}" |sed -r -e "s/[ ,]/${sep}/g;")
574 case "${CT_THREADS}" in
576 *) addons_list="${addons_list}${sep}${CT_THREADS}";;
578 [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
579 # Remove duplicate, leading and trailing separators
580 echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
583 # Builds up the minimum supported Linux kernel version
584 do_libc_min_kernel_config() {
585 local min_kernel_config=
586 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
588 *) if [ "${CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS}" = "y" ]; then
589 # We can't rely on the kernel version from the configuration,
590 # because it might not be available if the user uses pre-installed
591 # headers. On the other hand, both method will have the kernel
592 # version installed in "usr/include/linux/version.h" in the sys-root.
593 # Parse that instead of having two code-paths.
594 version_code_file="${CT_SYSROOT_DIR}/usr/include/linux/version.h"
595 CT_TestOrAbort "Linux version is unavailable in installed headers files" -f "${version_code_file}" -a -r "${version_code_file}"
596 version_code=$(grep -E LINUX_VERSION_CODE "${version_code_file}" |cut -d ' ' -f 3)
597 version=$(((version_code>>16)&0xFF))
598 patchlevel=$(((version_code>>8)&0xFF))
599 sublevel=$((version_code&0xFF))
600 min_kernel_config="--enable-kernel=${version}.${patchlevel}.${sublevel}"
601 elif [ "${CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then
602 # Trim the fourth part of the linux version, keeping only the first three numbers
603 min_kernel_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
607 echo "${min_kernel_config}"