Re: Linux 4.19 and GCC 9

From: Miguel Ojeda
Date: Mon Jun 10 2019 - 11:09:20 EST


On Mon, Jun 10, 2019 at 4:49 PM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Mon, Jun 10, 2019 at 04:42:27PM +0200, Miguel Ojeda wrote:
> > I think Josh Poimboeuf added support for a few related things in GCC 8
> > (e.g. 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions")).
>
> That commit is already in all stable releases, so does there need to be
> a gcc 9 specific one?

Ah, you are right. Hm... I recall discussing this at some point when
cleaning up for GCC 9, let me take a look...

> > I typically compile a bare-bones GCC for those things, it is quite quick.
>
> Pointers to how to do that is appreciated. It's been years since I had
> to build gcc "from scratch".

We crossed emails -- I copy it here on-list in case someone else wants it :-)

mkdir ${BUILD_PATH} \
&& cd ${BUILD_PATH} \
&& ${REPO_PATH}/configure \
--enable-languages=c,c++ \
--disable-multilib \
--disable-bootstrap \
--disable-nls \
--prefix=${INSTALL_PATH} \
&& time make \
&& time make install

The key thing is disabling bootstrap to have a single-pass compilation
-- that speeds up things a lot (although, of course, you get less
testing). I would guess you can also disable c++ for the kernel for
even a faster build. You can also use -j, but even without it it does
not really take long (1 hour? -- way less than LLVM anyway). The
installed size nowadays is about 1 GiB.

To get the actual code, I use the git mirror in github for speed
(although it is not that big anyway):

git clone https://github.com/gcc-mirror/gcc

The tags you want to use look like:

gcc-9_1_0-release

Also, the first time you run this, you may need some extra dependencies:

libgmp-dev (maybe named gmp-devel)
libmpfr-dev (mpfr-devel)
libmpc-dev (libmpc-devel)

Unless your distro is quite old, I think they should simply work (a
few years ago I had to compile those manually, but nowadays I don't
seem to need them anymore).

Cheers,
Miguel