From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8379 invoked by alias); 23 Jun 2011 02:42:03 -0000 Received: (qmail 8336 invoked by uid 22791); 23 Jun 2011 02:42:01 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-pz0-f41.google.com (HELO mail-pz0-f41.google.com) (209.85.210.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Jun 2011 02:41:46 +0000 Received: by pzk4 with SMTP id 4so1110630pzk.0 for ; Wed, 22 Jun 2011 19:41:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.47.196 with SMTP id f4mr866572pbn.363.1308796905779; Wed, 22 Jun 2011 19:41:45 -0700 (PDT) Received: by 10.68.65.197 with HTTP; Wed, 22 Jun 2011 19:41:45 -0700 (PDT) In-Reply-To: <201106230050.51891.yann.morin.1998@anciens.enib.fr> References: <201106230050.51891.yann.morin.1998@anciens.enib.fr> Date: Thu, 23 Jun 2011 02:42:00 -0000 Message-ID: Subject: Re: [PATCH] glibc: Refactor startfiles/headers into do_libc From: Bryan Hundven To: "Yann E. MORIN" Cc: crossgcc@sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00076.txt.bz2 On Wed, Jun 22, 2011 at 3:50 PM, Yann E. MORIN wrote: > Bryan, All, > > On Monday 20 June 2011 09:44:21 Bryan Hundven wrote: >> # HG changeset patch >> # User Bryan Hundven >> # Date 1308555696 25200 >> # Node ID b25856d9153785d0f711206383480f0190aec363 >> # Parent =C2=A02377be750e83defa6d764bcb8cf6dbaf098a19f6 >> glibc: Refactor startfiles/headers into do_libc > > As I said on IRC: I really like that idea! > >> The 'do_libc_start_files()' function was configuring libc differently th= en >> '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. > > Did you check that: > =C2=A0- other archs were still OK? > =C2=A0- both glibc and eglibc were still OK? I need to test more, but I was hoping by putting the patch out there, I could get some more testing help? <_< >_> > Also, I'd prefer that we use a real backend function, a-la cc-core: > =C2=A0do_libc_start_files() { > =C2=A0 =C2=A0 =C2=A0do_libc_backend startfiles_mode=3Dyes > =C2=A0} > =C2=A0do_libc() { > =C2=A0 =C2=A0 =C2=A0do_libc_backend startfiles_mode=3Dno > =C2=A0} > =C2=A0do_libc_backend() { > =C2=A0 =C2=A0# blabla > =C2=A0} Cool, I like that too! >> diff -r 2377be750e83 -r b25856d91537 scripts/build/libc/glibc-eglibc.sh-= common >> --- a/scripts/build/libc/glibc-eglibc.sh-common =C2=A0 =C2=A0 =C2=A0 Mon= Jun 13 22:54:29 2011 +0400 >> +++ b/scripts/build/libc/glibc-eglibc.sh-common =C2=A0 =C2=A0 =C2=A0 Mon= Jun 20 00:41:36 2011 -0700 > [--SNIP-] >> =C2=A0# This function builds and install the full C library >> =C2=A0do_libc() { > [--SNIP-] >> @@ -316,16 +218,75 @@ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; >> =C2=A0 =C2=A0 =C2=A0esac >> >> - =C2=A0 =C2=A0CT_DoLog EXTRA "Building C library" >> - =C2=A0 =C2=A0CT_DoExecLog ALL make ${JOBSFLAGS} =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"${extra_make_args[@]}" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 \ >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0all >> + =C2=A0 =C2=A0if [ "${startfile_mode}" =3D "yes" ]; then >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoLog EXTRA "Installing C library header= s" >> >> - =C2=A0 =C2=A0CT_DoLog EXTRA "Installing C library" >> - =C2=A0 =C2=A0CT_DoExecLog ALL make ${JOBSFLAGS} =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0"${extra_make_args[@]}" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 \ >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0install_root=3D"${CT_SYSROOT_DIR}" =C2=A0\ >> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0install >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0# use the 'install-headers' makefile target= to install the >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0# headers >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL make ${JOBSFLAGS} =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 install_root=3D${CT_SYSROOT_DIR} \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 install-bootstrap-headers=3Dyes =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 install-headers > > What about the extra_make_args? > It can contain preprocessor directives (eg. -DBROKEN_PPC_8xx_CPU15), so it > might have an impact on headers... Good point. I will add that to the new patch too. >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0# For glibc, a few headers need to be manua= lly installed >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if [ "${CT_LIBC}" =3D "glibc" ]; then >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Two headers -- stubs.h and = features.h -- aren't installed by install-headers, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# so do them by hand. =C2=A0W= e can tolerate an empty stubs.h for the moment. >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# See e.g. http://gcc.gnu.org= /ml/gcc/2002-01/msg00900.html >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mkdir -p "${CT_HEADERS_DIR}/g= nu" >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL touch "${CT_= HEADERS_DIR}/gnu/stubs.h" >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL cp -v "${CT_= SRC_DIR}/glibc-${CT_LIBC_VERSION}/include/features.h" =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "${CT_HEADERS_DIR}/feature= s.h" >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Building the bootstrap gcc = requires either setting inhibit_libc, or >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# having a copy of stdio_lim.= h... see >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# http://sources.redhat.com/m= l/libc-alpha/2003-11/msg00045.html >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL cp -v bits/s= tdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h" >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Following error building gc= c-4.0.0's gcj: >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# =C2=A0error: bits/syscall.h= : No such file or directory >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# solved by following copy; s= ee http://sourceware.org/ml/crossgcc/2005-05/msg00168.html >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# but it breaks arm, see http= ://sourceware.org/ml/crossgcc/2006-01/msg00091.html >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0case "${CT_ARCH}" in >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0arm) =C2=A0 =C2= =A0;; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*) =C2=A0CT_DoE= xecLog ALL cp -v "misc/syscall-list.h" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 "${CT_HEADERS_DIR}/bits/syscall.h" >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0esac >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0fi >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if [ "${CT_THREADS}" =3D "nptl" ]; then >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoLog EXTRA "Installing C = library start files" >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# there are a few object file= s needed to link shared libraries, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# which we build and install = by hand >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL mkdir -p "${= CT_SYSROOT_DIR}/usr/lib" >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL make ${JOBSF= LAGS} csu/subdir_lib > > Ditto extra_make_args. ack. >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL cp csu/crt1.= o csu/crti.o csu/crtn.o \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"${CT_SYSROOT_DIR}/usr/lib" >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Finally, 'libgcc_s.so' requ= ires a 'libc.so' to link against. >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# However, since we will neve= r actually execute its code, >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# it doesn't matter what it c= ontains. =C2=A0So, treating '/dev/null' >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# as a C source file, we prod= uce a dummy 'libc.so' in one step >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL "${cross_cc}= " -nostdlib =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 -nostartfiles =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 -shared =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 -x c /dev/null =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 -o "${CT_SYSROOT_DIR}/usr/lib/libc.so" >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0fi # threads =3D=3D nptl >> + =C2=A0 =C2=A0else # startfile_mode =3D no >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoLog EXTRA "Building C library" >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL make ${JOBSFLAGS} =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"${extra_make_args[@]}" =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0all >> + >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoLog EXTRA "Installing C library" >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0CT_DoExecLog ALL make ${JOBSFLAGS} =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"${extra_make_args[@]}" =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0install_root=3D"${CT_SYSROOT_DIR}" =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0install >> + =C2=A0 =C2=A0fi >> >> =C2=A0 =C2=A0 =C2=A0CT_EndStep >> =C2=A0} >> @@ -384,3 +345,5 @@ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; >> =C2=A0 =C2=A0 =C2=A0esac >> =C2=A0} >> + >> +# vim: ts=3D4 sw=3D4 et ai syn=3Dsh > > Spurious line. We do not have vim syntax settings in the source code. We could provide the combined emacs/vim syntax settings. I like the idea of the editor "doing the right thing", and me just writing code and not worrying about style. > Although I do indeed exclusively use vim. ;-) I use a lot of editors, and most of them either use vim or emacs style 'mode lines'. I prefer the modeline in the code, as I have other projects where they like: ts=3D2 sw=3D2 et and changing my .vimrc or .emacs for each project is a serious pain. Also, opening a .in file, in this specific case, shows up as a plain-text f= ile. So my syntax highlighting goes away, and I have to bang on my space bar... a lot! It would be nice... my keyboard would thank you... but not totally necessar= y. > > Regards. > Yann E. MORIN. > > -- > .-----------------.--------------------.------------------.--------------= ------. > | =C2=A0Yann E. MORIN =C2=A0| Real-Time Embedded | /"\ ASCII RIBBON | Eri= cs' conspiracy: | > | +33 662 376 056 | Software =C2=A0Designer | \ / CAMPAIGN =C2=A0 =C2=A0 = | =C2=A0___ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | > | +33 223 225 172 `------------.-------: =C2=A0X =C2=A0AGAINST =C2=A0 =C2= =A0 =C2=A0| =C2=A0\e/ =C2=A0There is no =C2=A0| > | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL =C2=A0 =C2=A0| =C2= =A0 v =C2=A0 conspiracy. =C2=A0| > '------------------------------^-------^------------------^--------------= ------' > -Bryan -- For unsubscribe information see http://sourceware.org/lists.html#faq