Page MenuHomeSolus

Initial inclusion of arm-none-eabi-newlib package
ClosedPublic

Authored by chax on Apr 2 2019, 7:42 PM.

Details

Summary

Fixes T426
Depends on D5917

Test Plan

This package is part of arm-none-eabi toolchain and can't be tested by itself
It will be used as dependency to build the rest of the toolchain

Diff Detail

Repository
R4750 arm-none-eabi-newlib
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
chax created this revision.Apr 2 2019, 7:42 PM
chax requested review of this revision.Apr 2 2019, 7:42 PM
chax added a comment.Apr 2 2019, 9:08 PM

Here we have circular dependency. Package arm-none-eabi-newlib depends on package arm-none-eabi-gcc to be able to build it. Package arm-none-eabi-gcc also depends on arm-none-eabi-newlib. To circumvent this problem on initial build, we need to first build barebone gcc cross-compiler without newlib support and use it to build initial build of arm-none-eabi-newlib package, which can then be used as dependency to build full gcc cross-compiler. Then we have both packages built and we can use them to build final versions of packages with correct dependencies set. We can also use pre-built gcc cross-compiler (or whole toolchain for that matter) to build initial arm-none-eabi-newlib package.

This is package.yml file I used to build barebone gcc cross-compiler:

name       : arm-none-eabi-gcc-barebone
version    : 8.3.0
release    : 1
source     :
    - https://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz: 64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c
homepage   : http://gcc.gnu.org/
license    : GPL-3.0-or-later
summary    : The GNU Embedded GCC for Arm 
component  : system.devel
description: |
    The GNU Compiler Collection - cross compiler for ARM EABI (bare-metal) target
builddeps  : 
    - gmp
    - mpfr
    - pkgconfig(isl)
    - pkgconfig(libelf)
    - arm-none-eabi-binutils
rundeps    :
    - mpc
    - zlib
environment: |
    export TARGET=arm-none-eabi
    export PREFIX=/usr/share/$TARGET
    source /usr/share/defaults/etc/profile.d/50-arm-toolchain-path.sh
setup      : |
    mkdir build

    _configure () {
        pushd $1
        ../configure \
            --build=%HOST% \
            --target=$TARGET \
            --prefix=$PREFIX \
            --libexecdir=$PREFIX/lib \
            --enable-interwork \
            --enable-multilib \
            --enable-languages=c \
            --with-system-zlib \
            --with-newlib \
            --without-headers \
            --disable-shared \
            --disable-nls \
            --with-gnu-as \
            --with-gnu-ld
        popd
    }
    _configure build

build      : |
    export CFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
    export CXXFLAGS_FOR_TARGET='-g -Os -ffunction-sections -fdata-sections'
    %make -C build all-gcc
install    : |
    %make -C build install-gcc DESTDIR="%installroot%"

    # Remove unnecessary files
    rm -r $installdir$PREFIX/include
    rm -r $installdir$PREFIX/share

Is there any reason why we couldn't do that inside the same build? Ideally we would just build GCC in stages, only keeping the last one. It will take longer to build, sure, but then we never have to rebootstrap manually.

chax added a comment.Apr 3 2019, 5:35 AM

Yes, i can build gcc barebone when building newlib, but bootstrapping is only needed for this first release, because next time those packages will already be present in repos.

In D5918#93905, @chax wrote:

Yes, i can build gcc barebone when building newlib, but bootstrapping is only needed for this first release, because next time those packages will already be present in repos.

I'm not concerned with the extra bootstrapping time. We already do that for the x86 gcc and for LLVM. The point is to never have to "do the dance" of having to be manually involved in the bootstrapping process. I'd rather automatically rebootstrap every time the package is built than have to take time out to rebootstrap manually even once after this lands. I've had to do this twice now with GHC for Haskell and I never want to do it again.

chax added a comment.Apr 3 2019, 9:45 AM

I'm already working on solution to build gcc inside newlib package.

chax updated this revision to Diff 14316.Apr 3 2019, 12:31 PM

Removed arm-none-eabi-gcc as builddep so to avoid circular dependency
Now building barebone gcc compiler inside arm-none-eabi-newlib package
just for needs of compiling newlib without including it in final package.

chax updated this revision to Diff 14454.Apr 11 2019, 5:49 PM

Added missing multilib support

DataDrake accepted this revision.May 20 2019, 11:54 PM

LGTM. thanks!

This revision is now accepted and ready to land.May 20 2019, 11:54 PM
This revision was automatically updated to reflect the committed changes.