From c5af0789015399dacaaa90d95d029c5434073c86 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Thu, 19 Feb 2015 12:27:18 +0000 Subject: Update ARM cross SDK in line with changes to build-essential This is quite important, the cross toolchain should match the native toolchain exactly to avoid hitting any compatibility bugs. --- strata/armv7lhf-cross-toolchain.morph | 30 +++++--- .../armv7lhf-cross-eglibc.morph | 47 ------------- .../armv7lhf-cross-gcc-nolibc.morph | 80 ++++++++++++++-------- .../armv7lhf-cross-gcc.morph | 45 ++++++------ .../armv7lhf-cross-glibc.morph | 51 ++++++++++++++ .../armv7lhf-cross-libstdc++.morph | 32 +++++++++ 6 files changed, 177 insertions(+), 108 deletions(-) delete mode 100644 strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph create mode 100644 strata/armv7lhf-cross-toolchain/armv7lhf-cross-glibc.morph create mode 100644 strata/armv7lhf-cross-toolchain/armv7lhf-cross-libstdc++.morph diff --git a/strata/armv7lhf-cross-toolchain.morph b/strata/armv7lhf-cross-toolchain.morph index 230361c7..a3539d65 100644 --- a/strata/armv7lhf-cross-toolchain.morph +++ b/strata/armv7lhf-cross-toolchain.morph @@ -7,7 +7,7 @@ chunks: - name: armv7lhf-cross-binutils morph: strata/armv7lhf-cross-toolchain/armv7lhf-cross-binutils.morph repo: upstream:binutils-redhat - ref: 987eb543a034cddc4eeb103f08f566f24a5f964a + ref: b1d3b01332ae49a60ff5d6bf53d3a5b1805769c8 unpetrify-ref: baserock/build-essential build-depends: [] @@ -21,16 +21,16 @@ chunks: - name: armv7lhf-cross-gcc-nolibc morph: strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph repo: upstream:gcc-tarball - ref: 0a1a077d3466cd99a4ed5590db2146b3fec6fff1 + ref: b3c9b176c1f10ebeff5700eb3760e9511f23fa06 unpetrify-ref: baserock/build-essential build-depends: - armv7lhf-cross-binutils -- name: armv7lhf-cross-eglibc - morph: strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph - repo: upstream:eglibc2 - ref: 43ee5d250ad47d2bee8ec17954efb7f22d2b804c - unpetrify-ref: baserock/2.15-build-essential +- name: armv7lhf-cross-glibc + morph: strata/armv7lhf-cross-toolchain/armv7lhf-cross-glibc.morph + repo: upstream:glibc + ref: 52cf9a0153c14df4f6ae3bd0e1e6cc5d171e586c + unpetrify-ref: baserock/glibc-2.20 build-depends: - armv7lhf-cross-binutils - armv7lhf-cross-gcc-nolibc @@ -39,8 +39,18 @@ chunks: - name: armv7lhf-cross-gcc morph: strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph repo: upstream:gcc-tarball - ref: b0254026149b13782eae26d38435a4c62a002cf0 - unpetrify-ref: baserock/build-essential-4.7 + ref: b3c9b176c1f10ebeff5700eb3760e9511f23fa06 + unpetrify-ref: baserock/build-essential + build-depends: + - armv7lhf-cross-binutils + - armv7lhf-cross-glibc + +- name: armv7lhf-cross-libstdc++ + morph: strata/armv7lhf-cross-toolchain/armv7lhf-cross-libstdc++.morph + repo: upstream:gcc-tarball + ref: b3c9b176c1f10ebeff5700eb3760e9511f23fa06 + unpetrify-ref: baserock/build-essential build-depends: - armv7lhf-cross-binutils - - armv7lhf-cross-eglibc + - armv7lhf-cross-gcc + - armv7lhf-cross-glibc diff --git a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph deleted file mode 100644 index ee28c9dd..00000000 --- a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-eglibc.morph +++ /dev/null @@ -1,47 +0,0 @@ -name: armv7lhf-cross-eglibc -kind: chunk - -configure-commands: -- mkdir o - -# Necessary for ARM port -- cd libc && ln -s ../ports ports - -# Configure flag notes: -# 1. Location of linux-api-headers, needed since eglibc doesn't -# support being given a sysroot. -# 2. Location of binutils, since we build binutils for the final -# target triplet, but our gcc of our stage 1 target triplet. -# 3. Normal flags. See eglibc.morph. -# 4. Force configuration values of certain things that can't be detected -# in a cross-compile. -- | - export MORPH_ARCH=armv7lhf - export TARGET=armv7lhf-baserock-linux-gnueabi - export TARGET_STAGE1=armv7lhf-none-linux-gnueabi - export CFLAGS="-O2 $CFLAGS" - # eglibc looks for $TARGET-gcc, but not $TARGET_STAGE1-gcc even - # though --build is specified, so we have to override what gcc to - # use here. - export CC="$TARGET_STAGE1-gcc" - cd o && ../libc/configure \ - $(../morph-arch-config) \ - --build=$TARGET_STAGE1 --host=$TARGET \ - --prefix="$PREFIX" \ - `# [1]` --with-headers="$PREFIX/$TARGET/sys-root/$PREFIX/include" \ - `# [2]` --with-binutils="$PREFIX/$TARGET/bin" \ - `# [3]` --disable-profile --enable-kernel=2.6.25 \ - --enable-add-ons=nptl,ports --without-cvs --without-selinux \ - `# [4]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \ - libc_cv_forced_unwind=yes libc_cv_ssp=no - -build-commands: -- cd o && make localtime=UTC - -install-commands: -- | - # eglibc doesn't help with sysroots, so we need to spell out the - # full path ourselves. - export TARGET=armv7lhf-baserock-linux-gnueabi - cd o && make install_root="$DESTDIR/$PREFIX/$TARGET/sys-root/" \ - localtime=UTC install diff --git a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph index d164a60b..b5a8c338 100644 --- a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph +++ b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc-nolibc.morph @@ -6,49 +6,69 @@ configure-commands: # Configure flag notes: # 1. Standard flags. See gcc.morph. -# 2. Our binutils is for the final $TARGET, rather than the intermediate +# 2. See stage1-gcc.morph. +# 3. Our binutils is for the final $TARGET, rather than the intermediate # target our GCC is being built for, so we need to set # with-build-time-tools to get it to find our binutils at # build-time and with-as and with-ld so our temporary GCC uses # the appropriate tools when it compiles our libc, rather than # trying to use $TARGET_STAGE1-as when producing binaries. -# 3. Disable stuff that doesn't work when building a cross compiler +# 4. Disable stuff that doesn't work when building a cross compiler # without an existing libc, and generally try to keep this build as # simple as possible. - | export MORPH_ARCH=armv7lhf export TARGET=armv7lhf-baserock-linux-gnueabi export TARGET_STAGE1=armv7lhf-none-linux-gnueabi - cd o && - ../configure \ - $(../morph-arch-config) \ - --build=$(sh ../config.guess) --host=$(sh ../config.guess) \ - --target="$TARGET_STAGE1" \ - --prefix="$PREFIX" \ - --disable-bootstrap --disable-nls \ - `# [1]` --libdir="$PREFIX/lib" --disable-multilib --disable-libgomp \ - --without-cloog --without-ppl \ - --with-mpfr-include="$(pwd)/../mpfr/src" \ - --with-mpfr-lib="$(pwd)/mpfr/src/.libs" \ - `# [2]` --with-build-time-tools="$PREFIX/$TARGET/bin" \ - --with-as="$PREFIX/$TARGET/bin/as" \ - --with-ld="$PREFIX/$TARGET/bin/ld" \ - `# [3]` --enable-languages=c --disable-decimal-float \ - --disable-libmudflap --disable-libquadmath --disable-libssp \ - --disable-shared --disable-threads --disable-target-libiberty \ - --disable-target-zlib --without-headers --with-newlib \ - --with-system-zlib + + case "$MORPH_ARCH" in + armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \ + --with-cpu=cortex-a9 \ + --with-tune=cortex-a9 \ + --with-fpu=vfpv3-d16 \ + --with-float=hard" ;; + armv7*) ARCH_FLAGS="--with-arch=armv7-a" ;; + esac + + cd o && ../configure \ + $ARCH_FLAGS \ + --build=$(sh ../config.guess) \ + --host=$(sh ../config.guess) \ + --target="$TARGET_STAGE1" \ + --prefix="$PREFIX" \ + `# [1]` --libdir="$PREFIX/lib" \ + `# [2]` --with-sysroot=/nonexistentdir \ + --with-newlib \ + `# [2]` --with-local-prefix="$PREFIX" \ + `# [2]` --with-native-system-header-dir="$PREFIX/include" \ + `# [3]` --with-build-time-tools="$PREFIX/$TARGET/bin" \ + `# [3]` --with-as="$PREFIX/$TARGET/bin/as" \ + `# [3]` --with-ld="$PREFIX/$TARGET/bin/ld" \ + --without-headers \ + --disable-nls \ + --disable-shared \ + `# [4]` --disable-multilib \ + `# [4]` --disable-decimal-float \ + `# [4]` --disable-threads \ + `# [4]` --disable-libatomic \ + `# [4]` --disable-libgomp \ + `# [4]` --disable-libitm \ + `# [4]` --disable-libquadmath \ + `# [4]` --disable-libsanitizer \ + `# [4]` --disable-libssp \ + `# [4]` --disable-libvtv \ + `# [4]` --disable-libcilkrts \ + `# [4]` --disable-libstdc++-v3 \ + --enable-languages=c,c++ build-commands: -- cd o && make +- | + # See stage1-gcc.morph. + case "$MORPH_ARCH" in + armv7*) sed -i "s/--host=none/--host=armv7a/" o/Makefile + sed -i "s/--target=none/--target=armv7a/" o/Makefile ;; + esac + cd o && make install-commands: - cd o && make DESTDIR="$DESTDIR" install - -# The file libgcc_eh is required during eglibc's build, but is not created -# because we built GCC with --disable-shared. This is a workaround for -# eglibc's build system being slightly broken. -- | - export TARGET_STAGE1=armv7lhf-none-linux-gnueabi - libgcc_filename="$("$DESTDIR$PREFIX/bin/$TARGET_STAGE1-gcc" -print-libgcc-file-name)" - ln -sv libgcc.a "$(echo "$libgcc_filename" | sed 's/libgcc/&_eh/')" diff --git a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph index 50c338e5..140a29b1 100644 --- a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph +++ b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-gcc.morph @@ -6,37 +6,40 @@ configure-commands: # Configure flag notes: # 1. Use the default sysroot path to install to and locate headers -# 2. Recommended by Linux From Scratch; required for C++ ABI -# compatibility with other Linux distributions. +# 2. Avoid having more than one copy of ZLib in use on the system # 3. Standard flags. See gcc.morph. -# 4. Avoid having more than one copy of ZLib in use on the system - | export MORPH_ARCH=armv7lhf export TARGET=armv7lhf-baserock-linux-gnueabi - export TARGET_STAGE1=armv7lhf-none-linux-gnueabi - cd o && ../configure \ - $(../morph-arch-config) \ - --build=$(sh ../config.guess) \ - --host=$(sh ../config.guess) \ - --target="$TARGET" \ - `# [1]` --with-sysroot \ - --prefix="$PREFIX" \ - --disable-bootstrap \ - --enable-shared --enable-threads=posix \ - `# [2]` --enable-__cxa_atexit \ - --enable-languages=c,c++,fortran \ - `# [3]` --libdir="$PREFIX/lib" \ - --disable-libgomp --disable-multilib \ - --without-cloog --without-ppl \ - --with-mpfr-include="$(pwd)/../mpfr/src" \ - --with-mpfr-lib="$(pwd)/mpfr/src/.libs" \ - `# [4]` --with-system-zlib + + case "$MORPH_ARCH" in + armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \ + --with-cpu=cortex-a9 \ + --with-tune=cortex-a9 \ + --with-fpu=vfpv3-d16 \ + --with-float=hard" ;; + armv7*) ARCH_FLAGS="--with-arch=armv7-a" ;; + esac + + cd o && ../configure \ + $ARCH_FLAGS \ + --build=$(sh ../config.guess) \ + --host=$(sh ../config.guess) \ + --target="$TARGET" \ + --prefix="$PREFIX" \ + `# [1]` --with-sysroot \ + --disable-bootstrap \ + `# [2]` --with-system-zlib \ + `# [3]` --libdir="$PREFIX/lib" \ + `# [3]` --disable-multilib \ + `# [3]` --enable-languages=c,c++,fortran build-commands: - cd o && make install-commands: - cd o && make DESTDIR="$DESTDIR" install +- ln -s gcc "$DESTDIR/$PREFIX/bin/cc" - | export TARGET=armv7lhf-baserock-linux-gnueabi for fortran_alias in f77 f90 f95; do diff --git a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-glibc.morph b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-glibc.morph new file mode 100644 index 00000000..2a692c38 --- /dev/null +++ b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-glibc.morph @@ -0,0 +1,51 @@ +name: armv7lhf-cross-glibc +kind: chunk + +configure-commands: +- mkdir o + +# Configure flag notes: +# 1. Location of linux-api-headers, needed since glibc doesn't +# support being given a sysroot. +# 2. Location of binutils, since we build binutils for the final +# target triplet, but our gcc of our stage 1 target triplet. +# 3. Normal flags. See strata/build-essential/glibc.morph. +# 4. Force configuration values of certain things that can't be detected +# in a cross-compile. +- | + export MORPH_ARCH=armv7lhf + export TARGET=armv7lhf-baserock-linux-gnueabi + export TARGET_STAGE1=armv7lhf-none-linux-gnueabi + + export CFLAGS="-O2 $CFLAGS" + + # glibc looks for $TARGET-gcc, but not $TARGET_STAGE1-gcc even + # though --build is specified, so we have to override what gcc to + # use here. + export CC="$TARGET_STAGE1-gcc" + + case "$MORPH_ARCH" in + armv7*) + ARCH_FLAGS="--without-fp" ;; + esac + + cd o && ../configure \ + $ARCH_FLAGS \ + --build=$TARGET_STAGE1 --host=$TARGET \ + --prefix="$PREFIX" \ + `# [1]` --with-headers="$PREFIX/$TARGET/sys-root/$PREFIX/include" \ + `# [2]` --with-binutils="$PREFIX/$TARGET/bin" \ + `# [3]` --disable-profile --enable-kernel=2.6.25 \ + `# [4]` libc_cv_c_cleanup=yes libc_cv_ctors_header=yes \ + libc_cv_forced_unwind=yes libc_cv_ssp=no + +build-commands: +- cd o && make localtime=UTC + +install-commands: +- | + # glibc doesn't help with sysroots, so we need to spell out the + # full path ourselves. + export TARGET=armv7lhf-baserock-linux-gnueabi + cd o && make install_root="$DESTDIR/$PREFIX/$TARGET/sys-root/" \ + localtime=UTC install diff --git a/strata/armv7lhf-cross-toolchain/armv7lhf-cross-libstdc++.morph b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-libstdc++.morph new file mode 100644 index 00000000..7743bb5b --- /dev/null +++ b/strata/armv7lhf-cross-toolchain/armv7lhf-cross-libstdc++.morph @@ -0,0 +1,32 @@ +name: armv7lhf-cross-libstdc++ +kind: chunk +configure-commands: +- mkdir o + +# Configure flag notes: +# 1. Use the default sysroot path to install to and locate headers +# 2. From LFS: the header location of C++ needs to be explicitly given +# as we are running the configure script from the top-level +# directory. +- | + export MORPH_ARCH=armv7lhf + export TARGET=armv7lhf-baserock-linux-gnueabi + + # -fPIC must be given, otherwise it will not be possible to create + # shared libraries linked to libstdc++ + export CPPFLAGS="-fPIC" + cd o && ../libstdc++-v3/configure \ + --build=$(sh ../config.guess) \ + --host=$(sh ../config.guess) \ + --target="$TARGET" \ + --prefix="$PREFIX" \ + --disable-nls \ + --disable-shared \ + --disable-multilib \ + `# [1]` --with-sysroot + +build-commands: +- cd o && make + +install-commands: +- cd o && make DESTDIR="$DESTDIR" install -- cgit v1.2.1