public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Bootstrapping cross-toolchain for ia64
@ 2016-11-04  0:52 Joseph Myers
  2016-11-04 12:10 ` Adhemerval Zanella
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph Myers @ 2016-11-04  0:52 UTC (permalink / raw)
  To: libc-alpha, vapier

The current cleanest approach for bootstrapping cross toolchains for 
GNU/Linux targets is (following the guidance at 
<https://sourceware.org/ml/libc-alpha/2012-03/msg00960.html>):

* Build binutils.

* Install kernel headers.

* Build static-only, C-only GCC, configured so that inhibit_libc is 
defined, and using --with-glibc-version so things like stack-smashing 
protection are correctly configured without glibc headers being available.

* Build glibc, which should be identical to what you get from a longer 
sequence of alternating GCC and glibc builds (following fixes I made a few 
years ago for building like that with the initial bootstrap compiler).

* Build GCC with shared libraries and C++ support.

* If you want to run the glibc tests, you should reconfigure / rebuild 
with the new compiler to get everything required for all the tests.

This doesn't work for ia64 because libgcc depends on system headers even 
with inhibit_libc.  What's the cleanest approach (assuming recent-enough 
GCC and glibc) for building a cross toolchain for ia64-linux-gnu target, 
so I can make build-many-glibcs.py do whatever's necessary?

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bootstrapping cross-toolchain for ia64
  2016-11-04  0:52 Bootstrapping cross-toolchain for ia64 Joseph Myers
@ 2016-11-04 12:10 ` Adhemerval Zanella
  2016-11-04 13:06   ` Joseph Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Adhemerval Zanella @ 2016-11-04 12:10 UTC (permalink / raw)
  To: libc-alpha



On 03/11/2016 22:51, Joseph Myers wrote:
> The current cleanest approach for bootstrapping cross toolchains for 
> GNU/Linux targets is (following the guidance at 
> <https://sourceware.org/ml/libc-alpha/2012-03/msg00960.html>):
> 
> * Build binutils.
> 
> * Install kernel headers.
> 
> * Build static-only, C-only GCC, configured so that inhibit_libc is 
> defined, and using --with-glibc-version so things like stack-smashing 
> protection are correctly configured without glibc headers being available.
> 
> * Build glibc, which should be identical to what you get from a longer 
> sequence of alternating GCC and glibc builds (following fixes I made a few 
> years ago for building like that with the initial bootstrap compiler).
> 
> * Build GCC with shared libraries and C++ support.
> 
> * If you want to run the glibc tests, you should reconfigure / rebuild 
> with the new compiler to get everything required for all the tests.
> 
> This doesn't work for ia64 because libgcc depends on system headers even 
> with inhibit_libc.  What's the cleanest approach (assuming recent-enough 
> GCC and glibc) for building a cross toolchain for ia64-linux-gnu target, 
> so I can make build-many-glibcs.py do whatever's necessary?

I faced the same issue and the solution I found was to configure gcc with
'--disable-shared'.  It is not an optimal approach for a complete toolchain,
but it is at least suffice to correctly build glibc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bootstrapping cross-toolchain for ia64
  2016-11-04 12:10 ` Adhemerval Zanella
@ 2016-11-04 13:06   ` Joseph Myers
  2016-11-04 13:17     ` Adhemerval Zanella
  2016-11-04 13:17     ` Dan Horák
  0 siblings, 2 replies; 6+ messages in thread
From: Joseph Myers @ 2016-11-04 13:06 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Fri, 4 Nov 2016, Adhemerval Zanella wrote:

> I faced the same issue and the solution I found was to configure gcc with
> '--disable-shared'.  It is not an optimal approach for a complete toolchain,
> but it is at least suffice to correctly build glibc.

The first GCC (whose build fails) *is* configured with --disable-shared 
(and --without-headers --with-newlib to get inhibit_libc defined).  It 
still tries to build unwind code that includes libc headers 
unconditionally.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bootstrapping cross-toolchain for ia64
  2016-11-04 13:06   ` Joseph Myers
@ 2016-11-04 13:17     ` Adhemerval Zanella
  2016-11-04 13:17     ` Dan Horák
  1 sibling, 0 replies; 6+ messages in thread
From: Adhemerval Zanella @ 2016-11-04 13:17 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 04/11/2016 11:06, Joseph Myers wrote:
> On Fri, 4 Nov 2016, Adhemerval Zanella wrote:
> 
>> I faced the same issue and the solution I found was to configure gcc with
>> '--disable-shared'.  It is not an optimal approach for a complete toolchain,
>> but it is at least suffice to correctly build glibc.
> 
> The first GCC (whose build fails) *is* configured with --disable-shared 
> (and --without-headers --with-newlib to get inhibit_libc defined).  It 
> still tries to build unwind code that includes libc headers 
> unconditionally.

Yeah I noted, but I think I am doing something different than your
intention.  Since the aim of the toolchain I intend to use is just
to *build* ia64 glibc (since I have no way to actually testing it) 
I basically did

  1. gcc:
    1.1. make all-gcc
    1.2. make install-gcc
  2. glibc
    2.1. make install-bootstrap-headers=yes install-headers
    2.2. make csu/subdir_lib
    2.3. install csu/crt1.o csu/crti.o csu/crtn.o $INSTALL_PATH/$TARGET/lib
    2.4. $TARGET-gcc $CFLAGS_GLIBC $CFLAGS_GLIBC -nostdlib -nostartfiles \
         -shared -x c /dev/null -o $INSTALL_PATH/$TARGET/lib/libc.so
    2.5. touch $INSTALL_PATH/$TARGET/include/gnu/stubs.h
  3. gcc:
    3.1. make all-target-libgcc
    3.2. install-target-libgcc
  4. glibc:
    4.1. make
    4.2. make install
  5. gcc:
    5.1. make all
    5.2. make install

Yes, I know this is *far* from ideal (resulting toolchain is mostly unusable
for actually testing since it lacks shared libgcc), but at least it can verify
glibc build for ia64-linux-gnu targets.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bootstrapping cross-toolchain for ia64
  2016-11-04 13:06   ` Joseph Myers
  2016-11-04 13:17     ` Adhemerval Zanella
@ 2016-11-04 13:17     ` Dan Horák
  2016-11-04 13:31       ` Joseph Myers
  1 sibling, 1 reply; 6+ messages in thread
From: Dan Horák @ 2016-11-04 13:17 UTC (permalink / raw)
  To: libc-alpha

On Fri, 4 Nov 2016 13:06:05 +0000
Joseph Myers <joseph@codesourcery.com> wrote:

> On Fri, 4 Nov 2016, Adhemerval Zanella wrote:
> 
> > I faced the same issue and the solution I found was to configure
> > gcc with '--disable-shared'.  It is not an optimal approach for a
> > complete toolchain, but it is at least suffice to correctly build
> > glibc.
> 
> The first GCC (whose build fails) *is* configured with
> --disable-shared (and --without-headers --with-newlib to get
> inhibit_libc defined).  It still tries to build unwind code that
> includes libc headers unconditionally.

we used to have the following patch in the Fedora cross-gcc
http://pkgs.fedoraproject.org/cgit/rpms/cross-gcc.git/log/cross-gcc-with-libgcc.patch

diff -up gcc-4.7.0/libgcc/unwind-generic.h.cross-libgcc-ia64 gcc-4.7.0/libgcc/unwind-generic.h
--- gcc-4.7.0/libgcc/unwind-generic.h.cross-libgcc-ia64 2012-06-01 18:14:22.552450391 +0200
+++ gcc-4.7.0libgcc/unwind-generic.h 2012-06-01 18:14:42.523121821 +0200
@@ -211,7 +211,9 @@
_Unwind_SjLj_Resume_or_Rethrow (struct _ compatible with the standard ABI for IA-64, we inline these.  */

 #ifdef __ia64__
+#ifndef inhibit_libc
 #include <stdlib.h>
+#endif

 static inline _Unwind_Ptr
 _Unwind_GetDataRelBase (struct _Unwind_Context *_C)


		Dan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bootstrapping cross-toolchain for ia64
  2016-11-04 13:17     ` Dan Horák
@ 2016-11-04 13:31       ` Joseph Myers
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph Myers @ 2016-11-04 13:31 UTC (permalink / raw)
  To: Dan Horák; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 1322 bytes --]

On Fri, 4 Nov 2016, Dan Horák wrote:

> On Fri, 4 Nov 2016 13:06:05 +0000
> Joseph Myers <joseph@codesourcery.com> wrote:
> 
> > On Fri, 4 Nov 2016, Adhemerval Zanella wrote:
> > 
> > > I faced the same issue and the solution I found was to configure
> > > gcc with '--disable-shared'.  It is not an optimal approach for a
> > > complete toolchain, but it is at least suffice to correctly build
> > > glibc.
> > 
> > The first GCC (whose build fails) *is* configured with
> > --disable-shared (and --without-headers --with-newlib to get
> > inhibit_libc defined).  It still tries to build unwind code that
> > includes libc headers unconditionally.
> 
> we used to have the following patch in the Fedora cross-gcc
> http://pkgs.fedoraproject.org/cgit/rpms/cross-gcc.git/log/cross-gcc-with-libgcc.patch

Thanks.  I see that stdlib.h include was removed by

r231697 | edlinger | 2015-12-16 15:24:52 +0000 (Wed, 16 Dec 2015) | 5 lines

2015-12-16  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * unwind-generic.h (_Unwind_GetTextRelBase): Call __builtin_abort
        instead of abort to avoid dependency on stdlib.h.

so I'll see if the problem goes away with newer GCC (I'm initially trying 
to clean up results with GCC 5 branch before going on to GCC 6 and 
mainline).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-04 13:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-04  0:52 Bootstrapping cross-toolchain for ia64 Joseph Myers
2016-11-04 12:10 ` Adhemerval Zanella
2016-11-04 13:06   ` Joseph Myers
2016-11-04 13:17     ` Adhemerval Zanella
2016-11-04 13:17     ` Dan Horák
2016-11-04 13:31       ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).