diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2015-01-12 15:13:53 +0000 |
---|---|---|
committer | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2015-01-23 15:19:29 +0000 |
commit | fe5e9e45bb56bccb6c6ad755b21074ce4df26a02 (patch) | |
tree | 487090b1a60e693affaab57fe0e3eea53909481e /strata/build-essential/stage1-gcc.morph | |
parent | d022ac34d44616e7c7479a0aa1e81287786f3299 (diff) | |
download | definitions-fe5e9e45bb56bccb6c6ad755b21074ce4df26a02.tar.gz |
Update GCC to 4.9.2
Update the GCC compiler to the 4.9.2 version. It turns out that a C++
compiler is required to build the latest GCC releases, so build one in
stages 1 and 2 as well.
The updated list of GCC configuration options that either don't work in
a cross compiler or are not needed in a temporary compiler, were based
on the latest instructions from Linux From Scratch.
The inclusion of /lib64 in the lib path for the stage 1 linker is an
attempt to turn things more robust rather than to just symlink in /lib
stuff that ends up installed in /lib64 (as it is already being done for
libgcc_s.so). Ideally, we should configure every chunk to install to
/lib, however GCC seems to not honour the `--with-libdir` configuration
flag.
With this version of GCC, it looks like a sysroot needs to be given at
configure time so that `--with-native-system-header-dir` does what it
claims to do. Unfortunately, this has the side effect of making GCC not
passing to the linker the linker sysroot flag: `-Wl,--sysroot=$SYSROOT`.
The workaround is to modify LDFLAGS to give a sysroot directly to GCC,
`--sysroot=$SYSROOT`, which will then be further passed down to the
linker.
As the newest version of GCC finds more warnings than the previous one,
`-Werror` was disabled for the coreutils, GDB and Syslinux projects.
Syslinux's Makefile had to be patched, as it is not possible to disable
`-Werror` for all targets through the NO_WERROR variable.
The hack to handle libgcc_eh being required during eglibc's build was
removed, as it doesn't seem to be the case anymore.
Diffstat (limited to 'strata/build-essential/stage1-gcc.morph')
-rw-r--r-- | strata/build-essential/stage1-gcc.morph | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/strata/build-essential/stage1-gcc.morph b/strata/build-essential/stage1-gcc.morph index 0574749b..1bf6dfb2 100644 --- a/strata/build-essential/stage1-gcc.morph +++ b/strata/build-essential/stage1-gcc.morph @@ -2,16 +2,24 @@ name: stage1-gcc kind: chunk configure-commands: +# Workaround from LFS due GCC not detecting stack protection correctly +- sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure + - mkdir o # Configure flag notes: # 1. See gcc.morph. -# 2. Disable searching /usr/local/include for headers -# 3. The pass 1 compiler needs to find the libraries we build in pass +# 2. Although we will be setting a sysroot at runtime, giving a +# temporary one at configuration time seems necessary so that +# `--with-native-system-header-dir` produces effect and +# /tools/include is in the include path for the newly built GCC. We +# set it by default to a non-existent directory to avoid GCC looking +# at the host dirs, in case we forget to give it at runtime. +# 3. Disable searching /usr/local/include for headers +# 4. The pass 1 compiler needs to find the libraries we build in pass # 2. Include path must be set explicility, because it defaults to -# $SYSROOT/usr/include rather than $SYSROOT/include. FIXME: this -# flag is not present until GCC 4.6.3! -# 4. Disable stuff that doesn't work when building a cross compiler +# $SYSROOT/usr/include rather than $SYSROOT/include. +# 5. 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. - | @@ -22,38 +30,40 @@ configure-commands: --target=$TARGET_STAGE1 \ --prefix="$PREFIX" \ `# [1]` --libdir="$PREFIX/lib" \ + `# [2]` --with-sysroot=/nonexistentdir \ --with-newlib \ - `# [2]` --with-local-prefix="$PREFIX" \ - `# [3]` --with-native-system-header-dir="$PREFIX/include" \ - --with-mpfr-include="$(pwd)/../mpfr/src" \ - --with-mpfr-lib="$(pwd)/mpfr/src/.libs" \ - --with-system-zlib \ + `# [3]` --with-local-prefix="$PREFIX" \ + `# [4]` --with-native-system-header-dir="$PREFIX/include" \ --without-headers \ - --without-cloog \ - --without-ppl \ - --disable-bootstrap \ --disable-nls \ --disable-shared \ --disable-multilib \ - `# [4]` --disable-decimal-float \ - `# [4]` --disable-threads \ - `# [4]` --disable-libgomp \ - `# [4]` --disable-libmudflap \ - `# [4]` --disable-libquadmath \ - `# [4]` --disable-libssp \ - `# [4]` --disable-target-libiberty \ - `# [4]` --disable-target-zlib \ - --enable-languages=c + `# [5]` --disable-decimal-float \ + `# [5]` --disable-threads \ + `# [5]` --disable-libatomic \ + `# [5]` --disable-libgomp \ + `# [5]` --disable-libitm \ + `# [5]` --disable-libquadmath \ + `# [5]` --disable-libsanitizer \ + `# [5]` --disable-libssp \ + `# [5]` --disable-libvtv \ + `# [5]` --disable-libcilkrts \ + `# [5]` --disable-libstdc++-v3 \ + --enable-languages=c,c++ build-commands: -- cd o && make +- | + # GCC is not passing the correct host/target flags to GMP's configure + # script, which causes it to not use the machine-dependent code for + # the platform and use the generic one instead. However, the generic + # code results on an undefined reference to `__gmpn_invert_limb' in + # ARMv7. Fix the invocation of GMP's configure script so that GMP can + # use the machine-dependent code. + 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. -- | - libgcc_filename=$($DESTDIR$PREFIX/bin/$TARGET_STAGE1-gcc -print-libgcc-file-name) - ln -sv libgcc.a $(echo $libgcc_filename | sed 's/libgcc/&_eh/') |