This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] glibc: Refactor startfiles/headers into do_libc


On Mon, Jun 20, 2011 at 12:44 AM, Bryan Hundven <bryanhundven@gmail.com> wrote:
> # HG changeset patch
> # User Bryan Hundven <bryanhundven@gmail.com>
> # Date 1308555696 25200
> # Node ID b25856d9153785d0f711206383480f0190aec363
> # Parent Â2377be750e83defa6d764bcb8cf6dbaf098a19f6
> glibc: Refactor startfiles/headers into do_libc
>
> The 'do_libc_start_files()' function was configuring libc differently then
> 'do_libc()'. This might be fine for arm(eb) or powerpc(64), but not for
> mips(64).
>
> Move the building of the libc start files and headers into do_libc, much like
> how gcc handles stage1, stage2, and final toolchains.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>

>
> diff -r 2377be750e83 -r b25856d91537 scripts/build/libc/glibc-eglibc.sh-common
> --- a/scripts/build/libc/glibc-eglibc.sh-common Mon Jun 13 22:54:29 2011 +0400
> +++ b/scripts/build/libc/glibc-eglibc.sh-common Mon Jun 20 00:41:36 2011 -0700
> @@ -51,128 +51,30 @@
>
> Â# Build and install headers and start files
> Âdo_libc_start_files() {
> - Â Âlocal src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
> -
> - Â ÂCT_DoStep INFO "Installing C library headers & start files"
> -
> - Â Âmkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
> - Â Âcd "${CT_BUILD_DIR}/build-libc-startfiles"
> -
> - Â ÂCT_DoLog EXTRA "Configuring C library"
> -
> - Â Âcase "${CT_LIBC}" in
> - Â Â Â Âeglibc)
> - Â Â Â Â Â Âif [ "${CT_EGLIBC_CUSTOM_CONFIG}" = "y" ]; then
> - Â Â Â Â Â Â Â ÂCT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
> - Â Â Â Â Â Âfi
> - Â Â Â Â Â Â;;
> - Â Âesac
> -
> - Â Âcross_cc=$(CT_Which "${CT_TARGET}-gcc")
> - Â Âcross_cxx=$(CT_Which "${CT_TARGET}-g++")
> - Â Âcross_ar=$(CT_Which "${CT_TARGET}-ar")
> - Â Âcross_ranlib=$(CT_Which "${CT_TARGET}-ranlib")
> -
> - Â ÂCT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
> - Â ÂCT_DoLog DEBUG "Using g++ for target: '${cross_cxx}'"
> - Â ÂCT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
> - Â ÂCT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
> -
> - Â Âtouch config.cache
> - Â Âif [ "${CT_LIBC_GLIBC_FORCE_UNWIND}" = "y" ]; then
> - Â Â Â Âecho "libc_cv_forced_unwind=yes" >>config.cache
> - Â Â Â Âecho "libc_cv_c_cleanup=yes" >>config.cache
> - Â Âfi
> -
> - Â Â# Pre-seed the configparms file with values from the config option
> - Â Âprintf "${CT_LIBC_GLIBC_CONFIGPARMS}\n" > configparms
> -
> - Â ÂCT_DoExecLog CFG Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
> - Â ÂBUILD_CC="${CT_BUILD}-gcc" Â Â Â Â Â Â Â Â Â Â Â Â Â\
> - Â ÂCC=${cross_cc} Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
> - Â ÂCXX=${cross_cxx} Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
> - Â ÂAR=${cross_ar} Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
> - Â ÂRANLIB=${cross_ranlib} Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
> - Â Â"${src_dir}/configure" Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
> -    Â--prefix=/usr                  \
> - Â Â Â Â--with-headers="${CT_HEADERS_DIR}" Â Â Â Â Â Â Â\
> - Â Â Â Â--build="${CT_BUILD}" Â Â Â Â Â Â Â Â Â Â Â Â Â \
> - Â Â Â Â--host="${CT_TARGET}" Â Â Â Â Â Â Â Â Â Â Â Â Â \
> - Â Â Â Â--cache-file="$(pwd)/config.cache" Â Â Â Â Â Â Â\
> -    Â--disable-profile                \
> -    Â--without-gd                  Â\
> -    Â--without-cvs                  \
> - Â Â Â Â--enable-add-ons
> -
> - Â ÂCT_DoLog EXTRA "Installing C library headers"
> -
> - Â Â# use the 'install-headers' makefile target to install the
> - Â Â# headers
> - Â ÂCT_DoExecLog ALL make ${JOBSFLAGS} Â Â Â Â Â Â Â\
> - Â Â Â Â Â Â Â Â Â Â install_root=${CT_SYSROOT_DIR} \
> - Â Â Â Â Â Â Â Â Â Â install-bootstrap-headers=yes Â\
> - Â Â Â Â Â Â Â Â Â Â install-headers
> -
> - Â Â# For glibc, a few headers need to be manually installed
> - Â Âif [ "${CT_LIBC}" = "glibc" ]; then
> - Â Â Â Â# Two headers -- stubs.h and features.h -- aren't installed by install-headers,
> - Â Â Â Â# so do them by hand. ÂWe can tolerate an empty stubs.h for the moment.
> - Â Â Â Â# See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
> - Â Â Â Âmkdir -p "${CT_HEADERS_DIR}/gnu"
> - Â Â Â ÂCT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
> - Â Â Â ÂCT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/include/features.h" Â\
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "${CT_HEADERS_DIR}/features.h"
> -
> - Â Â Â Â# Building the bootstrap gcc requires either setting inhibit_libc, or
> - Â Â Â Â# having a copy of stdio_lim.h... see
> - Â Â Â Â# http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html
> - Â Â Â ÂCT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h"
> -
> - Â Â Â Â# Following error building gcc-4.0.0's gcj:
> - Â Â Â Â# Âerror: bits/syscall.h: No such file or directory
> - Â Â Â Â# solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html
> - Â Â Â Â# but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html
> - Â Â Â Âcase "${CT_ARCH}" in
> - Â Â Â Â Â Âarm) Â Â;;
> - Â Â Â Â Â Â*) ÂCT_DoExecLog ALL cp -v "misc/syscall-list.h" Â Â Â Â Â Â\
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "${CT_HEADERS_DIR}/bits/syscall.h"
> - Â Â Â Â Â Â Â Â;;
> - Â Â Â Âesac
> - Â Âfi
> -
> - Â Âif [ "${CT_THREADS}" = "nptl" ]; then
> - Â Â Â ÂCT_DoLog EXTRA "Installing C library start files"
> -
> - Â Â Â Â# there are a few object files needed to link shared libraries,
> - Â Â Â Â# which we build and install by hand
> - Â Â Â ÂCT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
> - Â Â Â ÂCT_DoExecLog ALL make ${JOBSFLAGS} csu/subdir_lib
> - Â Â Â ÂCT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â"${CT_SYSROOT_DIR}/usr/lib"
> -
> - Â Â Â Â# Finally, 'libgcc_s.so' requires a 'libc.so' to link against.
> - Â Â Â Â# However, since we will never actually execute its code,
> - Â Â Â Â# it doesn't matter what it contains. ÂSo, treating '/dev/null'
> - Â Â Â Â# as a C source file, we produce a dummy 'libc.so' in one step
> -    ÂCT_DoExecLog ALL "${cross_cc}" -nostdlib    Â\
> -                    -nostartfiles  Â\
> -                    -shared     Â\
> -                    -x c /dev/null  \
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â -o "${CT_SYSROOT_DIR}/usr/lib/libc.so"
> - Â Âfi # threads == nptl
> -
> - Â ÂCT_EndStep
> + Â Â# Start files and Headers should be configured the same way as the
> + Â Â# final libc, but built and installed differently.
> + Â Âdo_libc startfile_mode=yes
> Â}
>
> Â# This function builds and install the full C library
> Âdo_libc() {
> Â Â local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
> + Â Âlocal startfile_mode=no
> Â Â local extra_cc_args
> Â Â local -a extra_config
> Â Â local -a extra_make_args
> Â Â local glibc_cflags
>
> - Â ÂCT_DoStep INFO "Installing C library"
> + Â Âwhile [ $# -ne 0 ]; do
> + Â Â Â Âeval "${1}"
> + Â Â Â Âshift
> + Â Âdone
> +
> + Â Âif [ "${startfile_mode}" = "yes" ]; then
> + Â Â Â ÂCT_DoStep INFO "Installing C library headers & start files"
> + Â Âelse
> + Â Â Â ÂCT_DoStep INFO "Installing C library"
> + Â Âfi
>
> Â Â mkdir -p "${CT_BUILD_DIR}/build-libc"
> Â Â cd "${CT_BUILD_DIR}/build-libc"
> @@ -316,16 +218,75 @@
> Â Â Â Â Â Â ;;
> Â Â esac
>
> - Â ÂCT_DoLog EXTRA "Building C library"
> - Â ÂCT_DoExecLog ALL make ${JOBSFLAGS} Â Â Â Â Â Â Â Â Â Â Â\
> - Â Â Â Â Â Â Â Â Â Â Â Â Â"${extra_make_args[@]}" Â Â Â Â Â \
> - Â Â Â Â Â Â Â Â Â Â Â Â Âall
> + Â Âif [ "${startfile_mode}" = "yes" ]; then
> + Â Â Â ÂCT_DoLog EXTRA "Installing C library headers"
>
> - Â ÂCT_DoLog EXTRA "Installing C library"
> - Â ÂCT_DoExecLog ALL make ${JOBSFLAGS} Â Â Â Â Â Â Â Â Â Â Â\
> - Â Â Â Â Â Â Â Â Â Â Â Â Â"${extra_make_args[@]}" Â Â Â Â Â \
> - Â Â Â Â Â Â Â Â Â Â Â Â Âinstall_root="${CT_SYSROOT_DIR}" Â\
> - Â Â Â Â Â Â Â Â Â Â Â Â Âinstall
> + Â Â Â Â# use the 'install-headers' makefile target to install the
> + Â Â Â Â# headers
> + Â Â Â ÂCT_DoExecLog ALL make ${JOBSFLAGS} Â Â Â Â Â Â Â\
> + Â Â Â Â Â Â Â Â Â Â Â Â install_root=${CT_SYSROOT_DIR} \
> + Â Â Â Â Â Â Â Â Â Â Â Â install-bootstrap-headers=yes Â\
> + Â Â Â Â Â Â Â Â Â Â Â Â install-headers
> +
> + Â Â Â Â# For glibc, a few headers need to be manually installed
> + Â Â Â Âif [ "${CT_LIBC}" = "glibc" ]; then
> + Â Â Â Â Â Â# Two headers -- stubs.h and features.h -- aren't installed by install-headers,
> + Â Â Â Â Â Â# so do them by hand. ÂWe can tolerate an empty stubs.h for the moment.
> + Â Â Â Â Â Â# See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
> + Â Â Â Â Â Âmkdir -p "${CT_HEADERS_DIR}/gnu"
> + Â Â Â Â Â ÂCT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h"
> + Â Â Â Â Â ÂCT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}/include/features.h" Â\
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "${CT_HEADERS_DIR}/features.h"
> +
> + Â Â Â Â Â Â# Building the bootstrap gcc requires either setting inhibit_libc, or
> + Â Â Â Â Â Â# having a copy of stdio_lim.h... see
> + Â Â Â Â Â Â# http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html
> + Â Â Â Â Â ÂCT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h"
> +
> + Â Â Â Â Â Â# Following error building gcc-4.0.0's gcj:
> + Â Â Â Â Â Â# Âerror: bits/syscall.h: No such file or directory
> + Â Â Â Â Â Â# solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html
> + Â Â Â Â Â Â# but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html
> + Â Â Â Â Â Âcase "${CT_ARCH}" in
> + Â Â Â Â Â Â Â Âarm) Â Â;;
> + Â Â Â Â Â Â Â Â*) ÂCT_DoExecLog ALL cp -v "misc/syscall-list.h" Â Â Â Â Â Â\
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "${CT_HEADERS_DIR}/bits/syscall.h"
> + Â Â Â Â Â Â Â Â Â Â;;
> + Â Â Â Â Â Âesac
> + Â Â Â Âfi
> +
> + Â Â Â Âif [ "${CT_THREADS}" = "nptl" ]; then
> + Â Â Â Â Â ÂCT_DoLog EXTRA "Installing C library start files"
> +
> + Â Â Â Â Â Â# there are a few object files needed to link shared libraries,
> + Â Â Â Â Â Â# which we build and install by hand
> + Â Â Â Â Â ÂCT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
> + Â Â Â Â Â ÂCT_DoExecLog ALL make ${JOBSFLAGS} csu/subdir_lib
> + Â Â Â Â Â ÂCT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â"${CT_SYSROOT_DIR}/usr/lib"
> +
> + Â Â Â Â Â Â# Finally, 'libgcc_s.so' requires a 'libc.so' to link against.
> + Â Â Â Â Â Â# However, since we will never actually execute its code,
> + Â Â Â Â Â Â# it doesn't matter what it contains. ÂSo, treating '/dev/null'
> + Â Â Â Â Â Â# as a C source file, we produce a dummy 'libc.so' in one step
> +      ÂCT_DoExecLog ALL "${cross_cc}" -nostdlib    Â\
> +                      -nostartfiles  Â\
> +                      -shared     Â\
> +                      -x c /dev/null  \
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â -o "${CT_SYSROOT_DIR}/usr/lib/libc.so"
> + Â Â Â Âfi # threads == nptl
> + Â Âelse # startfile_mode = no
> + Â Â Â ÂCT_DoLog EXTRA "Building C library"
> + Â Â Â ÂCT_DoExecLog ALL make ${JOBSFLAGS} Â Â Â Â Â Â Â Â Â Â Â\
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â"${extra_make_args[@]}" Â Â Â Â Â \
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âall
> +
> + Â Â Â ÂCT_DoLog EXTRA "Installing C library"
> + Â Â Â ÂCT_DoExecLog ALL make ${JOBSFLAGS} Â Â Â Â Â Â Â Â Â Â Â\
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â"${extra_make_args[@]}" Â Â Â Â Â \
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âinstall_root="${CT_SYSROOT_DIR}" Â\
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âinstall
> + Â Âfi
>
> Â Â CT_EndStep
> Â}
> @@ -384,3 +345,5 @@
> Â Â Â Â Â Â ;;
> Â Â esac
> Â}
> +
> +# vim: ts=4 sw=4 et ai syn=sh
>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]