Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Two or three stages gcc build?
@ 2013-07-05 21:38 Thomas Petazzoni
       [not found] ` <9C6FE6D2-322A-41E7-8B82-C623B5C1F754@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2013-07-05 21:38 UTC (permalink / raw)
  To: buildroot

Hello Khem,

(This e-mail is Cc'ed to the crossgcc@ and the buildroot@ mailing lists)

We started discussing on IRC about whether a three stage or a two stage
gcc build was needed, but seems like due to timezone issues, we're not
able to discuss simultaneously, so I'm trying to do things by e-mail. I
would like to understand a little bit better since when we can get back
to a two stages gcc build process instead of the three stages build
process that was needed since the introduction of NPTL support.

Currently, what we have in Buildroot is:

 1. Build gcc initial (--without-headers --with-newlib --disable-shared)

 2. Configure uClibc, install headers, crti.o, crtn.o, crt1.o, install
    a fake libc.so and libm.so (just empty C files being compiled as a
    share library)

 3. Build gcc intermediate (no special options passed)

 4. Build uClibc and install it.

 5. Build gcc final

Apparently, this three stage build process is no longer needed. In
OE-Core, you did the following commit:

commit b0faebd1f07e1616004bd19664395932e7c2c48f
Author: Khem Raj <raj.khem@gmail.com>
Date:   Wed Aug 15 23:12:51 2012 -0700

    gcc-cross: Make gcc-cross-initial as the only intermediate gcc stage
    
    Now glibc can be compiled with gcc-cross-initial therefore prepare
    the stage to drop gcc-cross-intermediate
    
    Also drop arm-nolibfloat.patch should not be needed anymore
    half of changes in this patch are meant for OABI which we dont
    use anymore
    
    (From OE-Core rev: 30617bde61a3b0a0944b49a0c9fb7159dacbb19f)
    
    Signed-off-by: Khem Raj <raj.khem@gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

So according to this, the fact that we can go back to a two stages
build seems to be related to glibc. So what happens to uClibc in this
case?

In fe9a576e8d27460468dfe5eac90aad49ab26a8d3 (gcc-cross-intermediate,
gcc-crosssdk-intermediate: Remove) you completely remove the
intermediate recipes, so I assume they are really no longer needed,
even by the uClibc build, since I believe OE-core also supports uClibc
builds (thanks to your work).

Could you explain in more details which version of gcc or glibc/uClibc
made it possible to go back to a 2-stages build? Both Yann E. Morin
(for Crosstool-NG) and myself (for Buildroot) are interested in
understanding this in order to improve those tools. Also, what should
be the two stages now? Just:

 1. Build gcc initial (no C library at all)
 2. Build C library completely
 3. Build gcc final

 ?

Thanks for your insights,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [Buildroot] Two or three stages gcc build?
@ 2013-09-19 17:02 soochon radee
  2013-09-19 19:27 ` Thomas Petazzoni
  0 siblings, 1 reply; 8+ messages in thread
From: soochon radee @ 2013-09-19 17:02 UTC (permalink / raw)
  To: buildroot

Hi,

I am also seeing the two-phase build break eglibc trying to link
SSP-related symbols on 64-bit targets (powerpc/970, x86_64/core2) in
libc/resolv. This happens even if SSP is enabled in .config

I've been digging around gcc-initial's configure arguments and directories
passed around to eglibc's configure script to no avail. But, I've been able
to make it work by forcing eglibc to assume no SSP support with the
following patch. Hopefully this will point a way to a better solution.

diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
index 4dd2e63..1e8b325 100644
--- a/package/glibc/glibc.mk
+++ b/package/glibc/glibc.mk
@@ -63,6 +63,7 @@ define GLIBC_CONFIGURE_CMDS
                CXXFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" \
                $(SHELL) $(@D)/$(GLIBC_SRC_SUBDIR)/configure \
                ac_cv_path_BASH_SHELL=/bin/bash \
+               libc_cv_ssp=no \
                libc_cv_forced_unwind=yes \
                --target=$(GNU_TARGET_NAME) \
                --host=$(GNU_TARGET_NAME) \

Thanks,
Soochon

> Dear Khem Raj,
>
> On Fri, 6 Sep 2013 09:59:34 -0700, Khem Raj wrote:
>
> > > In the mean time, I've experimented a bit and actually implemented it.
> > > The patch hasn't been merged yet in Buildroot, but it has been posted:
> > >
http://lists.busybox.net/pipermail/buildroot/2013-September/077344.html.
> > >
> > > Don't hesitate to have a look and tell me what you think.
> >
> > OK. The patch looks ok to me. one thing
>
> After merging the patch, we got a report that it breaks SSP support,
> see [1]. After investigation, depending on the architecture, the
> __stack_chk_fail symbol maybe be part of the TLS (it's the case on x86,
> but on ARM, for example).
>
> However, since we're now only doing gcc-initial -> uclibc -> gcc-final,
> and gcc-initial has no thread/TLS support, it breaks the build of
> uClibc when SSP support is enabled (in such a case, uClibc is built
> with -fstack-protector, which creates references to __stack_chk_fail,
> but this symbol isn't available because we don't have TLS support).
>
> Have you already seen this problem? What solution do you suggest?
>
> Thanks!
>
> Thomas
>
> [1]
>
http://buildroot-busybox.2317881.n4.nabble.com/uClibc-fails-to-build-with-stack-smash-protection-td51478.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130919/4dd2c02c/attachment-0001.html>

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

end of thread, other threads:[~2013-10-08 18:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-05 21:38 [Buildroot] Two or three stages gcc build? Thomas Petazzoni
     [not found] ` <9C6FE6D2-322A-41E7-8B82-C623B5C1F754@gmail.com>
2013-09-06 12:58   ` Thomas Petazzoni
     [not found]     ` <EEBE54E3-BD6F-4BB5-88C4-CB3B51CC1FCC@gmail.com>
2013-09-07  9:15       ` Thomas Petazzoni
     [not found]         ` <CAL4-wQrTouutDaj2zCVmCQH4+XpEJMR05_goC2KrcF2HgXotiA@mail.gmail.com>
2013-09-07 11:49           ` Thomas Petazzoni
2013-09-19  5:02       ` Thomas Petazzoni
2013-10-08 18:58         ` Thomas Petazzoni
  -- strict thread matches above, loose matches on Subject: below --
2013-09-19 17:02 soochon radee
2013-09-19 19:27 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox