summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--README.md403
-rw-r--r--config/arch/mips.in.22
-rw-r--r--config/binutils/binutils.in.22
-rw-r--r--config/cc/gcc.in8
-rw-r--r--config/debug/gdb.in.cross2
-rw-r--r--config/libc/glibc.in.210
-rw-r--r--config/libc/none.in4
-rw-r--r--config/libc/uClibc.in4
-rw-r--r--config/target.in4
-rw-r--r--kconfig/.gitignore4
-rw-r--r--kconfig/lxdialog/.gitignore2
-rw-r--r--patches/gcc/5.3.0/130-build_gcc-5_with_gcc-6.patch151
-rw-r--r--patches/gcc/5.4.0/100-uclibc-conf.patch (renamed from patches/gcc/5.3.0/100-uclibc-conf.patch)0
-rw-r--r--patches/gcc/5.4.0/110-xtensa-implement-trap-pattern.patch (renamed from patches/gcc/5.3.0/110-xtensa-implement-trap-pattern.patch)0
-rw-r--r--patches/gcc/5.4.0/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch (renamed from patches/gcc/5.3.0/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch)0
-rw-r--r--patches/gcc/5.4.0/301-missing-execinfo_h.patch (renamed from patches/gcc/5.3.0/301-missing-execinfo_h.patch)0
-rw-r--r--patches/gcc/5.4.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch (renamed from patches/gcc/5.3.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch)0
-rw-r--r--patches/gcc/5.4.0/380-gcc-plugin-POSIX-include-sys-select-h.patch (renamed from patches/gcc/5.3.0/380-gcc-plugin-POSIX-include-sys-select-h.patch)0
-rw-r--r--patches/gcc/5.4.0/810-arm-softfloat-libgcc.patch (renamed from patches/gcc/5.3.0/810-arm-softfloat-libgcc.patch)0
-rw-r--r--patches/gcc/5.4.0/830-arm_unbreak_armv4t.patch (renamed from patches/gcc/5.3.0/830-arm_unbreak_armv4t.patch)0
-rw-r--r--patches/gcc/5.4.0/840-microblaze-enable-dwarf-eh-support.patch (renamed from patches/gcc/5.3.0/840-microblaze-enable-dwarf-eh-support.patch)0
-rw-r--r--patches/gcc/5.4.0/850-libstdcxx-uclibc-c99.patch (renamed from patches/gcc/5.3.0/850-libstdcxx-uclibc-c99.patch)0
-rw-r--r--patches/gcc/5.4.0/860-cilk-wchar.patch (renamed from patches/gcc/5.3.0/860-cilk-wchar.patch)0
-rw-r--r--patches/gcc/5.4.0/870-xtensa-add-mauto-litpools-option.patch (renamed from patches/gcc/5.3.0/870-xtensa-add-mauto-litpools-option.patch)0
-rw-r--r--patches/gcc/5.4.0/871-xtensa-reimplement-register-spilling.patch (renamed from patches/gcc/5.3.0/871-xtensa-reimplement-register-spilling.patch)0
-rw-r--r--patches/gcc/5.4.0/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch (renamed from patches/gcc/5.3.0/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch)0
-rw-r--r--patches/gcc/5.4.0/873-xtensa-fix-_Unwind_GetCFA.patch (renamed from patches/gcc/5.3.0/873-xtensa-fix-_Unwind_GetCFA.patch)0
-rw-r--r--patches/gcc/5.4.0/874-xtensa-add-uclinux-support.patch174
-rw-r--r--patches/gcc/5.4.0/890-fix-m68k-compile.patch15
-rw-r--r--patches/gcc/5.4.0/891-fix-m68k-uclinux.patch18
-rw-r--r--patches/gcc/5.4.0/892-microblaze-uclibc.patch24
-rw-r--r--patches/gcc/5.4.0/900-libitm-fixes-for-musl-support.patch (renamed from patches/gcc/5.3.0/900-libitm-fixes-for-musl-support.patch)0
-rw-r--r--patches/gcc/5.4.0/901-fixincludes-update-for-musl-support.patch (renamed from patches/gcc/5.3.0/901-fixincludes-update-for-musl-support.patch)0
-rw-r--r--patches/gcc/5.4.0/902-unwind-fix-for-musl.patch (renamed from patches/gcc/5.3.0/902-unwind-fix-for-musl.patch)0
-rw-r--r--patches/gcc/5.4.0/903-libstdc++-libgfortran-gthr-workaround-for-musl.patch (renamed from patches/gcc/5.3.0/903-libstdc++-libgfortran-gthr-workaround-for-musl.patch)0
-rw-r--r--patches/gcc/5.4.0/904-musl-libc-config.patch (renamed from patches/gcc/5.3.0/904-musl-libc-config.patch)0
-rw-r--r--patches/gcc/5.4.0/905-add-musl-support-to-gcc.patch (renamed from patches/gcc/5.3.0/905-add-musl-support-to-gcc.patch)0
-rw-r--r--patches/gcc/5.4.0/906-mips-musl-support.patch (renamed from patches/gcc/5.3.0/906-mips-musl-support.patch)0
-rw-r--r--patches/gcc/5.4.0/907-x86-musl-support.patch (renamed from patches/gcc/5.3.0/907-x86-musl-support.patch)0
-rw-r--r--patches/gcc/5.4.0/908-arm-musl-support.patch (renamed from patches/gcc/5.3.0/908-arm-musl-support.patch)0
-rw-r--r--patches/gcc/5.4.0/909-aarch64-musl-support.patch (renamed from patches/gcc/5.3.0/909-aarch64-musl-support.patch)0
-rw-r--r--patches/gcc/5.4.0/910-nios2-bad-multilib-default.patch28
-rw-r--r--patches/gcc/5.4.0/930-libgcc-disable-split-stack-nothreads.patch14
-rw-r--r--patches/gcc/5.4.0/940-uclinux-enable-threads.patch19
-rw-r--r--samples/arm-cortex_a15-linux-gnueabihf/crosstool.config (renamed from samples/arm-cortex_a15-linux-gnueabi/crosstool.config)0
-rw-r--r--samples/arm-cortex_a15-linux-gnueabihf/reported.by (renamed from samples/arm-cortex_a15-linux-gnueabi/reported.by)0
-rw-r--r--samples/arm-multilib-linux-uclibcgnueabi/crosstool.config18
-rw-r--r--samples/arm-multilib-linux-uclibcgnueabi/reported.by3
-rw-r--r--samples/mips64el-multilib-linux-uclibc/crosstool.config (renamed from samples/mips64el-n32-linux-uclibc/crosstool.config)3
-rw-r--r--samples/mips64el-multilib-linux-uclibc/reported.by3
-rw-r--r--samples/mips64el-n32-linux-uclibc/reported.by3
-rw-r--r--samples/mips64el-n64-linux-uclibc/crosstool.config15
-rw-r--r--samples/mips64el-n64-linux-uclibc/reported.by3
-rw-r--r--samples/mipsel-multilib-linux-gnu/crosstool.config20
-rw-r--r--samples/mipsel-multilib-linux-gnu/reported.by3
-rw-r--r--samples/powerpc64-multilib-linux-gnu/crosstool.config13
-rw-r--r--samples/powerpc64-multilib-linux-gnu/reported.by3
-rw-r--r--samples/samples.mk4
-rw-r--r--samples/sh4-multilib-linux-gnu/crosstool.config13
-rw-r--r--samples/sh4-multilib-linux-gnu/reported.by3
-rw-r--r--samples/sh4-multilib-linux-uclibc/crosstool.config14
-rw-r--r--samples/sh4-multilib-linux-uclibc/reported.by3
-rw-r--r--samples/sparc64-multilib-linux-gnu/crosstool.config8
-rw-r--r--samples/sparc64-multilib-linux-gnu/reported.by3
-rw-r--r--samples/x86_64-multilib-linux-gnu/crosstool.config17
-rw-r--r--samples/x86_64-multilib-linux-gnu/reported.by3
-rw-r--r--samples/x86_64-multilib-linux-musl/crosstool.config19
-rw-r--r--samples/x86_64-multilib-linux-musl/reported.by3
-rw-r--r--samples/x86_64-multilib-linux-uclibc/crosstool.config20
-rw-r--r--samples/x86_64-multilib-linux-uclibc/reported.by3
-rw-r--r--scripts/build/arch.sh68
-rw-r--r--scripts/build/arch/alpha.sh11
-rw-r--r--scripts/build/arch/arm.sh86
-rw-r--r--scripts/build/arch/m68k.sh15
-rw-r--r--scripts/build/arch/microblaze.sh11
-rw-r--r--scripts/build/arch/mips.sh62
-rw-r--r--scripts/build/arch/nios2.sh1
-rw-r--r--scripts/build/arch/powerpc.sh49
-rw-r--r--scripts/build/arch/s390.sh16
-rw-r--r--scripts/build/arch/sh.sh52
-rw-r--r--scripts/build/arch/sparc.sh56
-rw-r--r--scripts/build/arch/x86.sh132
-rw-r--r--scripts/build/arch/xtensa.sh6
-rw-r--r--scripts/build/binutils/binutils.sh2
-rw-r--r--scripts/build/cc/100-gcc.sh208
-rw-r--r--scripts/build/internals.sh8
-rw-r--r--scripts/build/libc/avr-libc.sh4
-rw-r--r--scripts/build/libc/glibc.sh317
-rw-r--r--scripts/build/libc/mingw.sh4
-rw-r--r--scripts/build/libc/musl.sh113
-rw-r--r--scripts/build/libc/newlib.sh4
-rw-r--r--scripts/build/libc/none.sh4
-rw-r--r--scripts/build/libc/uClibc.sh539
-rwxr-xr-xscripts/config.guess37
-rwxr-xr-xscripts/config.sub16
-rw-r--r--scripts/crosstool-NG.sh.in56
-rw-r--r--scripts/functions230
-rw-r--r--steps.mk4
99 files changed, 2186 insertions, 1015 deletions
diff --git a/.travis.yml b/.travis.yml
index c351292..6f56629 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,7 +41,7 @@ env:
- CT_SAMPLE=armeb-unknown-linux-gnueabi
- CT_SAMPLE=arm-unknown-linux-musleabi
- CT_SAMPLE=aarch64-unknown-linux-gnueabi
- - CT_SAMPLE=mips64el-n64-linux-uclibc
+ - CT_SAMPLE=mips64el-multilib-linux-uclibc
- CT_SAMPLE=powerpc-e500v2-linux-gnuspe
- CT_SAMPLE=x86_64-unknown-linux-uclibc
- CT_SAMPLE=xtensa-unknown-linux-uclibc
diff --git a/README.md b/README.md
index 325228e..498494a 100644
--- a/README.md
+++ b/README.md
@@ -1,42 +1,383 @@
-# Crosstool-NG [![Build Status][travis-status]][travis]
+# Crosstool-NG
-Crosstool-NG follows the `autoconf` dance. So, to get you
-kick-started, just run:
+[![Build Status][travis-status]][travis]
- ./configure --help
+[![Throughput Graph](https://graphs.waffle.io/crosstool-ng/crosstool-ng/throughput.svg)](https://waffle.io/crosstool-ng/crosstool-ng/metrics/throughput)
-If you are using a development snapshot, you'll have to
-create the configure script, first. Just run:
+[![Stories in Ready](https://badge.waffle.io/crosstool-ng/crosstool-ng.png?label=ready&title=Ready)](https://waffle.io/crosstool-ng/crosstool-ng) [![Stories in Waiting For Response](https://badge.waffle.io/crosstool-ng/crosstool-ng.png?label=waiting%20for%20response&title=Waiting%20For%20Response)](https://waffle.io/crosstool-ng/crosstool-ng) [![Stories in In Progress](https://badge.waffle.io/crosstool-ng/crosstool-ng.png?label=in%20progress&title=In%20Progress)](https://waffle.io/crosstool-ng/crosstool-ng)
- ./bootstrap
+## Introduction
-You will find the documentation in the directory `docs`.
-Here is a quick overview of what you'll find there:
+crosstool-NG aims at building toolchains. Toolchains are an essential component in a software development project. It will compile, assemble and link the code that is being developed. Some pieces of the toolchain will eventually end up in the resulting binary/ies: static libraries are but an example.
-<ol start="0">
- <li>Table of content</li>
- <li>Introduction</li>
- <li>Installing crosstool-NG</li>
- <li>Configuring a toolchain</li>
- <li>Building the toolchain</li>
- <li>Using the toolchain</li>
- <li>Toolchain types</li>
- <li>Contributing</li>
- <li>Internals</li>
-</ol>
-<ol type="A">
- <li>Credits</li>
- <li>Known issues</li>
- <li>Misc. tutorials</li>
-</ol>
+Toolchains are made of different pieces of software, each being quite complex and requiring specially crafted options to build and work seamlessly. This is usually not that easy, even in the not-so-trivial case of native toolchains. The work reaches a higher degree of complexity when it comes to cross-compilation, where it can become quite a nightmare… mostly envolving host polution and linking issues.
-You can also point your browser at: http://crosstool-ng.org
+Some cross-toolchains exist on the internet, and can be used for general development, but they have a number of limitations:
-Aloha!
+- They can be general purpose, in that they are configured for the majority - in that it is optimized for a specific target - and may be configured for a specific target when you might have multiple and want consistent configuration across the toolchains you use.
+- They can be prepared for a specific target and thus are not easy to use, nor optimised for, or even supporting your target,
+- They often are using aging components (compiler, C library, etc…) not supporting special features of your shiny new processor; On the other side, these toolchains offer some advantages:
+ - They are ready to use and quite easy to install and setup,
+ - They are proven if used by a wide community.
-[travis-status]: https://travis-ci.org/crosstool-ng/crosstool-ng.svg
-[travis]: https://travis-ci.org/crosstool-ng/crosstool-ng
+But once you want to get all the juice out of your specific hardware, you will want to build your own toolchain. This is where crosstool-NG comes into play.
+
+There are also a number of tools that build toolchains for specific needs, which are not really scalable. Examples are:
+
+- [buildroot](https://buildroot.org/) whose main purpose is to build complete root file systems, hence the name. But once you have your toolchain with buildroot, part of it is installed in the root-to-be, so if you want to build a whole new root, you either have to save the existing one as a template and restore it later, or restart again from scratch. This is not convenient,
+- ptxdist[[en](http://www.pengutronix.de/software/ptxdist/index_en.html)][[de](http://www.pengutronix.de/software/ptxdist/index_de.html)], whose purpose is very similar to buildroot,
+other projects (openembedded for example), which is again used to build complete root file systems.
+
+crosstool-NG is really targetted at building toolchains, and only toolchains. It is then up to you to use it the way you want.
+
+With crosstool-NG, you can learn precisely how each component is configured and built, so you can finely tweak the build steps should you need it.
+
+crosstool-NG can build from generic, general purpose toolchains, to very specific and dedicated toolchains. Simply fill in specific values in the adequate options.
+
+Of course, it doesn't prevent you from doing your home work first. You have to know with some degree of exactitude what your target is (archictecture, processor variant), what it will be used for (embedded, desktop, realtime), what degree of confidence you have with each component (stability, maintainability), and so on…
+
+## Features
+
+It's quite difficult to list all possible features available in crosstool-NG. Here is a list of those I find important:
+
+* kernel-like menuconfig configuration interface
+ * widespread, well-known interface
+ * easy, yet powerful configuration
+* growing number of supported architectures
+ * see the status table for the current list
+* support for alternative components in the toolchain
+ * uClibc-, glibc-, newlib-, musl-libc-based toolchain supported right now!
+ * others easy to implement
+* different target OS supported
+ * Linux
+ * bare metal
+* patch repository for those versions needing patching
+ * patches for many versions of the toolchain components
+ * support for custom local patch repository
+* different threading models (depending on target)
+ * NPTL
+ * linuxthreads
+* support for both soft- and hard-float toolchains
+* support for multlib toolchains (experimental for now)
+* debug facilities
+ * native and cross gdb, gdbserver
+ * debugging libraries: dmalloc, duma
+ * debugging tools: ltrace, strace
+ * restart a build at any step
+* sample configurations repository usable as starting point for your own toolchain
+ * see the status table for the current list
+
+## Download and usage
+
+You can:
+
+- either get released versions and fixes there: /download/crosstool-ng/
+- or check-out the [development stuff](#using-the-latest-development-stuff), or browse the code on-line, from the git repos at:
+ - [https://github.com/crosstool-ng/crosstool-ng](https://github.com/crosstool-ng/crosstool-ng) (main development site)
+ - crosstool-ng [Browse](http://crosstool-ng.org/git/crosstool-ng/) [GIT](git://crosstool-ng.org/crosstool-ng) [HTTP](http://crosstool-ng.org/git/crosstool-ng) (OSUOSL mirror)
+
+
+### Using a released version
+
+If you decide to use a released version (replace VERSION with the actual version you choose; the latest version is listed at the top of this page):
+
+```
+wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-VERSION.tar.bz2
+```
+
+Starting with 1.21.0, releases are signed with Bryan Hundven's pgp key
+
+The fingerprint is:
+
+```
+561E D9B6 2095 88ED 23C6 8329 CAD7 C8FC 35B8 71D1
+```
+
+The public key is found on: http://pgp.surfnet.nl/
+
+```
+35B871D1
+```
+
+To validate the release tarball run you need to import the key from the keyserver and download the signature of the tarball:
+
+```
+gpg --recv-keys 35B871D1
+wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-VERSION.tar.bz2.sig
+```
+
+Now, with the tarball and signature in the same directory, you can verify the tarball:
+
+```gpg --verify crosstool-ng-VERSION.tar.bz2.sig```
+
+Now you can unpack and install crosstool-NG:
+
+```
+tar xjf crosstool-ng-VERSION.tar.bz2
+cd crosstool-ng-VERSION
+./configure --prefix=/some/place
+make
+make install
+export PATH="${PATH}:/some/place/bin"
+```
+
+Then, you are ready to use crosstool-NG.
+
+- create a place to work in, then list the existing samples (pre-configured toolchains that are known to build and work) to see if one can fit your actual needs. Sample names are 4-part tuples, such as arm-unknown-linux-gnueabi. In the following, we'll use that as a sample name; adapt to your needs:
+
+```
+mkdir /a/directory/to/build/your/toolchain
+cd /a/directory/to/build/your/toolchain
+ct-ng help
+ct-ng list-samples
+ct-ng show-arm-unknown-linux-gnueabi
+```
+- once you know what sample to use, configure ct-ng to use it:
+
+```
+ct-ng arm-unknown-linux-gnueabi
+```
+- samples are configured to install in `${HOME}/x-tools/arm-unknown-linux-gnueabi` by default. This should be OK for a first time user, so you can now build your toolchain:
+
+```
+ct-ng build
+```
+
+- finally, you can set access to your toolchain, and call your new cross-compiler with :
+
+```
+export PATH="${PATH}:${HOME}/x-tools/arm-unknown-linux-gnueabi/bin"
+arm-unknown-linux-gnueabi-gcc
+```
+
+Of course, replace arm-unknown-linux-gnueabi with the actual sample name you choose! ;-)
+
+If no sample really fits your needs:
+
+1. choose the one closest to what you want (see above), and start building it (see above, too)
+ - this ensures sure it is working for your machine, before trying to do more advanced tests
+2. fine-tune the configuration, and re-run the build, with:
+
+```
+ct-ng menuconfig
+ct-ng build
+```
+
+Then, if all goes well, your toolchain will be available and you can set access to it as shown above.
+
+See contacts, below for how to ask for further help.
+
+**Note 1:** If you elect to build a uClibc-based toolchain, you will have to prepare a config file for uClibc with <= crosstool-NG-1.21.0. In >= crosstool-NG-1.22.0 you only need to prepare a config file for uClibc(or uClibc-ng) if you really need a custom config for uClibc.
+
+**Note 2:** If you call `ct-ng --help` you will get help for `make(2)`. This is because ct-ng is in fact a `make(2)` script. There is no clean workaround for this.
+
+## Using the latest development stuff
+
+I usually setup my development environment like this:
+
+```
+mkdir $HOME/build
+cd $HOME/build
+git clone https://github.com/crosstool-ng/crosstool-ng
+cd crosstool-ng
+./bootstrap
+./configure --prefix=$HOME/.local
+make
+make install
+```
+
+Now make sure `$HOME/.local/bin` is in your PATH (Newer Linux distributions [fc23, ubuntu-16.04, debian stretch] should have this in the PATH already):
+
+```
+echo -ne "\n\nif [ -d \"$HOME/.local/bin\" ]; then\n PATH=\"$HOME/.local/bin:$PATH\"\nfi" >> ~/.profile
+```
+
+Then source your .profile to add the PATH to your current environment, or logout and log back in:
+
+```
+source ~/.profile
+```
+
+Now I create a directory to do my toolchain builds in:
+
+```
+mkdir $HOME/tc/
+cd $HOME/tc/
+```
+
+Say we want to build armv6-rpi-linux-gnueabi:
+
+```
+mkdir armv6-rpi-linux-gnueabi
+cd armv6-rpi-linux-gnueabi
+ct-ng armv6-rpi-linux-gnueabi
+```
+
+Now build the sample:
-irc: irc.freenode.net #crosstool-ng
+```
+ct-ng build
+```
-[mailing list](mailto:crossgcc@sourceware.org)
+## Repository layout
+
+|URL | Purpose |
+|---|---|
+| http://crosstool-ng.org/git | All available development repositories |
+| http://crosstool-ng.org/git/crosstool-ng/ | Mirror of the development repository |
+| https://github.com/crosstool-ng/crosstool-ng/ | Main development repository |
+
+To clone the main repository:
+
+```
+git clone https://github.com/crosstool-ng/crosstool-ng
+```
+
+You can also download from our mirror at crosstool-ng.org:
+
+```
+git clone git://crosstool-ng.org/crosstool-ng
+```
+
+Alternatively, if you are sitting behind a restrictive proxy that does not let the git protocol through, you can clone with:
+
+```
+git clone http://crosstool-ng.org/git/crosstool-ng
+```
+
+#### Old repositories
+
+These are the old Mercurial repositories. They are now read-only: [http://crosstool-ng.org/hg/](http://crosstool-ng.org/hg/)
+
+### Pull Requests and Issues
+
+You can find open Pull Requests on GitHub [here](https://github.com/crosstool-ng/crosstool-ng/pulls) and you can find open issues [here](https://github.com/crosstool-ng/crosstool-ng/issues).
+
+#### Contributing
+
+To contribute to crosstool-NG it is helpful to provide as much information as you can about your change, including any updates to documentation (if appropriate), and test... test... test.
+
+- [Fork crosstool-ng on github](https://github.com/crosstool-ng/crosstool-ng#fork-destination-box)
+- Clone the fork you made to your computer
+
+```
+git clone https://github.com/crosstool-ng/crosstool-ng
+```
+
+- Create a topic branch for your work
+
+```
+git checkout -b fix_comment_typo
+```
+
+- Make changes
+ - hack
+ - test
+ - hack
+ - etc...
+- Add your changes
+
+```
+git add [file(s) that changed, add -p if you want to be more specific]
+```
+
+- Verify you are happy with your changes to be commited
+
+```
+git diff --cached
+```
+
+- Commit changes
+
+```
+git commit -s
+```
+
+The `-s` automatically adds your `Signed-off-by: [name] <email>` to your commit message. Your commit will be rejected without this.
+
+Also, please explain what your change does. `"Fix stuff"` will be rejected. For examples of good commit messages, read the [changelog](https://github.com/crosstool-ng/crosstool-ng/commits/master).
+
+- Push your topic branch with your changes to your fork
+
+```
+git push origin fix_comment_typo
+```
+
+- Go to the crosstool-ng project and click the `Compare & pull request` button for the branch you want to open a pull request with.
+- Review the pull request changes, and verify that you are opening a pull request for the appropriate branch. The title and message should reflect the nature/theme of the changes in the PR, say the title is `Fix comment typos` and the message details any specifics you can provide.
+ - You might change the crosstool-ng branch, if you are opening a pull request that is intended for a different branch. For example, when you created your topic branch you could have done:
+
+```
+git checkout -b fix_out_of_date_patch origin/1.22
+```
+ Then when you get to this pull request screen change the base branch from `master` to `1.22`
+
+- By creating a pull request, the PR is entered into the [backlog](https://waffle.io/crosstool-ng/crosstool-ng). A [travis-ci](https://travis-ci.org/crosstool-ng/crosstool-ng/builds) job will run to test your changes against a select set of samples. As they start to get worked, they should be placed in the `Ready` state. PRs that are being worked are `In Progress`. If a questions come up about the commit that might envolve changes to the commit then the PR is placed in `Waiting For Response`, you have two options:
+ 1. Fix the issue with the commit by adding a new commit in the topic branch that fixes the code review. Then push your changes to your branch. This option keeps the comments in the PR, and allows for further code review. I personally dislike this, because people are lazy and fix reviews with `fix more review issues`. Please make good commit messages! All rules about commits from above apply! **THIS IS PREFERED**
+
+
+Add your changes
+
+```
+git add [file(s) that changed, add -p if you want to be more specific]
+```
+
+Verify you are happy with your changes to be commited
+
+```
+git diff --cached
+```
+
+Commit changes
+
+```
+git commit -s
+```
+
+- Push your topic branch with your changes to your fork
+
+```
+git push origin fix_comment_typo
+```
+
+At this point the PR will be updated to have the latest commit to that branch, and can be subsequently reviewed.
+
+ 2. Interactively rebase the offending commit(s) to fix the code review. This option is slightly annoying on Github, as the comments are stored with the commits, and disapear when new commits replace the old commits. I do this when I don't care about the previous comments in the code review and need to do a total rewrite of my work. This comes with other issues, like your topic branch not being up-to-date with master. So I use this work-flow:
+
+```
+git fetch --all
+git rebase --ignore-whitespace origin master
+git rebase -i <offending-commit-id>^
+```
+
+**NOTE:** The `--ignore-whitespace` stops `git apply` (which is called by rebase) from changing any whitespace when it runs.
+
+Replace `pick` with `edit` or remove the line to delete a commit.
+Fix the issue in the code review.
+
+```
+git add [file(s)]
+git rebase --continue
+<update commit comment if needed>
+git push --force origin fix_comment_typo
+```
+
+### Patchwork
+
+We previously used patchwork for development, but it is no longer used. I'd like to see patches that are still applicable turned into Pull Requests on GitHub.
+
+You can find the [list of pending patches](http://patchwork.ozlabs.org/project/crosstool-ng/) available on [patchwork](http://jk.ozlabs.org/projects/patchwork/).
+
+## More Info
+
+You can find *all* of this and more at [crosstool-ng.org](http://crosstool-ng.org/)
+
+
+We are also available on IRC: irc.freenode.net #crosstool-ng
+
+We also have a [mailing list](mailto:crossgcc@sourceware.org), when you can get ahold of anyone on IRC. Archive and subscription info can be found here: [https://sourceware.org/ml/crossgcc/](https://sourceware.org/ml/crossgcc/)
+
+Aloha! :-)
+
+[travis]: https://travis-ci.org/crosstool-ng/crosstool-ng
+[travis-status]: https://travis-ci.org/crosstool-ng/crosstool-ng.svg
diff --git a/config/arch/mips.in.2 b/config/arch/mips.in.2
index ee0424d..35c60e0 100644
--- a/config/arch/mips.in.2
+++ b/config/arch/mips.in.2
@@ -7,7 +7,7 @@ choice
config ARCH_mips_o32
bool
prompt "o32"
- depends on ARCH_32
+ depends on (ARCH_32 || MULTILIB)
help
This is the -mabi=32 gcc option.
diff --git a/config/binutils/binutils.in.2 b/config/binutils/binutils.in.2
index 3dafb0f..336098b 100644
--- a/config/binutils/binutils.in.2
+++ b/config/binutils/binutils.in.2
@@ -29,7 +29,7 @@ if ELF2FLT_GIT
config ELF2FLT_GIT_CSET
string
prompt "git cset"
- default "454b6b415a31959661406bdfbd9dad22229367bf"
+ default "9dbc458c6122c495bbdec8dc975a15c9d39e5ff2"
help
Enter the git changeset to use.
diff --git a/config/cc/gcc.in b/config/cc/gcc.in
index 2df2058..7894ec9 100644
--- a/config/cc/gcc.in
+++ b/config/cc/gcc.in
@@ -72,9 +72,9 @@ choice
# Don't remove next line
# CT_INSERT_VERSION_BELOW
-config CC_GCC_V_5_3_0
+config CC_GCC_V_5_4_0
bool
- prompt "5.3.0"
+ prompt "5.4.0"
select CC_GCC_5
config CC_GCC_V_linaro_5_2
@@ -226,7 +226,7 @@ config CC_GCC_HAS_LNK_HASH_STYLE
bool
# Only enable gcc's support for plugins if binutils has it as well
-# They are usefull only when doing LTO, but it does no harm enabling
+# They are useful only when doing LTO, but it does no harm enabling
# them even without LTO.
config CC_GCC_ENABLE_PLUGINS
bool
@@ -261,7 +261,7 @@ config CC_GCC_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
- default "5.3.0" if CC_GCC_V_5_3_0
+ default "5.4.0" if CC_GCC_V_5_4_0
default "linaro-5.2-2015.11-2" if CC_GCC_V_linaro_5_2
default "linaro-4.9-2015.06" if CC_GCC_V_linaro_4_9
default "4.9.3" if CC_GCC_V_4_9_3
diff --git a/config/debug/gdb.in.cross b/config/debug/gdb.in.cross
index 07b85b8..fb993c9 100644
--- a/config/debug/gdb.in.cross
+++ b/config/debug/gdb.in.cross
@@ -21,7 +21,7 @@ config GDB_CROSS_STATIC
depends on CONFIGURE_has_static_link
select WANTS_STATIC_LINK
help
- A static cross gdb can be usefull if you debug on a machine that is
+ A static cross gdb can be useful if you debug on a machine that is
not the one that is used to compile the toolchain.
That way, you can share the cross-gdb without installing a toolchain
diff --git a/config/libc/glibc.in.2 b/config/libc/glibc.in.2
index 346f9b7..104552a 100644
--- a/config/libc/glibc.in.2
+++ b/config/libc/glibc.in.2
@@ -55,16 +55,6 @@ config LIBC_GLIBC_EXTRA_CFLAGS
help
Extra target CFLAGS to use when building.
-config LIBC_EXTRA_CC_ARGS
- string
- prompt "gcc extra flags"
- default ""
- help
- Extra flags to pass gcc when building.
-
- Seldom used, except for sparc64 which seems to need the flag -64
- to be passed onto gcc.
-
config LIBC_ENABLE_FORTIFIED_BUILD
bool
prompt "Enable fortified build (EXPERIMENTAL)"
diff --git a/config/libc/none.in b/config/libc/none.in
index d587faf..b8860b0 100644
--- a/config/libc/none.in
+++ b/config/libc/none.in
@@ -4,10 +4,10 @@
##
## help Do not use a C library.
## help
-## help This is usefull if your project is self-contained, does not rely on
+## help This is useful if your project is self-contained, does not rely on
## help an external C library, and provides all the necessary bits.
## help
-## help Most probably usefull to bootloaders, as they generally don't depend
+## help Most probably useful to bootloaders, as they generally don't depend
## help on the C library.
## help
## help If unsure: do *not* choose that, and use another option in the choice.
diff --git a/config/libc/uClibc.in b/config/libc/uClibc.in
index 989da7b..a99ff73 100644
--- a/config/libc/uClibc.in
+++ b/config/libc/uClibc.in
@@ -129,13 +129,13 @@ config LIBC_UCLIBC_VERBOSITY_0
config LIBC_UCLIBC_VERBOSITY_1
bool
- prompt "Brief build (show defines, ld flags)"
+ prompt "Very verbose build"
help
Print simplified command lines.
config LIBC_UCLIBC_VERBOSITY_2
bool
- prompt "Very verbose build"
+ prompt "Brief build (show defines, ld flags)"
help
Print full command lines.
diff --git a/config/target.in b/config/target.in
index 8cbaabc..e8f0fe7 100644
--- a/config/target.in
+++ b/config/target.in
@@ -65,9 +65,13 @@ config ARCH_REQUIRES_MULTILIB
bool
select MULTILIB
+# Multilib requires 1st core pass (i.e., pass without building libgcc)
+# to determine which target cflags vary with multilib and which must be
+# passed from the arch configuration.
config MULTILIB
bool
prompt "Build a multilib toolchain (READ HELP!!!)"
+ select CC_CORE_PASS_1_NEEDED
help
If you say 'y' here, then the toolchain will also contain the C library
optimised for some variants of the selected architecture, besides the
diff --git a/kconfig/.gitignore b/kconfig/.gitignore
index 7ee9419..21fa66f 100644
--- a/kconfig/.gitignore
+++ b/kconfig/.gitignore
@@ -1,7 +1,7 @@
conf
?conf
-**.o
-**.dep
+*.o
+*.dep
zconf.lex.c
zconf.hash.c
zconf.tab.c
diff --git a/kconfig/lxdialog/.gitignore b/kconfig/lxdialog/.gitignore
new file mode 100644
index 0000000..f2e85c0
--- /dev/null
+++ b/kconfig/lxdialog/.gitignore
@@ -0,0 +1,2 @@
+*.o
+*.dep
diff --git a/patches/gcc/5.3.0/130-build_gcc-5_with_gcc-6.patch b/patches/gcc/5.3.0/130-build_gcc-5_with_gcc-6.patch
deleted file mode 100644
index fbab9eb..0000000
--- a/patches/gcc/5.3.0/130-build_gcc-5_with_gcc-6.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-From 1e5f1089dec3af328fd03125d6778f666d0bd4e4 Mon Sep 17 00:00:00 2001
-From: edlinger <edlinger@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Thu, 25 Feb 2016 15:33:50 +0000
-Subject: [PATCH 1/1] 2016-02-25 Bernd Edlinger <bernd.edlinger@hotmail.de>
-
- Backported from mainline
- 2016-02-19 Jakub Jelinek <jakub@redhat.com>
- Bernd Edlinger <bernd.edlinger@hotmail.de>
-
- * Make-lang.in: Invoke gperf with -L C++.
- * cfns.gperf: Remove prototypes for hash and libc_name_p
- inlines.
- * cfns.h: Regenerated.
- * except.c (nothrow_libfn_p): Adjust.
-
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@233720 138bc75d-0d04-0410-961f-82ee72b054a4
----
- gcc/cp/Make-lang.in | 2 +-
- gcc/cp/cfns.gperf | 10 ++--------
- gcc/cp/cfns.h | 41 ++++++++++++++---------------------------
- gcc/cp/except.c | 3 ++-
- 5 files changed, 31 insertions(+), 37 deletions(-)
-
-diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
-index e98beb1..b09fb02 100644
---- a/gcc/cp/Make-lang.in
-+++ b/gcc/cp/Make-lang.in
-@@ -111,7 +111,7 @@ else
- # deleting the $(srcdir)/cp/cfns.h file.
- $(srcdir)/cp/cfns.h:
- endif
-- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
-+ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
- $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
-
- #
-diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
-index 68acd3d..214ecf6 100644
---- a/gcc/cp/cfns.gperf
-+++ b/gcc/cp/cfns.gperf
-@@ -1,3 +1,5 @@
-+%language=C++
-+%define class-name libc_name
- %{
- /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
-
-@@ -16,14 +18,6 @@ for more details.
- You should have received a copy of the GNU General Public License
- along with GCC; see the file COPYING3. If not see
- <http://www.gnu.org/licenses/>. */
--#ifdef __GNUC__
--__inline
--#endif
--static unsigned int hash (const char *, unsigned int);
--#ifdef __GNUC__
--__inline
--#endif
--const char * libc_name_p (const char *, unsigned int);
- %}
- %%
- # The standard C library functions, for feeding to gperf; the result is used
-diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
-index 1c6665d..596f413 100644
---- a/gcc/cp/cfns.h
-+++ b/gcc/cp/cfns.h
-@@ -1,5 +1,5 @@
--/* ANSI-C code produced by gperf version 3.0.3 */
--/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */
-+/* C++ code produced by gperf version 3.0.4 */
-+/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */
-
- #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
- && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
-@@ -28,7 +28,7 @@
- #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
- #endif
-
--#line 1 "cfns.gperf"
-+#line 3 "cfns.gperf"
-
- /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
-
-@@ -47,25 +47,18 @@ for more details.
- You should have received a copy of the GNU General Public License
- along with GCC; see the file COPYING3. If not see
- <http://www.gnu.org/licenses/>. */
--#ifdef __GNUC__
--__inline
--#endif
--static unsigned int hash (const char *, unsigned int);
--#ifdef __GNUC__
--__inline
--#endif
--const char * libc_name_p (const char *, unsigned int);
- /* maximum key range = 391, duplicates = 0 */
-
--#ifdef __GNUC__
--__inline
--#else
--#ifdef __cplusplus
--inline
--#endif
--#endif
--static unsigned int
--hash (register const char *str, register unsigned int len)
-+class libc_name
-+{
-+private:
-+ static inline unsigned int hash (const char *str, unsigned int len);
-+public:
-+ static const char *libc_name_p (const char *str, unsigned int len);
-+};
-+
-+inline unsigned int
-+libc_name::hash (register const char *str, register unsigned int len)
- {
- static const unsigned short asso_values[] =
- {
-@@ -122,14 +115,8 @@ hash (register const char *str, register unsigned int len)
- return hval + asso_values[(unsigned char)str[len - 1]];
- }
-
--#ifdef __GNUC__
--__inline
--#ifdef __GNUC_STDC_INLINE__
--__attribute__ ((__gnu_inline__))
--#endif
--#endif
- const char *
--libc_name_p (register const char *str, register unsigned int len)
-+libc_name::libc_name_p (register const char *str, register unsigned int len)
- {
- enum
- {
-diff --git a/gcc/cp/except.c b/gcc/cp/except.c
-index 3ff1ce6..2f2e396 100644
---- a/gcc/cp/except.c
-+++ b/gcc/cp/except.c
-@@ -1040,7 +1040,8 @@ nothrow_libfn_p (const_tree fn)
- unless the system headers are playing rename tricks, and if
- they are, we don't want to be confused by them. */
- id = DECL_NAME (fn);
-- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
-+ return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
-+ IDENTIFIER_LENGTH (id));
- }
-
- /* Returns nonzero if an exception of type FROM will be caught by a
---
-1.7.1
diff --git a/patches/gcc/5.3.0/100-uclibc-conf.patch b/patches/gcc/5.4.0/100-uclibc-conf.patch
index 73d1f0d..73d1f0d 100644
--- a/patches/gcc/5.3.0/100-uclibc-conf.patch
+++ b/patches/gcc/5.4.0/100-uclibc-conf.patch
diff --git a/patches/gcc/5.3.0/110-xtensa-implement-trap-pattern.patch b/patches/gcc/5.4.0/110-xtensa-implement-trap-pattern.patch
index 3304532..3304532 100644
--- a/patches/gcc/5.3.0/110-xtensa-implement-trap-pattern.patch
+++ b/patches/gcc/5.4.0/110-xtensa-implement-trap-pattern.patch
diff --git a/patches/gcc/5.3.0/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch b/patches/gcc/5.4.0/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch
index c11ad35..c11ad35 100644
--- a/patches/gcc/5.3.0/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch
+++ b/patches/gcc/5.4.0/120-gcc-config.gcc-fix-typo-for-powerpc-e6500-cpu_is_64b.patch
diff --git a/patches/gcc/5.3.0/301-missing-execinfo_h.patch b/patches/gcc/5.4.0/301-missing-execinfo_h.patch
index 2d0e7ba..2d0e7ba 100644
--- a/patches/gcc/5.3.0/301-missing-execinfo_h.patch
+++ b/patches/gcc/5.4.0/301-missing-execinfo_h.patch
diff --git a/patches/gcc/5.3.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch b/patches/gcc/5.4.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch
index d8986d5..d8986d5 100644
--- a/patches/gcc/5.3.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch
+++ b/patches/gcc/5.4.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch
diff --git a/patches/gcc/5.3.0/380-gcc-plugin-POSIX-include-sys-select-h.patch b/patches/gcc/5.4.0/380-gcc-plugin-POSIX-include-sys-select-h.patch
index 12ef48e..12ef48e 100644
--- a/patches/gcc/5.3.0/380-gcc-plugin-POSIX-include-sys-select-h.patch
+++ b/patches/gcc/5.4.0/380-gcc-plugin-POSIX-include-sys-select-h.patch
diff --git a/patches/gcc/5.3.0/810-arm-softfloat-libgcc.patch b/patches/gcc/5.4.0/810-arm-softfloat-libgcc.patch
index 5efa7fd..5efa7fd 100644
--- a/patches/gcc/5.3.0/810-arm-softfloat-libgcc.patch
+++ b/patches/gcc/5.4.0/810-arm-softfloat-libgcc.patch
diff --git a/patches/gcc/5.3.0/830-arm_unbreak_armv4t.patch b/patches/gcc/5.4.0/830-arm_unbreak_armv4t.patch
index b730059..b730059 100644
--- a/patches/gcc/5.3.0/830-arm_unbreak_armv4t.patch
+++ b/patches/gcc/5.4.0/830-arm_unbreak_armv4t.patch
diff --git a/patches/gcc/5.3.0/840-microblaze-enable-dwarf-eh-support.patch b/patches/gcc/5.4.0/840-microblaze-enable-dwarf-eh-support.patch
index 9d29090..9d29090 100644
--- a/patches/gcc/5.3.0/840-microblaze-enable-dwarf-eh-support.patch
+++ b/patches/gcc/5.4.0/840-microblaze-enable-dwarf-eh-support.patch
diff --git a/patches/gcc/5.3.0/850-libstdcxx-uclibc-c99.patch b/patches/gcc/5.4.0/850-libstdcxx-uclibc-c99.patch
index 9e97d94..9e97d94 100644
--- a/patches/gcc/5.3.0/850-libstdcxx-uclibc-c99.patch
+++ b/patches/gcc/5.4.0/850-libstdcxx-uclibc-c99.patch
diff --git a/patches/gcc/5.3.0/860-cilk-wchar.patch b/patches/gcc/5.4.0/860-cilk-wchar.patch
index 1d9916f..1d9916f 100644
--- a/patches/gcc/5.3.0/860-cilk-wchar.patch
+++ b/patches/gcc/5.4.0/860-cilk-wchar.patch
diff --git a/patches/gcc/5.3.0/870-xtensa-add-mauto-litpools-option.patch b/patches/gcc/5.4.0/870-xtensa-add-mauto-litpools-option.patch
index aa1376c..aa1376c 100644
--- a/patches/gcc/5.3.0/870-xtensa-add-mauto-litpools-option.patch
+++ b/patches/gcc/5.4.0/870-xtensa-add-mauto-litpools-option.patch
diff --git a/patches/gcc/5.3.0/871-xtensa-reimplement-register-spilling.patch b/patches/gcc/5.4.0/871-xtensa-reimplement-register-spilling.patch
index 4056f8b..4056f8b 100644
--- a/patches/gcc/5.3.0/871-xtensa-reimplement-register-spilling.patch
+++ b/patches/gcc/5.4.0/871-xtensa-reimplement-register-spilling.patch
diff --git a/patches/gcc/5.3.0/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch b/patches/gcc/5.4.0/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch
index 9707f68..9707f68 100644
--- a/patches/gcc/5.3.0/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch
+++ b/patches/gcc/5.4.0/872-xtensa-use-unwind-dw2-fde-dip-instead-of-unwind-dw2-.patch
diff --git a/patches/gcc/5.3.0/873-xtensa-fix-_Unwind_GetCFA.patch b/patches/gcc/5.4.0/873-xtensa-fix-_Unwind_GetCFA.patch
index 2d8eb7c..2d8eb7c 100644
--- a/patches/gcc/5.3.0/873-xtensa-fix-_Unwind_GetCFA.patch
+++ b/patches/gcc/5.4.0/873-xtensa-fix-_Unwind_GetCFA.patch
diff --git a/patches/gcc/5.4.0/874-xtensa-add-uclinux-support.patch b/patches/gcc/5.4.0/874-xtensa-add-uclinux-support.patch
new file mode 100644
index 0000000..23db3d8
--- /dev/null
+++ b/patches/gcc/5.4.0/874-xtensa-add-uclinux-support.patch
@@ -0,0 +1,174 @@
+From 70c2cb98fb129b4766b5da0f945dc41fd568c77a Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sat, 22 Aug 2015 08:44:26 +0300
+Subject: [PATCH] xtensa: add uclinux support
+
+2015-10-03 Max Filippov <jcmvbkbc@gmail.com>
+gcc/
+ * config.gcc (xtensa*-*-uclinux*): New configuration.
+ * config/xtensa/uclinux.h: New file.
+ * config/xtensa/uclinux.opt: New file.
+
+libgcc/
+ * config.host (xtensa*-*-uclinux*): New configuration.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+Backported from: r228450
+
+ gcc/config.gcc | 5 ++++
+ gcc/config/xtensa/uclinux.h | 69 +++++++++++++++++++++++++++++++++++++++++++
+ gcc/config/xtensa/uclinux.opt | 32 ++++++++++++++++++++
+ libgcc/config.host | 5 ++++
+ 4 files changed, 111 insertions(+)
+ create mode 100644 gcc/config/xtensa/uclinux.h
+ create mode 100644 gcc/config/xtensa/uclinux.opt
+
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index c52f5a8..56797bd 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -2995,6 +2995,11 @@ xtensa*-*-linux*)
+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h"
+ tmake_file="${tmake_file} xtensa/t-xtensa"
+ ;;
++xtensa*-*-uclinux*)
++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/uclinux.h"
++ tmake_file="${tmake_file} xtensa/t-xtensa"
++ extra_options="${extra_options} xtensa/uclinux.opt"
++ ;;
+ am33_2.0-*-linux*)
+ tm_file="mn10300/mn10300.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h"
+ gas=yes gnu_ld=yes
+diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h
+new file mode 100644
+index 0000000..4606020
+--- /dev/null
++++ b/gcc/config/xtensa/uclinux.h
+@@ -0,0 +1,69 @@
++/* Xtensa uClinux configuration.
++ Derived from the configuration for GCC for Intel i386 running Linux.
++ Copyright (C) 2001-2015 Free Software Foundation, Inc.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify it under
++the terms of the GNU General Public License as published by the Free
++Software Foundation; either version 3, or (at your option) any later
++version.
++
++GCC is distributed in the hope that it will be useful, but WITHOUT ANY
++WARRANTY; without even the implied warranty of MERCHANTABILITY or
++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING3. If not see
++<http://www.gnu.org/licenses/>. */
++
++#undef TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS() \
++ do \
++ { \
++ GNU_USER_TARGET_OS_CPP_BUILTINS (); \
++ builtin_define ("__uClinux__"); \
++ } \
++ while (0)
++
++#undef SUBTARGET_CPP_SPEC
++#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
++
++#undef SIZE_TYPE
++#define SIZE_TYPE "unsigned int"
++
++#undef PTRDIFF_TYPE
++#define PTRDIFF_TYPE "int"
++
++#undef WCHAR_TYPE
++#define WCHAR_TYPE "long int"
++
++#undef WCHAR_TYPE_SIZE
++#define WCHAR_TYPE_SIZE 32
++
++#undef ASM_SPEC
++#define ASM_SPEC \
++ "%{mtext-section-literals:--text-section-literals} \
++ %{mno-text-section-literals:--no-text-section-literals} \
++ %{mtarget-align:--target-align} \
++ %{mno-target-align:--no-target-align} \
++ %{mlongcalls:--longcalls} \
++ %{mno-longcalls:--no-longcalls} \
++ %{mauto-litpools:--auto-litpools} \
++ %{mno-auto-litpools:--no-auto-litpools}"
++
++#undef LINK_SPEC
++#define LINK_SPEC "%{!no-elf2flt:%{!elf2flt*:-elf2flt}}"
++
++#undef LOCAL_LABEL_PREFIX
++#define LOCAL_LABEL_PREFIX "."
++
++/* Always enable "-fpic" for Xtensa Linux. */
++#define XTENSA_ALWAYS_PIC 1
++
++#undef TARGET_LIBC_HAS_FUNCTION
++#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
++
++#undef DBX_REGISTER_NUMBER
++
+diff --git a/gcc/config/xtensa/uclinux.opt b/gcc/config/xtensa/uclinux.opt
+new file mode 100644
+index 0000000..95ef777
+--- /dev/null
++++ b/gcc/config/xtensa/uclinux.opt
+@@ -0,0 +1,32 @@
++; Xtensa uClinux options.
++
++; Copyright (C) 2015 Free Software Foundation, Inc.
++;
++; This file is part of GCC.
++;
++; GCC is free software; you can redistribute it and/or modify it under
++; the terms of the GNU General Public License as published by the Free
++; Software Foundation; either version 3, or (at your option) any later
++; version.
++;
++; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
++; WARRANTY; without even the implied warranty of MERCHANTABILITY or
++; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++; for more details.
++;
++; You should have received a copy of the GNU General Public License
++; along with GCC; see the file COPYING3. If not see
++; <http://www.gnu.org/licenses/>.
++
++; See the GCC internals manual (options.texi) for a description of
++; this file's format.
++
++; Please try to keep this file in ASCII collating order.
++
++elf2flt
++Driver
++
++elf2flt=
++Driver JoinedOrMissing
++
++; This comment is to ensure we retain the blank line above.
+diff --git a/libgcc/config.host b/libgcc/config.host
+index 2c64756..2ee92c1 100644
+--- a/libgcc/config.host
++++ b/libgcc/config.host
+@@ -1295,6 +1295,11 @@ xtensa*-*-linux*)
+ tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
+ md_unwind_header=xtensa/linux-unwind.h
+ ;;
++xtensa*-*-uclinux*)
++ tmake_file="$tmake_file xtensa/t-xtensa xtensa/t-linux t-slibgcc-libgcc"
++ md_unwind_header=xtensa/linux-unwind.h
++ extra_parts="$extra_parts crtbeginS.o crtbeginT.o crtendS.o"
++ ;;
+ am33_2.0-*-linux*)
+ # Don't need crtbeginT.o from *-*-linux* default.
+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
+--
+1.8.1.4
+
diff --git a/patches/gcc/5.4.0/890-fix-m68k-compile.patch b/patches/gcc/5.4.0/890-fix-m68k-compile.patch
new file mode 100644
index 0000000..6e63de0
--- /dev/null
+++ b/patches/gcc/5.4.0/890-fix-m68k-compile.patch
@@ -0,0 +1,15 @@
+remove unused header, which breaks the toolchain building
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c gcc-5.3.0/libgcc/config/m68k/linux-atomic.c
+--- gcc-5.3.0.orig/libgcc/config/m68k/linux-atomic.c 2015-01-05 13:33:28.000000000 +0100
++++ gcc-5.3.0/libgcc/config/m68k/linux-atomic.c 2016-03-19 09:25:07.000000000 +0100
+@@ -33,7 +33,6 @@
+ using the kernel helper defined below. There is no support for
+ 64-bit operations yet. */
+
+-#include <asm/unistd.h>
+ #include <stdbool.h>
+
+ #ifndef __NR_atomic_cmpxchg_32
diff --git a/patches/gcc/5.4.0/891-fix-m68k-uclinux.patch b/patches/gcc/5.4.0/891-fix-m68k-uclinux.patch
new file mode 100644
index 0000000..4e186bd
--- /dev/null
+++ b/patches/gcc/5.4.0/891-fix-m68k-uclinux.patch
@@ -0,0 +1,18 @@
+avoids internal compiler error while compiling linux-atomic.c
+See here:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53833
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-5.3.0.orig/libgcc/config.host gcc-5.3.0/libgcc/config.host
+--- gcc-5.3.0.orig/libgcc/config.host 2015-10-01 14:01:18.000000000 +0200
++++ gcc-5.3.0/libgcc/config.host 2016-04-26 21:30:25.353691745 +0200
+@@ -794,7 +794,7 @@
+ m68k*-*-openbsd*)
+ ;;
+ m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux with uClibc
+- tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux"
++ tmake_file="$tmake_file m68k/t-floatlib"
+ md_unwind_header=m68k/linux-unwind.h
+ ;;
+ m68k-*-linux*) # Motorola m68k's running GNU/Linux
diff --git a/patches/gcc/5.4.0/892-microblaze-uclibc.patch b/patches/gcc/5.4.0/892-microblaze-uclibc.patch
new file mode 100644
index 0000000..a8eb5a6
--- /dev/null
+++ b/patches/gcc/5.4.0/892-microblaze-uclibc.patch
@@ -0,0 +1,24 @@
+Add dynamic linker support for uClibc
+
+Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
+
+diff -Nur gcc-5.3.0.orig/gcc/config/microblaze/linux.h gcc-5.3.0/gcc/config/microblaze/linux.h
+--- gcc-5.3.0.orig/gcc/config/microblaze/linux.h 2015-05-28 16:08:19.000000000 +0200
++++ gcc-5.3.0/gcc/config/microblaze/linux.h 2016-05-13 09:21:01.579262885 +0200
+@@ -28,7 +28,15 @@
+ #undef TLS_NEEDS_GOT
+ #define TLS_NEEDS_GOT 1
+
+-#define DYNAMIC_LINKER "/lib/ld.so.1"
++#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++
++#if DEFAULT_LIBC == LIBC_UCLIBC
++#define DYNAMIC_LINKER UCLIBC_DYNAMIC_LINKER
++#else
++#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
++#endif
++
+ #undef SUBTARGET_EXTRA_SPECS
+ #define SUBTARGET_EXTRA_SPECS \
+ { "dynamic_linker", DYNAMIC_LINKER }
diff --git a/patches/gcc/5.3.0/900-libitm-fixes-for-musl-support.patch b/patches/gcc/5.4.0/900-libitm-fixes-for-musl-support.patch
index fdf4ee7..fdf4ee7 100644
--- a/patches/gcc/5.3.0/900-libitm-fixes-for-musl-support.patch
+++ b/patches/gcc/5.4.0/900-libitm-fixes-for-musl-support.patch
diff --git a/patches/gcc/5.3.0/901-fixincludes-update-for-musl-support.patch b/patches/gcc/5.4.0/901-fixincludes-update-for-musl-support.patch
index 13c08d6..13c08d6 100644
--- a/patches/gcc/5.3.0/901-fixincludes-update-for-musl-support.patch
+++ b/patches/gcc/5.4.0/901-fixincludes-update-for-musl-support.patch
diff --git a/patches/gcc/5.3.0/902-unwind-fix-for-musl.patch b/patches/gcc/5.4.0/902-unwind-fix-for-musl.patch
index ef47054..ef47054 100644
--- a/patches/gcc/5.3.0/902-unwind-fix-for-musl.patch
+++ b/patches/gcc/5.4.0/902-unwind-fix-for-musl.patch
diff --git a/patches/gcc/5.3.0/903-libstdc++-libgfortran-gthr-workaround-for-musl.patch b/patches/gcc/5.4.0/903-libstdc++-libgfortran-gthr-workaround-for-musl.patch
index c852131..c852131 100644
--- a/patches/gcc/5.3.0/903-libstdc++-libgfortran-gthr-workaround-for-musl.patch
+++ b/patches/gcc/5.4.0/903-libstdc++-libgfortran-gthr-workaround-for-musl.patch
diff --git a/patches/gcc/5.3.0/904-musl-libc-config.patch b/patches/gcc/5.4.0/904-musl-libc-config.patch
index 8549140..8549140 100644
--- a/patches/gcc/5.3.0/904-musl-libc-config.patch
+++ b/patches/gcc/5.4.0/904-musl-libc-config.patch
diff --git a/patches/gcc/5.3.0/905-add-musl-support-to-gcc.patch b/patches/gcc/5.4.0/905-add-musl-support-to-gcc.patch
index 92e7436..92e7436 100644
--- a/patches/gcc/5.3.0/905-add-musl-support-to-gcc.patch
+++ b/patches/gcc/5.4.0/905-add-musl-support-to-gcc.patch
diff --git a/patches/gcc/5.3.0/906-mips-musl-support.patch b/patches/gcc/5.4.0/906-mips-musl-support.patch
index 6b473f9..6b473f9 100644
--- a/patches/gcc/5.3.0/906-mips-musl-support.patch
+++ b/patches/gcc/5.4.0/906-mips-musl-support.patch
diff --git a/patches/gcc/5.3.0/907-x86-musl-support.patch b/patches/gcc/5.4.0/907-x86-musl-support.patch
index 3f2fe5d..3f2fe5d 100644
--- a/patches/gcc/5.3.0/907-x86-musl-support.patch
+++ b/patches/gcc/5.4.0/907-x86-musl-support.patch
diff --git a/patches/gcc/5.3.0/908-arm-musl-support.patch b/patches/gcc/5.4.0/908-arm-musl-support.patch
index 906355a..906355a 100644
--- a/patches/gcc/5.3.0/908-arm-musl-support.patch
+++ b/patches/gcc/5.4.0/908-arm-musl-support.patch
diff --git a/patches/gcc/5.3.0/909-aarch64-musl-support.patch b/patches/gcc/5.4.0/909-aarch64-musl-support.patch
index 3d032f5..3d032f5 100644
--- a/patches/gcc/5.3.0/909-aarch64-musl-support.patch
+++ b/patches/gcc/5.4.0/909-aarch64-musl-support.patch
diff --git a/patches/gcc/5.4.0/910-nios2-bad-multilib-default.patch b/patches/gcc/5.4.0/910-nios2-bad-multilib-default.patch
new file mode 100644
index 0000000..d94697f
--- /dev/null
+++ b/patches/gcc/5.4.0/910-nios2-bad-multilib-default.patch
@@ -0,0 +1,28 @@
+diff -urpN gcc-5.3.0.orig/gcc/config/nios2/nios2.h gcc-5.3.0/gcc/config/nios2/nios2.h
+--- gcc-5.3.0.orig/gcc/config/nios2/nios2.h 2016-04-18 10:32:41.046254061 -0700
++++ gcc-5.3.0/gcc/config/nios2/nios2.h 2016-04-18 10:37:25.998841674 -0700
+@@ -55,11 +55,11 @@
+ #if TARGET_ENDIAN_DEFAULT == 0
+ # define ASM_SPEC "%{!meb:-EL} %{meb:-EB}"
+ # define LINK_SPEC_ENDIAN "%{!meb:-EL} %{meb:-EB}"
+-# define MULTILIB_DEFAULTS { "EL" }
++# define MULTILIB_DEFAULTS { "mel" }
+ #else
+ # define ASM_SPEC "%{!mel:-EB} %{mel:-EL}"
+ # define LINK_SPEC_ENDIAN "%{!mel:-EB} %{mel:-EL}"
+-# define MULTILIB_DEFAULTS { "EB" }
++# define MULTILIB_DEFAULTS { "meb" }
+ #endif
+
+ #define LINK_SPEC LINK_SPEC_ENDIAN \
+diff -urpN gcc-5.3.0.orig/gcc/config/nios2/t-nios2 gcc-5.3.0/gcc/config/nios2/t-nios2
+--- gcc-5.3.0.orig/gcc/config/nios2/t-nios2 2016-04-18 10:32:41.046254061 -0700
++++ gcc-5.3.0/gcc/config/nios2/t-nios2 2016-04-18 10:36:41.091312157 -0700
+@@ -22,6 +22,5 @@
+ # MULTILIB_DIRNAMES = nomul mulx fpu-60-1 fpu-60-2
+ # MULTILIB_EXCEPTIONS =
+
+-# MULTILIB_OPTIONS += EL/EB
++# MULTILIB_OPTIONS += mel/meb
+ # MULTILIB_DIRNAMES += le be
+-# MULTILIB_MATCHES += EL=mel EB=meb
diff --git a/patches/gcc/5.4.0/930-libgcc-disable-split-stack-nothreads.patch b/patches/gcc/5.4.0/930-libgcc-disable-split-stack-nothreads.patch
new file mode 100644
index 0000000..07f9a73
--- /dev/null
+++ b/patches/gcc/5.4.0/930-libgcc-disable-split-stack-nothreads.patch
@@ -0,0 +1,14 @@
+disable split-stack for non-thread builds
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-5.3.0.orig/libgcc/config/t-stack gcc-5.3.0/libgcc/config/t-stack
+--- gcc-5.3.0.orig/libgcc/config/t-stack 2010-10-01 21:31:49.000000000 +0200
++++ gcc-5.3.0/libgcc/config/t-stack 2016-03-07 03:25:32.000000000 +0100
+@@ -1,4 +1,6 @@
+ # Makefile fragment to provide generic support for -fsplit-stack.
+ # This should be used in config.host for any host which supports
+ # -fsplit-stack.
++ifeq ($(enable_threads),yes)
+ LIB2ADD_ST += $(srcdir)/generic-morestack.c $(srcdir)/generic-morestack-thread.c
++endif
diff --git a/patches/gcc/5.4.0/940-uclinux-enable-threads.patch b/patches/gcc/5.4.0/940-uclinux-enable-threads.patch
new file mode 100644
index 0000000..490a55b
--- /dev/null
+++ b/patches/gcc/5.4.0/940-uclinux-enable-threads.patch
@@ -0,0 +1,19 @@
+Enable POSIX threads for uClinux targets
+Reported upstream:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71721
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+
+diff -Nur gcc-5.4.0.orig/gcc/config.gcc gcc-5.4.0/gcc/config.gcc
+--- gcc-5.4.0.orig/gcc/config.gcc 2015-09-10 16:17:53.000000000 +0200
++++ gcc-5.4.0/gcc/config.gcc 2016-07-01 21:26:02.772958441 +0200
+@@ -808,6 +808,9 @@
+ *-*-uclinux*)
+ extra_options="$extra_options gnu-user.opt"
+ use_gcc_stdint=wrap
++ case ${enable_threads} in
++ "" | yes | posix) thread_file='posix' ;;
++ esac
+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
+ ;;
+ *-*-rdos*)
diff --git a/samples/arm-cortex_a15-linux-gnueabi/crosstool.config b/samples/arm-cortex_a15-linux-gnueabihf/crosstool.config
index b625116..b625116 100644
--- a/samples/arm-cortex_a15-linux-gnueabi/crosstool.config
+++ b/samples/arm-cortex_a15-linux-gnueabihf/crosstool.config
diff --git a/samples/arm-cortex_a15-linux-gnueabi/reported.by b/samples/arm-cortex_a15-linux-gnueabihf/reported.by
index 3e05b5a..3e05b5a 100644
--- a/samples/arm-cortex_a15-linux-gnueabi/reported.by
+++ b/samples/arm-cortex_a15-linux-gnueabihf/reported.by
diff --git a/samples/arm-multilib-linux-uclibcgnueabi/crosstool.config b/samples/arm-multilib-linux-uclibcgnueabi/crosstool.config
new file mode 100644
index 0000000..b9fcb42
--- /dev/null
+++ b/samples/arm-multilib-linux-uclibcgnueabi/crosstool.config
@@ -0,0 +1,18 @@
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_FLOAT_SW=y
+CT_ARCH_arm=y
+CT_MULTILIB=y
+CT_TARGET_VENDOR="multilib"
+CT_KERNEL_linux=y
+CT_BINUTILS_LINKER_LD_GOLD=y
+CT_BINUTILS_GOLD_THREADS=y
+CT_BINUTILS_LD_WRAPPER=y
+CT_BINUTILS_PLUGINS=y
+CT_LIBC_uClibc=y
+CT_THREADS_NONE=y
+CT_CC_GCC_MULTILIB_LIST="aprofile"
+CT_DEBUG_dmalloc=y
+CT_DEBUG_ltrace=y
+CT_DEBUG_strace=y
diff --git a/samples/arm-multilib-linux-uclibcgnueabi/reported.by b/samples/arm-multilib-linux-uclibcgnueabi/reported.by
new file mode 100644
index 0000000..b876cab
--- /dev/null
+++ b/samples/arm-multilib-linux-uclibcgnueabi/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for ARM/uClibc-ng."
diff --git a/samples/mips64el-n32-linux-uclibc/crosstool.config b/samples/mips64el-multilib-linux-uclibc/crosstool.config
index 0f61616..bced5d1 100644
--- a/samples/mips64el-n32-linux-uclibc/crosstool.config
+++ b/samples/mips64el-multilib-linux-uclibc/crosstool.config
@@ -5,7 +5,8 @@ CT_ARCH_LE=y
CT_ARCH_64=y
CT_ARCH_FLOAT_SW=y
CT_ARCH_mips=y
-CT_TARGET_VENDOR="n32"
+CT_MULTILIB=y
+CT_TARGET_VENDOR="multilib"
CT_KERNEL_linux=y
CT_BINUTILS_PLUGINS=y
CT_LIBC_uClibc=y
diff --git a/samples/mips64el-multilib-linux-uclibc/reported.by b/samples/mips64el-multilib-linux-uclibc/reported.by
new file mode 100644
index 0000000..023996f
--- /dev/null
+++ b/samples/mips64el-multilib-linux-uclibc/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for MIPS/uClibc-ng."
diff --git a/samples/mips64el-n32-linux-uclibc/reported.by b/samples/mips64el-n32-linux-uclibc/reported.by
deleted file mode 100644
index bdc66ad..0000000
--- a/samples/mips64el-n32-linux-uclibc/reported.by
+++ /dev/null
@@ -1,3 +0,0 @@
-reporter_name="Yann E. MORIN"
-reporter_url="http://ymorin.is-a-geek.org/projects/crosstool"
-reporter_comment="EXPERIMENTAL MIPS-64 n32 toolchain."
diff --git a/samples/mips64el-n64-linux-uclibc/crosstool.config b/samples/mips64el-n64-linux-uclibc/crosstool.config
deleted file mode 100644
index 2853ccb..0000000
--- a/samples/mips64el-n64-linux-uclibc/crosstool.config
+++ /dev/null
@@ -1,15 +0,0 @@
-CT_LOCAL_TARBALLS_DIR="${HOME}/src"
-CT_SAVE_TARBALLS=y
-CT_LOG_EXTRA=y
-CT_ARCH_LE=y
-CT_ARCH_64=y
-CT_ARCH_FLOAT_SW=y
-CT_ARCH_mips=y
-CT_ARCH_mips_n64=y
-CT_TARGET_VENDOR="n64"
-CT_KERNEL_linux=y
-CT_BINUTILS_PLUGINS=y
-CT_LIBC_uClibc=y
-CT_LIBC_UCLIBC_WCHAR=y
-CT_CC_GCC_mips_plt=y
-CT_CC_LANG_CXX=y
diff --git a/samples/mips64el-n64-linux-uclibc/reported.by b/samples/mips64el-n64-linux-uclibc/reported.by
deleted file mode 100644
index b8e8268..0000000
--- a/samples/mips64el-n64-linux-uclibc/reported.by
+++ /dev/null
@@ -1,3 +0,0 @@
-reporter_name="Yann E. MORIN"
-reporter_url="http://ymorin.is-a-geek.org/projects/crosstool"
-reporter_comment="EXPERIMENTAL MIPS-64 n64 toolchain."
diff --git a/samples/mipsel-multilib-linux-gnu/crosstool.config b/samples/mipsel-multilib-linux-gnu/crosstool.config
new file mode 100644
index 0000000..fa54b08
--- /dev/null
+++ b/samples/mipsel-multilib-linux-gnu/crosstool.config
@@ -0,0 +1,20 @@
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_LE=y
+CT_ARCH_FLOAT_SW=y
+CT_ARCH_mips=y
+CT_MULTILIB=y
+CT_TARGET_VENDOR="multilib"
+CT_KERNEL_linux=y
+CT_BINUTILS_PLUGINS=y
+CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="--enable-targets=all"
+CT_CC_GCC_EXTRA_CONFIG_ARRAY="--enable-targets=all"
+CT_CC_GCC_mips_plt=y
+CT_CC_LANG_CXX=y
+CT_DEBUG_dmalloc=y
+CT_DEBUG_duma=y
+CT_DEBUG_gdb=y
+# CT_GDB_CROSS_PYTHON is not set
+CT_GDB_NATIVE=y
+CT_DEBUG_strace=y
diff --git a/samples/mipsel-multilib-linux-gnu/reported.by b/samples/mipsel-multilib-linux-gnu/reported.by
new file mode 100644
index 0000000..a0eb574
--- /dev/null
+++ b/samples/mipsel-multilib-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for MIPS/glibc."
diff --git a/samples/powerpc64-multilib-linux-gnu/crosstool.config b/samples/powerpc64-multilib-linux-gnu/crosstool.config
new file mode 100644
index 0000000..71d2f78
--- /dev/null
+++ b/samples/powerpc64-multilib-linux-gnu/crosstool.config
@@ -0,0 +1,13 @@
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_64=y
+CT_ARCH_powerpc=y
+CT_MULTILIB=y
+CT_TARGET_VENDOR="multilib"
+CT_KERNEL_linux=y
+CT_BINUTILS_PLUGINS=y
+CT_CC_LANG_CXX=y
+CT_DEBUG_gdb=y
+# CT_GDB_CROSS_PYTHON is not set
+CT_GDB_NATIVE=y
diff --git a/samples/powerpc64-multilib-linux-gnu/reported.by b/samples/powerpc64-multilib-linux-gnu/reported.by
new file mode 100644
index 0000000..b5909d6
--- /dev/null
+++ b/samples/powerpc64-multilib-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for PowerPC/glibc."
diff --git a/samples/samples.mk b/samples/samples.mk
index 643e595..bf51135 100644
--- a/samples/samples.mk
+++ b/samples/samples.mk
@@ -186,6 +186,7 @@ $(CT_SAMPLES): config_files
__comma = ,
prefix_dir = $(CT_PREFIX)/$(subst $(__comma),=,$(1))
host_triplet = $(if $(findstring $(__comma),$(1)),$(firstword $(subst $(__comma), ,$(1))))
+target_triplet = $(if $(findstring $(__comma),$(1)),$(word 2,$(subst $(__comma), ,$(1))),$(1))
# Create the rule to build a sample
# $1: sample name (target tuple, or host/target tuples separated by a comma)
@@ -212,7 +213,8 @@ define build_sample
fi; \
printf '\r %-5s %s\n' $$status '$(1)'; \
mkdir -p .build-all/$$status/$(1); \
- bzip2 < build.log > .build-all/$$status/$(1)/build.log.bz2
+ bzip2 < build.log > .build-all/$$status/$(1)/build.log.bz2; \
+ [ "$$status" = PASS -a -z "$(CT_PRESERVE_PASSED_BUILDS)" ] && rm -rf .build/$(call target_triplet,$(1)) || :
endef
# ----------------------------------------------------------
diff --git a/samples/sh4-multilib-linux-gnu/crosstool.config b/samples/sh4-multilib-linux-gnu/crosstool.config
new file mode 100644
index 0000000..cb2d3b7
--- /dev/null
+++ b/samples/sh4-multilib-linux-gnu/crosstool.config
@@ -0,0 +1,13 @@
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_sh=y
+CT_ARCH_SH_SH4=y
+CT_TARGET_VENDOR="multilib"
+CT_KERNEL_linux=y
+CT_BINUTILS_PLUGINS=y
+CT_CC_GCC_V_4_9_3=y
+CT_CC_GCC_MULTILIB_LIST="m4,m4a"
+CT_CC_LANG_CXX=y
+CT_DEBUG_gdb=y
+# CT_GDB_CROSS_PYTHON is not set
diff --git a/samples/sh4-multilib-linux-gnu/reported.by b/samples/sh4-multilib-linux-gnu/reported.by
new file mode 100644
index 0000000..f03f2c5
--- /dev/null
+++ b/samples/sh4-multilib-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for SuperH/glibc."
diff --git a/samples/sh4-multilib-linux-uclibc/crosstool.config b/samples/sh4-multilib-linux-uclibc/crosstool.config
new file mode 100644
index 0000000..e634521
--- /dev/null
+++ b/samples/sh4-multilib-linux-uclibc/crosstool.config
@@ -0,0 +1,14 @@
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_sh=y
+CT_ARCH_SH_SH4=y
+CT_TARGET_VENDOR="multilib"
+CT_KERNEL_linux=y
+CT_BINUTILS_PLUGINS=y
+CT_LIBC_uClibc=y
+CT_CC_GCC_V_4_9_3=y
+CT_CC_GCC_MULTILIB_LIST="m4,m4a,m3"
+CT_CC_LANG_CXX=y
+CT_DEBUG_gdb=y
+# CT_GDB_CROSS_PYTHON is not set
diff --git a/samples/sh4-multilib-linux-uclibc/reported.by b/samples/sh4-multilib-linux-uclibc/reported.by
new file mode 100644
index 0000000..2d3a629
--- /dev/null
+++ b/samples/sh4-multilib-linux-uclibc/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for SuperH/uClibc."
diff --git a/samples/sparc64-multilib-linux-gnu/crosstool.config b/samples/sparc64-multilib-linux-gnu/crosstool.config
new file mode 100644
index 0000000..c9b89cf
--- /dev/null
+++ b/samples/sparc64-multilib-linux-gnu/crosstool.config
@@ -0,0 +1,8 @@
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_64=y
+CT_ARCH_sparc=y
+CT_MULTILIB=y
+CT_TARGET_VENDOR="multilib"
+CT_KERNEL_linux=y
diff --git a/samples/sparc64-multilib-linux-gnu/reported.by b/samples/sparc64-multilib-linux-gnu/reported.by
new file mode 100644
index 0000000..8ef2217
--- /dev/null
+++ b/samples/sparc64-multilib-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for SPARC/glibc."
diff --git a/samples/x86_64-multilib-linux-gnu/crosstool.config b/samples/x86_64-multilib-linux-gnu/crosstool.config
new file mode 100644
index 0000000..b6663e8
--- /dev/null
+++ b/samples/x86_64-multilib-linux-gnu/crosstool.config
@@ -0,0 +1,17 @@
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_64=y
+CT_ARCH_x86=y
+CT_MULTILIB=y
+CT_TARGET_VENDOR="multilib"
+CT_KERNEL_linux=y
+CT_BINUTILS_LINKER_LD_GOLD=y
+CT_BINUTILS_GOLD_THREADS=y
+CT_BINUTILS_LD_WRAPPER=y
+CT_BINUTILS_PLUGINS=y
+CT_LIBC_GLIBC_KERNEL_VERSION_NONE=y
+CT_CC_GCC_MULTILIB_LIST="m64,m32,mx32"
+CT_CC_GCC_LNK_HASH_STYLE_BOTH=y
+CT_CC_LANG_CXX=y
+CT_DEBUG_gdb=y
diff --git a/samples/x86_64-multilib-linux-gnu/reported.by b/samples/x86_64-multilib-linux-gnu/reported.by
new file mode 100644
index 0000000..f7441e0
--- /dev/null
+++ b/samples/x86_64-multilib-linux-gnu/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for x86/glibc."
diff --git a/samples/x86_64-multilib-linux-musl/crosstool.config b/samples/x86_64-multilib-linux-musl/crosstool.config
new file mode 100644
index 0000000..c16bd4a
--- /dev/null
+++ b/samples/x86_64-multilib-linux-musl/crosstool.config
@@ -0,0 +1,19 @@
+CT_EXPERIMENTAL=y
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_64=y
+CT_ARCH_x86=y
+CT_MULTILIB=y
+CT_TARGET_VENDOR="multilib"
+CT_KERNEL_linux=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_BINUTILS_LINKER_LD_GOLD=y
+CT_BINUTILS_GOLD_THREADS=y
+CT_BINUTILS_LD_WRAPPER=y
+CT_BINUTILS_PLUGINS=y
+CT_LIBC_musl=y
+CT_CC_LANG_CXX=y
+CT_DEBUG_dmalloc=y
+CT_DEBUG_duma=y
+CT_DEBUG_gdb=y
diff --git a/samples/x86_64-multilib-linux-musl/reported.by b/samples/x86_64-multilib-linux-musl/reported.by
new file mode 100644
index 0000000..0773337
--- /dev/null
+++ b/samples/x86_64-multilib-linux-musl/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for x86/musl."
diff --git a/samples/x86_64-multilib-linux-uclibc/crosstool.config b/samples/x86_64-multilib-linux-uclibc/crosstool.config
new file mode 100644
index 0000000..f28915a
--- /dev/null
+++ b/samples/x86_64-multilib-linux-uclibc/crosstool.config
@@ -0,0 +1,20 @@
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_64=y
+CT_ARCH_x86=y
+CT_MULTILIB=y
+CT_TARGET_VENDOR="multilib"
+CT_KERNEL_linux=y
+# CT_KERNEL_LINUX_INSTALL_CHECK is not set
+CT_BINUTILS_LINKER_LD_GOLD=y
+CT_BINUTILS_GOLD_THREADS=y
+CT_BINUTILS_LD_WRAPPER=y
+CT_BINUTILS_PLUGINS=y
+CT_LIBC_uClibc=y
+CT_LIBC_UCLIBC_WCHAR=y
+CT_CC_LANG_CXX=y
+CT_DEBUG_dmalloc=y
+CT_DEBUG_duma=y
+CT_DEBUG_gdb=y
+CT_GDB_NATIVE=y
diff --git a/samples/x86_64-multilib-linux-uclibc/reported.by b/samples/x86_64-multilib-linux-uclibc/reported.by
new file mode 100644
index 0000000..8c22764
--- /dev/null
+++ b/samples/x86_64-multilib-linux-uclibc/reported.by
@@ -0,0 +1,3 @@
+reporter_name="Alexey Neyman"
+reporter_url=""
+reporter_comment="Multilib configuration for x86/uClibc-ng."
diff --git a/scripts/build/arch.sh b/scripts/build/arch.sh
new file mode 100644
index 0000000..5c5edc9
--- /dev/null
+++ b/scripts/build/arch.sh
@@ -0,0 +1,68 @@
+# This file provides the default implementations of arch-specific functions.
+
+# Set up the target tuple
+CT_DoArchTupleValues() {
+ :;
+}
+
+# Multilib: change the target triplet according to CFLAGS
+# Usage: CT_DoArchGlibcAdjustTuple <variable-name> <CFLAGS>
+CT_DoArchMultilibTarget() {
+ :;
+}
+
+# Multilib: Adjust target tuple for GLIBC
+# Usage: CT_DoArchGlibcAdjustTuple <variable-name>
+CT_DoArchGlibcAdjustTuple() {
+ :;
+}
+
+# Helper for uClibc configurators: select the architecture
+# Usage: CT_DoArchUClibcSelectArch <config-file> <architecture>
+CT_DoArchUClibcSelectArch() {
+ local cfg="${1}"
+ local arch="${2}"
+
+ ${sed} -i -r -e '/^TARGET_.*/d' "${cfg}"
+ CT_KconfigEnableOption "TARGET_${arch}" "${cfg}"
+ CT_KconfigSetOption "TARGET_ARCH" "${arch}" "${cfg}"
+}
+
+# uClibc: Adjust configuration file according to the CT-NG configuration
+# Usage: CT_DoArchUClibcConfig <config-file>
+CT_DoArchUClibcConfig() {
+ CT_DoLog WARN "Support for '${CT_ARCH}' is not implemented in uClibc config tweaker."
+ CT_DoLog WARN "Exact configuration file must be provided."
+}
+
+# Multilib/uClibc: Adjust configuration file for given CFLAGS
+# Usage: CT_DoArchUClibcCflags <config-file> <cflags>
+CT_DoArchUClibcCflags() {
+ local cfg="${1}"
+ local cflags="${2}"
+
+ # Likely, any non-default cflags need to be reflected into the config.
+ # It may work if we just pass them into EXTRA_CFLAGS, but we have no
+ # idea as they might interact with the CFLAGS inferred by uClibc from
+ # the configuration file.
+ if [ "${cflags}" != "" ]; then
+ CT_DoLog WARN "Multilib configuration not supported for uClibc/${CT_ARCH}"
+ fi
+}
+
+# Multilib/uClibc: Adjust header installation path for given CFLAGS
+# Usage: CT_DoArchUClibcHeaderDir <path-variable> <cflags>
+CT_DoArchUClibcHeaderDir() {
+ # Only needed if a given architecture may select different uClibc architectures.
+ :;
+}
+
+# Multilib/MUSL: Adjust header installation path for given CFLAGS
+# Usage: CT_DoArchMUSLHeaderDir <path-variable> <cflags>
+CT_DoArchMUSLHeaderDir() {
+ # Only needed if a given architecture may select different MUSL architectures.
+ :;
+}
+
+# Override from the actual arch implementation as needed.
+. "${CT_LIB_DIR}/scripts/build/arch/${CT_ARCH}.sh"
diff --git a/scripts/build/arch/alpha.sh b/scripts/build/arch/alpha.sh
index ffceae3..cf6d40d 100644
--- a/scripts/build/arch/alpha.sh
+++ b/scripts/build/arch/alpha.sh
@@ -4,14 +4,3 @@ CT_DoArchTupleValues () {
# The architecture part of the tuple:
CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX:-${CT_ARCH_ALPHA_VARIANT}}"
}
-
-#------------------------------------------------------------------------------
-# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
-CT_DoArchMultilibTarget ()
-{
- local target="${1}"; shift
- local -a multi_flags=( "$@" )
-
- echo "${target}"
-}
diff --git a/scripts/build/arch/arm.sh b/scripts/build/arch/arm.sh
index 338392c..b728311 100644
--- a/scripts/build/arch/arm.sh
+++ b/scripts/build/arch/arm.sh
@@ -27,7 +27,6 @@ CT_DoArchTupleValues() {
thumb)
CT_ARCH_CC_CORE_EXTRA_CONFIG="--with-mode=thumb"
CT_ARCH_CC_EXTRA_CONFIG="--with-mode=thumb"
-# CT_ARCH_TARGET_CFLAGS="-mthumb"
;;
esac
@@ -38,15 +37,84 @@ CT_DoArchTupleValues() {
if [ "${CT_ARCH_ARM_TUPLE_USE_EABIHF}" = "y" ]; then
CT_TARGET_SYS="${CT_TARGET_SYS}hf"
fi
+
+ # If building multilib, zero out any WITH_*/*_CFLAG - GCC on ARM does not allow
+ # any of them with multilib.
+ if [ "${CT_MULTILIB}" = "y" ]; then
+ CT_ARCH_WITH_ARCH=
+ CT_ARCH_WITH_ABI=
+ CT_ARCH_WITH_CPU=
+ CT_ARCH_WITH_TUNE=
+ CT_ARCH_WITH_FPU=
+ CT_ARCH_WITH_FLOAT=
+ CT_ARCH_ARCH_CFLAG=
+ CT_ARCH_ABI_CFLAG=
+ CT_ARCH_CPU_CFLAG=
+ CT_ARCH_TUNE_CFLAG=
+ CT_ARCH_FPU_CFLAG=
+ CT_ARCH_FLOAT_CFLAG=
+ fi
+}
+
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
+
+ CT_DoArchUClibcSelectArch "${cfg}" "arm"
+
+ case "${CT_ARCH_ARM_MODE}" in
+ arm)
+ CT_KconfigDisableOption "COMPILE_IN_THUMB_MODE" "${cfg}"
+ ;;
+ thumb)
+ CT_KconfigEnableOption "COMPILE_IN_THUMB_MODE" "${cfg}"
+ ;;
+ esac
+
+ # FIXME: CONFIG_ARM_OABI does not exist in neither uClibc/uClibc-ng
+ # FIXME: CONFIG_ARM_EABI does not seem to affect anything in either of them, too
+ # (both check the compiler's built-in define, __ARM_EABI__ instead) except for
+ # a check for match between toolchain configuration and uClibc-ng in
+ # uClibc_arch_features.h
+ if [ "${CT_ARCH_ARM_EABI}" = "y" ]; then
+ CT_KconfigDisableOption "CONFIG_ARM_OABI" "${cfg}"
+ CT_KconfigEnableOption "CONFIG_ARM_EABI" "${cfg}"
+ else
+ CT_KconfigDisableOption "CONFIG_ARM_EABI" "${cfg}"
+ CT_KconfigEnableOption "CONFIG_ARM_OABI" "${cfg}"
+ fi
}
-#------------------------------------------------------------------------------
-# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
-CT_DoArchMultilibTarget ()
-{
- local target="${1}"; shift
- local -a multi_flags=( "$@" )
+CT_DoArchUClibcCflags() {
+ local cfg="${1}"
+ local cflags="${2}"
+ local f
- echo "${target}"
+ for f in ${cflags}; do
+ case "${f}" in
+ -mthumb)
+ CT_KconfigEnableOption "COMPILE_IN_THUMB_MODE" "${cfg}"
+ ;;
+ -marm)
+ CT_KconfigDisableOption "COMPILE_IN_THUMB_MODE" "${cfg}"
+ ;;
+ -mlittle-endian)
+ CT_KconfigDisableOption "ARCH_BIG_ENDIAN" "${cfg}"
+ CT_KconfigDisableOption "ARCH_WANTS_BIG_ENDIAN" "${cfg}"
+ CT_KconfigEnableOption "ARCH_LITTLE_ENDIAN" "${cfg}"
+ CT_KconfigEnableOption "ARCH_WANTS_LITTLE_ENDIAN" "${cfg}"
+ ;;
+ -mbig-endian)
+ CT_KconfigEnableOption "ARCH_BIG_ENDIAN" "${cfg}"
+ CT_KconfigEnableOption "ARCH_WANTS_BIG_ENDIAN" "${cfg}"
+ CT_KconfigDisableOption "ARCH_LITTLE_ENDIAN" "${cfg}"
+ CT_KconfigDisableOption "ARCH_WANTS_LITTLE_ENDIAN" "${cfg}"
+ ;;
+ -mhard-float|-mfloat-abi=hard|-mfloat-abi=softfp)
+ CT_KconfigEnableOption "UCLIBC_HAS_FPU" "${cfg}"
+ ;;
+ -msoft-float|-mfloat-abi=soft)
+ CT_KconfigDisableOption "UCLIBC_HAS_FPU" "${cfg}"
+ ;;
+ esac
+ done
}
diff --git a/scripts/build/arch/m68k.sh b/scripts/build/arch/m68k.sh
index a6eb010..3cba76c 100644
--- a/scripts/build/arch/m68k.sh
+++ b/scripts/build/arch/m68k.sh
@@ -1,16 +1,7 @@
# Compute M68k-specific values
-CT_DoArchTupleValues() {
- :
-}
-
-#------------------------------------------------------------------------------
-# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
-CT_DoArchMultilibTarget ()
-{
- local target="${1}"; shift
- local -a multi_flags=( "$@" )
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
- echo "${target}"
+ CT_DoArchUClibcSelectArch "${cfg}" "m68k"
}
diff --git a/scripts/build/arch/microblaze.sh b/scripts/build/arch/microblaze.sh
index 93ecc9a..e9d9811 100644
--- a/scripts/build/arch/microblaze.sh
+++ b/scripts/build/arch/microblaze.sh
@@ -20,13 +20,8 @@ CT_DoArchTupleValues () {
}
-#------------------------------------------------------------------------------
-# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
-CT_DoArchMultilibTarget ()
-{
- local target="${1}"; shift
- local -a multi_flags=( "$@" )
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
- echo "${target}"
+ CT_DoArchUClibcSelectArch "${cfg}" "microblaze"
}
diff --git a/scripts/build/arch/mips.sh b/scripts/build/arch/mips.sh
index 68ad4fa..6097c89 100644
--- a/scripts/build/arch/mips.sh
+++ b/scripts/build/arch/mips.sh
@@ -15,13 +15,57 @@ CT_DoArchTupleValues() {
CT_ARCH_WITH_ABI="--with-abi=${CT_ARCH_mips_ABI}"
}
-#------------------------------------------------------------------------------
-# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
-CT_DoArchMultilibTarget ()
-{
- local target="${1}"; shift
- local -a multi_flags=( "$@" )
-
- echo "${target}"
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
+
+ CT_DoArchUClibcSelectArch "${cfg}" "${CT_ARCH}"
+
+ CT_KconfigDisableOption "CONFIG_MIPS_O32_ABI" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_MIPS_N32_ABI" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_MIPS_N64_ABI" "${cfg}"
+ case "${CT_ARCH_mips_ABI}" in
+ 32)
+ CT_KconfigEnableOption "CONFIG_MIPS_O32_ABI" "${cfg}"
+ ;;
+ n32)
+ CT_KconfigEnableOption "CONFIG_MIPS_N32_ABI" "${cfg}"
+ ;;
+ 64)
+ CT_KconfigEnableOption "CONFIG_MIPS_N64_ABI" "${cfg}"
+ ;;
+ esac
+
+ # FIXME: uClibc (!ng) allows to select ISA in the config; should
+ # match from the selected ARCH_ARCH level... For now, delete and
+ # fall back to default.
+ CT_KconfigDeleteOption "CONFIG_MIPS_ISA_1" "${cfg}"
+ CT_KconfigDeleteOption "CONFIG_MIPS_ISA_2" "${cfg}"
+ CT_KconfigDeleteOption "CONFIG_MIPS_ISA_3" "${cfg}"
+ CT_KconfigDeleteOption "CONFIG_MIPS_ISA_4" "${cfg}"
+ CT_KconfigDeleteOption "CONFIG_MIPS_ISA_MIPS32" "${cfg}"
+ CT_KconfigDeleteOption "CONFIG_MIPS_ISA_MIPS32R2" "${cfg}"
+ CT_KconfigDeleteOption "CONFIG_MIPS_ISA_MIPS64" "${cfg}"
+ CT_KconfigDeleteOption "CONFIG_MIPS_ISA_MIPS64R2" "${cfg}"
+}
+
+CT_DoArchUClibcCflags() {
+ local cfg="${1}"
+ local cflags="${2}"
+ local f
+
+ for f in ${cflags}; do
+ case "${f}" in
+ -mabi=*)
+ CT_KconfigDisableOption "CONFIG_MIPS_O32_ABI" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_MIPS_N32_ABI" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_MIPS_N64_ABI" "${cfg}"
+ case "${f#-mabi=}" in
+ 32) CT_KconfigEnableOption "CONFIG_MIPS_O32_ABI" "${cfg}";;
+ n32) CT_KconfigEnableOption "CONFIG_MIPS_N32_ABI" "${cfg}";;
+ 64) CT_KconfigEnableOption "CONFIG_MIPS_N64_ABI" "${cfg}";;
+ *) CT_Abort "Unsupported ABI: ${f#-mabi=}";;
+ esac
+ ;;
+ esac
+ done
}
diff --git a/scripts/build/arch/nios2.sh b/scripts/build/arch/nios2.sh
index 8c7d445..24c556b 100644
--- a/scripts/build/arch/nios2.sh
+++ b/scripts/build/arch/nios2.sh
@@ -9,5 +9,4 @@ CT_DoArchTupleValues() {
CT_ARCH_WITH_FPU=
CT_ARCH_WITH_FLOAT=
CT_TARGET_SYS=elf
-
}
diff --git a/scripts/build/arch/powerpc.sh b/scripts/build/arch/powerpc.sh
index 77bbc8a..52f3f8b 100644
--- a/scripts/build/arch/powerpc.sh
+++ b/scripts/build/arch/powerpc.sh
@@ -26,13 +26,15 @@ CT_DoArchTupleValues () {
CT_ARCH_CC_EXTRA_CONFIG="--enable-e500_double"
fi
}
+
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
+# Usage: CT_DoArchMultilibTarget "target variable" "multilib flags"
CT_DoArchMultilibTarget ()
{
- local target="${1}"; shift
+ local target_var="${1}"; shift
local -a multi_flags=( "$@" )
+ local target_
local m32=false
local m64=false
@@ -48,22 +50,41 @@ CT_DoArchMultilibTarget ()
esac
done
+ eval target_=\"\${${target_var}}\"
+
# Fix up bitness
- case "${target}" in
- powerpc-*) $m64 && target=${target/#powerpc-/powerpc64-} ;;
- powerpcle-*) $m64 && target=${target/#powerpcle-/powerpc64le-} ;;
- powerpc64-*) $m32 && target=${target/#powerpc64-/powerpc-} ;;
- powerpc64le-*) $m32 && target=${target/#powerpc64le-/powerpcle-} ;;
+ case "${target_}" in
+ powerpc-*) $m64 && target_=${target_/#powerpc-/powerpc64-} ;;
+ powerpcle-*) $m64 && target_=${target_/#powerpcle-/powerpc64le-} ;;
+ powerpc64-*) $m32 && target_=${target_/#powerpc64-/powerpc-} ;;
+ powerpc64le-*) $m32 && target_=${target_/#powerpc64le-/powerpcle-} ;;
esac
# Fix up endianness
- case "${target}" in
- powerpc-*) $mlittle && target=${target/#powerpc-/powerpcle-} ;;
- powerpcle-*) $mbig && target=${target/#powerpcle-/powerpc-} ;;
- powerpc64-*) $mlittle && target=${target/#powerpc64-/powerpc64le-} ;;
- powerpc64le-*) $mbig && target=${target/#powerpc64le-/powerpc64-} ;;
+ case "${target_}" in
+ powerpc-*) $mlittle && target_=${target_/#powerpc-/powerpcle-} ;;
+ powerpcle-*) $mbig && target_=${target_/#powerpcle-/powerpc-} ;;
+ powerpc64-*) $mlittle && target_=${target_/#powerpc64-/powerpc64le-} ;;
+ powerpc64le-*) $mbig && target_=${target_/#powerpc64le-/powerpc64-} ;;
esac
- # return the target
- echo "${target}"
+ # Set the target variable
+ eval ${target_var}=\"${target_}\"
+}
+
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
+
+ CT_DoArchUClibcSelectArch "${cfg}" "powerpc"
+
+ CT_KconfigDisableOption "CONFIG_E500" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_CLASSIC" "${cfg}"
+ CT_KconfigDeleteOption "TARGET_SUBARCH" "${cfg}"
+ if [ "${CT_ARCH_powerpc_ABI}" = "spe" ]; then
+ CT_KconfigEnableOption "CONFIG_E500" "${cfg}"
+ CT_KconfigSetOption "TARGET_SUBARCH" "e500" "${cfg}"
+ else
+ CT_KconfigEnableOption "CONFIG_CLASSIC" "${cfg}"
+ CT_KconfigSetOption "TARGET_SUBARCH" "classic" "${cfg}"
+ fi
}
diff --git a/scripts/build/arch/s390.sh b/scripts/build/arch/s390.sh
index e303420..dff86a0 100644
--- a/scripts/build/arch/s390.sh
+++ b/scripts/build/arch/s390.sh
@@ -9,11 +9,12 @@ CT_DoArchTupleValues() {
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
+# Usage: CT_DoArchMultilibTarget "target variable" "multilib flags"
CT_DoArchMultilibTarget ()
{
- local target="${1}"; shift
+ local target_var="${1}"; shift
local -a multi_flags=( "$@" )
+ local target_
local m31=false
local m64=false
@@ -25,11 +26,14 @@ CT_DoArchMultilibTarget ()
esac
done
+ eval target_=\"\${${target_var}}\"
+
# Fix bitness
- case "${target}" in
- s390-*) $m64 && target=${target/#s390-/s390x-} ;;
- s390x-*) $m31 && target=${target/#s390x-/s390-} ;;
+ case "${target_}" in
+ s390-*) $m64 && target_=${target_/#s390-/s390x-} ;;
+ s390x-*) $m31 && target_=${target_/#s390x-/s390-} ;;
esac
- echo "${target}"
+ # Set the target variable
+ eval ${target_var}=\"${target_}\"
}
diff --git a/scripts/build/arch/sh.sh b/scripts/build/arch/sh.sh
index e7f4f1a..6761435 100644
--- a/scripts/build/arch/sh.sh
+++ b/scripts/build/arch/sh.sh
@@ -36,13 +36,47 @@ CT_DoArchTupleValues () {
CT_ARCH_FLOAT_CFLAG=
}
-#------------------------------------------------------------------------------
-# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
-CT_DoArchMultilibTarget ()
-{
- local target="${1}"; shift
- local -a multi_flags=( "$@" )
-
- echo "${target}"
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
+
+ # FIXME: uclibc (!ng) seems to support sh64 (sh5), too
+ CT_DoArchUClibcSelectArch "${cfg}" "sh"
+ CT_KconfigDisableOption "CONFIG_SH3" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_SH4" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_SH4A" "${cfg}"
+ case "${CT_ARCH_SH_VARIANT}" in
+ sh3) CT_KconfigEnableOption "CONFIG_SH3" "${cfg}";;
+ sh4) CT_KconfigEnableOption "CONFIG_SH4" "${cfg}";;
+ sh4a) CT_KconfigEnableOption "CONFIG_SH4A" "${cfg}";;
+ esac
+}
+
+CT_DoArchUClibcCflags() {
+ local cfg="${1}"
+ local cflags="${2}"
+ local f
+
+ for f in ${cflags}; do
+ case "${f}" in
+ -m3)
+ CT_KconfigEnableOption "CONFIG_SH3" "${cfg}"
+ ;;
+ -m4)
+ CT_KconfigEnableOption "CONFIG_SH4" "${cfg}"
+ CT_KconfigEnableOption "UCLIBC_HAS_FPU" "${cfg}"
+ ;;
+ -m4-nofpu)
+ CT_KconfigEnableOption "CONFIG_SH4" "${cfg}"
+ CT_KconfigDisableOption "UCLIBC_HAS_FPU" "${cfg}"
+ ;;
+ -m4a)
+ CT_KconfigEnableOption "CONFIG_SH4A" "${cfg}"
+ CT_KconfigEnableOption "UCLIBC_HAS_FPU" "${cfg}"
+ ;;
+ -m4a-nofpu)
+ CT_KconfigEnableOption "CONFIG_SH4A" "${cfg}"
+ CT_KconfigDisableOption "UCLIBC_HAS_FPU" "${cfg}"
+ ;;
+ esac
+ done
}
diff --git a/scripts/build/arch/sparc.sh b/scripts/build/arch/sparc.sh
index 2d3baa3..74f6f78 100644
--- a/scripts/build/arch/sparc.sh
+++ b/scripts/build/arch/sparc.sh
@@ -19,11 +19,61 @@ CT_DoArchTupleValues() {
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
+# Usage: CT_DoArchMultilibTarget "target variable" "multilib flags"
CT_DoArchMultilibTarget ()
{
- local target="${1}"; shift
+ local target_var="${1}"; shift
local -a multi_flags=( "$@" )
+ local target_
- echo "${target}"
+ local m32=false
+ local m64=false
+
+ for m in "${multi_flags[@]}"; do
+ case "$m" in
+ -m32) m32=true ;;
+ -m64) m64=true ;;
+ esac
+ done
+
+ eval target_=\"\${${target_var}}\"
+
+ # Fix up bitness
+ case "${target_}" in
+ sparc-*) $m64 && target_=${target_/#sparc-/sparc64-} ;;
+ sparc64-*) $m32 && target_=${target_/#sparc64-/sparc-} ;;
+ esac
+
+ # Set the target variable
+ eval ${target_var}=\"${target_}\"
+}
+
+# Special tuple adjustment for glibc.
+CT_DoArchGlibcAdjustTuple() {
+ local target_var="${1}"
+ local target_
+
+ eval target_=\"\${${target_var}}\"
+
+ case "${target_}" in
+ # SPARC quirk: glibc 2.23 and newer dropped support for SPARCv8 and
+ # earlier (corresponding pthread barrier code is missing). Until this
+ # support is reintroduced, configure as sparcv9.
+ sparc-*)
+ if [ "${CT_LIBC_GLIBC_2_23_or_later}" = y ]; then
+ CT_DoLog WARN "GLIBC 2.23 only supports SPARCv9"
+ target_=${target_/#sparc-/sparcv9-}
+ fi
+ ;;
+ esac
+
+ # Set the target variable
+ eval ${target_var}=\"${target_}\"
+}
+
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
+
+ CT_DoArchUClibcSelectArch "${cfg}" "${CT_ARCH}"
+ # FIXME: select CONFIG_SPARC_V7/V8/V9/V9B according to the CPU selector
}
diff --git a/scripts/build/arch/x86.sh b/scripts/build/arch/x86.sh
index ca0f08b..2c8a226 100644
--- a/scripts/build/arch/x86.sh
+++ b/scripts/build/arch/x86.sh
@@ -15,7 +15,9 @@ CT_DoArchTupleValues() {
winchip*) CT_TARGET_ARCH=i486;;
pentium|pentium-mmx|c3*) CT_TARGET_ARCH=i586;;
pentiumpro|pentium*|athlon*) CT_TARGET_ARCH=i686;;
- prescott) CT_TARGET_ARCH=i686;;
+ core2|atom) CT_TARGET_ARCH=i686;;
+ prescott|nocona) CT_TARGET_ARCH=i686;;
+ k8*|opteron*) CT_TARGET_ARCH=i686;;
*) CT_TARGET_ARCH=i586;;
esac
fi
@@ -35,11 +37,12 @@ CT_DoArchTupleValues() {
#------------------------------------------------------------------------------
# Get multilib architecture-specific target
-# Usage: CT_DoArchMultilibTarget "multilib flags" "target tuple"
+# Usage: CT_DoArchMultilibTarget "target variable" "multilib flags"
CT_DoArchMultilibTarget ()
{
- local target="${1}"; shift
+ local target_var="${1}"; shift
local -a multi_flags=( "$@" )
+ local target_
local bit32=false
local bit64=false
@@ -54,17 +57,126 @@ CT_DoArchMultilibTarget ()
esac
done
+ eval target_=\"\${${target_var}}\"
+
# Fix up architecture.
- case "${target}" in
- x86_64-*) $bit32 && target=${target/#x86_64-/i386-} ;;
- i[34567]86-*) $bit64 && target=${target/#i[34567]86-/x86_64-} ;;
+ case "${target_}" in
+ x86_64-*) $bit32 && target_=${target_/#x86_64-/i386-} ;;
+ i[34567]86-*) $bit64 && target_=${target_/#i[34567]86-/x86_64-} ;;
esac
# Fix up the ABI part.
- case "${target}" in
- *x32) $abi_dflt && target=${target/%x32} ;;
- *) $abi_x32 && target=${target}x32 ;;
+ case "${target_}" in
+ *x32) $abi_dflt && target_=${target_/%x32} ;;
+ *) $abi_x32 && target_=${target_}x32 ;;
+ esac
+
+ # Set the target variable
+ eval ${target_var}=\"${target_}\"
+}
+
+# Adjust target tuple for GLIBC
+CT_DoArchGlibcAdjustTuple() {
+ local target_var="${1}"
+ local target_
+
+ eval target_=\"\${${target_var}}\"
+
+ case "${target_}" in
+ # x86 quirk: architecture name is i386, but glibc expects i[4567]86 - to
+ # indicate the desired optimization. If it was a multilib variant of x86_64,
+ # then it targets at least NetBurst a.k.a. i786, but we'll follow the model
+ # above # and set the optimization to i686. Otherwise, replace with the most
+ # conservative choice, i486.
+ i386-*)
+ if [ "${CT_TARGET_ARCH}" = "x86_64" ]; then
+ target_=${target_/#i386-/i686-}
+ elif [ "${CT_TARGET_ARCH}" != "i386" ]; then
+ target_=${target_/#i386-/${CT_TARGET_ARCH}-}
+ else
+ target_=${target_/#i386-/i486-}
+ fi
+ ;;
+ esac
+
+ # Set the target variable
+ eval ${target_var}=\"${target_}\"
+}
+
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
+
+ if [ "${CT_ARCH_BITNESS}" = 64 ]; then
+ CT_DoArchUClibcSelectArch "${cfg}" "x86_64"
+ else
+ CT_DoArchUClibcSelectArch "${cfg}" "i386"
+ fi
+
+ # FIXME This doesn't cover all cases of x86_32 on uClibc (!ng)
+ CT_KconfigDisableOption "CONFIG_386" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_486" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_586" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_686" "${cfg}"
+ case ${CT_TARGET_ARCH} in
+ i386)
+ CT_KconfigEnableOption "CONFIG_386" "${cfg}"
+ ;;
+ i486)
+ CT_KconfigEnableOption "CONFIG_486" "${cfg}"
+ ;;
+ i586)
+ CT_KconfigEnableOption "CONFIG_586" "${cfg}"
+ ;;
+ i686)
+ CT_KconfigEnableOption "CONFIG_686" "${cfg}"
+ ;;
esac
+}
+
+CT_DoArchUClibcCflags() {
+ local cfg="${1}"
+ local cflags="${2}"
+ local f
+
+ for f in ${cflags}; do
+ case "${f}" in
+ -m64)
+ CT_DoArchUClibcSelectArch "${cfg}" "x86_64"
+ ;;
+ -m32)
+ # Since it's a part of multilib with 64-bit flavor, default
+ # to new architecture (i686).
+ CT_DoArchUClibcSelectArch "${cfg}" "i386"
+ CT_KconfigDisableOption "CONFIG_386" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_486" "${cfg}"
+ CT_KconfigDisableOption "CONFIG_586" "${cfg}"
+ CT_KconfigEnableOption "CONFIG_686" "${cfg}"
+ ;;
+ -mx32)
+ CT_Abort "uClibc does not support x32 ABI"
+ ;;
+ esac
+ done
+}
+
+CT_DoArchUClibcHeaderDir() {
+ local dir_var="${1}"
+ local cflags="${2}"
+
+ # If it is non-default multilib, add a suffix with architecture (reported by gcc)
+ # to the headers installation path.
+ if [ -n "${cflags}" ]; then
+ eval "${dir_var}="$( ${CT_TARGET}-gcc -print-multiarch ${cflags} )
+ fi
+}
- echo "${target}"
+CT_DoArchMUSLHeaderDir() {
+ local dir_var="${1}"
+ local cflags="${2}"
+
+ # If it is non-default multilib, add a suffix with architecture (reported by gcc)
+ # to the headers installation path.
+ if [ -n "${cflags}" ]; then
+ eval "${dir_var}="$( ${CT_TARGET}-gcc -print-multiarch ${cflags} )
+ fi
}
diff --git a/scripts/build/arch/xtensa.sh b/scripts/build/arch/xtensa.sh
index c7bd432..a3010c6 100644
--- a/scripts/build/arch/xtensa.sh
+++ b/scripts/build/arch/xtensa.sh
@@ -70,3 +70,9 @@ CT_ConfigureXtensa() {
CT_Popd
}
+
+CT_DoArchUClibcConfig() {
+ local cfg="${1}"
+
+ CT_DoArchUClibcSelectArch "${cfg}" "xtensa"
+}
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index edaf818..65a2dcc 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -25,7 +25,7 @@ do_binutils_get() {
CT_GetCustom "elf2flt" "${CT_ELF2FLT_CUSTOM_VERSION}" \
"${CT_ELF2FLT_CUSTOM_LOCATION}"
else
- CT_GetGit elf2flt "${CT_ELF2FLT_GIT_CSET}" http://cgit.openadk.org/cgi/cgit/elf2flt.git
+ CT_GetGit elf2flt "${CT_ELF2FLT_GIT_CSET}" https://github.com/uclinux-dev/elf2flt.git
fi
fi
}
diff --git a/scripts/build/cc/100-gcc.sh b/scripts/build/cc/100-gcc.sh
index 7bb3610..db14728 100644
--- a/scripts/build/cc/100-gcc.sh
+++ b/scripts/build/cc/100-gcc.sh
@@ -85,6 +85,169 @@ cc_gcc_lang_list() {
}
#------------------------------------------------------------------------------
+# Return a value of a requested GCC spec
+cc_gcc_get_spec() {
+ local spec=$1
+ local cc_and_cflags=$2
+
+ # GCC does not provide a facility to request a value of a spec string.
+ # The only way to do that I found was to augment the spec file with
+ # some dummy suffix handler that does nothing except printing it.
+ touch temp-input.spec_eval
+ {
+ echo ".spec_eval:"
+ echo "echo %(${spec})"
+ } > "tmp-specs-${spec}"
+ ${cc_and_cflags} -specs="tmp-specs-${spec}" -E temp-input.spec_eval
+}
+
+#------------------------------------------------------------------------------
+# Report the type of a GCC option
+cc_gcc_classify_opt() {
+ # Options present in multiple architectures
+ case "${1}" in
+ -march=*) echo "arch"; return;;
+ -mabi=*) echo "abi"; return;;
+ -mcpu=*|-mmcu=*) echo "cpu"; return;;
+ -mtune=*) echo "tune"; return;;
+ -mfpu=*) echo "fpu"; return;;
+ -mhard-float|-msoft-float|-mno-soft-float|-mno-float|-mfloat-abi=*|\
+ -mfpu|-mno-fpu) echo "float"; return;;
+ -EB|-EL|-mbig-endian|-mlittle-endian|-mbig|-mlittle|-meb|-mel|-mb|-ml) echo "endian"; return;;
+ -mthumb|-marm) echo "mode"; return;;
+ esac
+
+ # Arch-specific options and aliases
+ case "${CT_ARCH}" in
+ m68k)
+ case "${1}" in
+ -m68881) echo "float"; return;;
+ -m5[234]*|-mcfv4e) echo "cpu"; return;;
+ -m68*|-mc68*) echo "arch"; return;;
+ esac
+ ;;
+ mips)
+ case "${1}" in
+ -mips[1234]|-mips32|-mips32r*|-mips64|-mips64r*) echo "cpu"; return;;
+ esac
+ ;;
+ sh)
+ case "${1}" in
+ -m[12345]*) echo "cpu"; return;;
+ esac
+ esac
+
+ # All tried and failed
+ echo "unknown"
+}
+
+#------------------------------------------------------------------------------
+# This function lists the multilibs configured in the compiler (even if multilib
+# is disabled - so that it lists the default GCC/OS directory, which may differ
+# from the default 'lib'). It then performs a few multilib checks/quirks:
+#
+# 1. On SuperH target, configuring with default CPU (e.g. by supplying the target
+# name as 'sh4', which is what CT-NG does) results in the compiler being unable to
+# run if that same switch is passed to the resulting gcc (e.g. 'gcc -m4'). The reason
+# for this behavior is that the script that determines the sysroot suffix is not
+# aware of the default multilib selection, so it generates <sysroot>/m4 as the
+# suffixed sysroot. But the main driver, knowing that -m4 is the default, does not
+# even attempt to fall back to the non-suffixed sysroot (as it does with non-default
+# multilibs) - as a result, gcc fails to find any library if invoked with -m4.
+# The right solution would be to drop the default CPU from the multilib list
+# completely, or make the print-sysroot-suffix.sh script aware of the defaults
+# (which is not easy, as the defaults are not in tmake_file, but rather in tm_file...)
+#
+# 2. On MIPS target, gcc (or rather, ld, which it invokes under the hood) chokes
+# if supplied with two -mabi=* options. I.e., 'gcc -mabi=n32' and 'gcc -mabi=32' both
+# work, but 'gcc -mabi=32 -mabi=n32' produces an internal error in ld. Thus we do
+# not supply target's CFLAGS in multilib builds - and after compiling pass-1 gcc,
+# attempt to determine which CFLAGS need to be filtered out.
+cc_gcc_multilib_housekeeping() {
+ local cc host
+ local flags osdir dir multilibs i f
+ local multilib_defaults
+ local suffix sysroot base lnk
+ local ml_arch ml_abi ml_cpu ml_tune ml_fpu ml_float ml_endian ml_mode ml_unknown ml
+ local new_cflags
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ if [ \( "${CT_CANADIAN}" = "y" -o "${CT_CROSS_NATIVE}" = "y" \) -a "${host}" = "${CT_HOST}" ]; then
+ CT_DoLog EXTRA "Canadian Cross/Cross-native unable to confirm multilibs configuration "\
+ "directly; will use build-compiler for housekeeping."
+ # Since we cannot run the desired compiler, substitute build-CC with the assumption
+ # that the host-CC is configured in the same way.
+ cc="${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-gcc"
+ fi
+
+ # sed: prepend dashes or do nothing if default is empty string
+ multilib_defaults=( $( cc_gcc_get_spec multilib_defaults "${cc}" | \
+ ${sed} 's/\(^\|[[:space:]]\+\)\([^[:space:]]\)/ -\2/g' ) )
+ CT_DoLog EXTRA "gcc default flags: '${multilib_defaults}'"
+
+ multilibs=( $( "${cc}" -print-multi-lib ) )
+ if [ ${#multilibs[@]} -ne 0 ]; then
+ CT_DoLog EXTRA "gcc configured with these multilibs (including the default):"
+ for i in "${multilibs[@]}"; do
+ dir="lib/${i%%;*}"
+ flags="${i#*;}"
+ flags=${flags//@/ -}
+ flags=$( echo ${flags} )
+ osdir="lib/"$( "${cc}" -print-multi-os-directory ${flags} )
+ CT_SanitizeVarDir dir osdir
+ CT_DoLog EXTRA " '${flags}' --> ${dir} (gcc) ${osdir} (os)"
+ for f in ${flags}; do
+ eval ml_`cc_gcc_classify_opt ${f}`=seen
+ done
+ done
+ else
+ CT_DoLog WARN "no multilib configuration: GCC unusable?"
+ fi
+
+ # Filtering out some of the options provided in CT-NG config. Then *prepend*
+ # them to CT_TARGET_CFLAGS, like scripts/crosstool-NG.sh does. Zero out
+ # the stashed MULTILIB flags so that we don't process them again in the passes
+ # that follow.
+ CT_DoLog DEBUG "Configured target CFLAGS: '${CT_ARCH_TARGET_CFLAGS_MULTILIB}'"
+ ml_unknown= # Pass through anything we don't know about
+ for f in ${CT_ARCH_TARGET_CFLAGS_MULTILIB}; do
+ eval ml=\$ml_`cc_gcc_classify_opt ${f}`
+ if [ "${ml}" != "seen" ]; then
+ new_cflags="${new_cflags} ${f}"
+ fi
+ done
+ CT_DoLog DEBUG "Filtered target CFLAGS: '${new_cflags}'"
+ CT_EnvModify CT_TARGET_CFLAGS "${new_cflags} ${CT_TARGET_CFLAGS}"
+ CT_EnvModify CT_ARCH_TARGET_CFLAGS_MULTILIB ""
+
+ # Currently, the only LDFLAGS are endianness-related
+ CT_DoLog DEBUG "Configured target LDFLAGS: '${CT_ARCH_TARGET_LDFLAGS_MULTILIB}'"
+ if [ "${ml_endian}" != "seen" ]; then
+ CT_EnvModify CT_TARGET_LDFLAGS "${CT_ARCH_TARGET_LDFLAGS_MULTILIB} ${CT_TARGET_LDFLAGS}"
+ CT_EnvModify CT_ARCH_TARGET_LDFLAGS_MULTILIB ""
+ fi
+ CT_DoLog DEBUG "Filtered target LDFLAGS: '${CT_ARCH_TARGET_LDFLAGS_MULTILIB}'"
+
+ # Sysroot suffix fixup for the multilib default.
+ suffix=$( cc_gcc_get_spec sysroot_suffix_spec "${cc} ${multilib_defaults}" )
+ if [ -n "${suffix}" ]; then
+ base=${suffix%/*}
+ sysroot=$( "${cc}" -print-sysroot )
+ if [ -n "${base}" ]; then
+ CT_DoExecLog ALL mkdir -p "${sysroot}${base}"
+ lnk=$( echo "${base#/}" | ${sed} -e 's,[^/]*,..,g' )
+ else
+ lnk=.
+ fi
+ CT_DoExecLog ALL rm -f "${sysroot}${suffix}"
+ CT_DoExecLog ALL ln -sfv "${lnk}" "${sysroot}${suffix}"
+ fi
+}
+
+#------------------------------------------------------------------------------
# Core gcc pass 1
do_gcc_core_pass_1() {
local -a core_opts
@@ -539,7 +702,7 @@ do_gcc_core_backend() {
# tree makes the libtoolized utilities that are built next assume
# that, for example, libsupc++ is an "accessory library", and not include
# -lsupc++ to the link flags. That breaks ltrace, for example.
- CT_DoLog EXTRA "Housekeeping for final gcc compiler"
+ CT_DoLog EXTRA "Housekeeping for core gcc compiler"
CT_Pushd "${prefix}"
find . -type f -name "*.la" -exec rm {} \; |CT_DoLog ALL
CT_Popd
@@ -560,25 +723,8 @@ do_gcc_core_backend() {
CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
fi
- if [ "${CT_MULTILIB}" = "y" ]; then
- if [ "${CT_CANADIAN}" = "y" -a "${mode}" = "baremetal" \
- -a "${host}" = "${CT_HOST}" ]; then
- CT_DoLog WARN "Canadian Cross unable to confirm multilibs configured correctly"
- else
- multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib \
- |tail -n +2 ) )
- if [ ${#multilibs[@]} -ne 0 ]; then
- CT_DoLog EXTRA "gcc configured with these multilibs (besides the default):"
- for i in "${multilibs[@]}"; do
- dir="${i%%;*}"
- flags="${i#*;}"
- CT_DoLog EXTRA " ${flags//@/ -} --> ${dir}/"
- done
- else
- CT_DoLog WARN "gcc configured for multilib, but none available"
- fi
- fi
- fi
+ cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-gcc" \
+ host="${host}"
}
#------------------------------------------------------------------------------
@@ -965,25 +1111,9 @@ do_gcc_backend() {
file="$( ls -1 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )"
[ -z "${file}" ] || ext=".${file##*.}"
if [ -f "${CT_PREFIX_DIR}/bin/${CT_TARGET}-gcc${ext}" ]; then
- CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}"
+ CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
fi
- if [ "${CT_MULTILIB}" = "y" ]; then
- if [ "${CT_CANADIAN}" = "y" ]; then
- CT_DoLog WARN "Canadian Cross unable to confirm multilibs configured correctly"
- else
- multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib \
- |tail -n +2 ) )
- if [ ${#multilibs[@]} -ne 0 ]; then
- CT_DoLog EXTRA "gcc configured with these multilibs (besides the default):"
- for i in "${multilibs[@]}"; do
- dir="${i%%;*}"
- flags="${i#*;}"
- CT_DoLog EXTRA " ${flags//@/ -} --> ${dir}/"
- done
- else
- CT_DoLog WARN "gcc configured for multilib, but none available"
- fi
- fi
- fi
+ cc_gcc_multilib_housekeeping cc="${prefix}/bin/${CT_TARGET}-gcc" \
+ host="${host}"
}
diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh
index a2351ac..08a5be9 100644
--- a/scripts/build/internals.sh
+++ b/scripts/build/internals.sh
@@ -64,6 +64,7 @@ do_finish() {
CT_DoLog EXTRA "Installing the populate helper"
${sed} -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
-e 's|@@CT_install@@|'"${install}"'|g;' \
+ -e 's|@@CT_awk@@|'"${awk}"'|g;' \
-e 's|@@CT_bash@@|'"${bash}"'|g;' \
-e 's|@@CT_grep@@|'"${grep}"'|g;' \
-e 's|@@CT_make@@|'"${make}"'|g;' \
@@ -118,12 +119,5 @@ do_finish() {
CT_DoForceRmdir "${CT_DEBUGROOT_DIR}/"{,usr/}{,share/}{man,info}
fi
- # Remove the lib* symlinks, now:
- # The symlinks are needed only during the build process.
- # The final gcc will still search those dirs, but will also search
- # the standard lib/ dirs, so we can get rid of the symlinks
- CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib32"
- CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib64"
-
CT_EndStep
}
diff --git a/scripts/build/libc/avr-libc.sh b/scripts/build/libc/avr-libc.sh
index b73f990..3dc91a4 100644
--- a/scripts/build/libc/avr-libc.sh
+++ b/scripts/build/libc/avr-libc.sh
@@ -18,10 +18,6 @@ do_libc_extract() {
CT_Patch "avr-libc" "${CT_LIBC_VERSION}"
}
-do_libc_check_config() {
- :
-}
-
do_libc_configure() {
CT_DoLog EXTRA "Configuring C library"
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 472acad..8027b8f 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -41,10 +41,6 @@ do_libc_extract() {
CT_Popd
}
-do_libc_check_config() {
- :
-}
-
# Build and install headers and start files
do_libc_start_files() {
# Start files and Headers should be configured the same way as the
@@ -68,14 +64,6 @@ do_libc_post_cc() {
# libc_mode : 'startfiles' or 'final' : string : (none)
do_libc_backend() {
local libc_mode
- local -a multilibs
- local multilib
- local multi_dir
- local multi_flags
- local extra_dir
- local target
- local libc_headers libc_startfiles libc_full
- local hdr
local arg
for arg in "$@"; do
@@ -85,167 +73,77 @@ do_libc_backend() {
case "${libc_mode}" in
startfiles)
CT_DoStep INFO "Installing C library headers & start files"
- hdr=y
- libc_startfiles=y
- libc_full=
;;
final)
CT_DoStep INFO "Installing C library"
- hdr=
- libc_startfiles=
- libc_full=y
;;
- *) CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";;
+ *)
+ CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'"
+ ;;
esac
- # If gcc is not configured for multilib, it still prints
- # a single line for the default settings
- multilibs=( $("${CT_TARGET}-gcc" -print-multi-lib 2>/dev/null) )
- for multilib in "${multilibs[@]}"; do
- multi_dir="${multilib%%;*}"
- if [ "${multi_dir}" != "." ]; then
- CT_DoStep INFO "Building for multilib subdir='${multi_dir}'"
-
- extra_flags="$( echo "${multilib#*;}" \
- |${sed} -r -e 's/@/ -/g;' \
- )"
- extra_dir="/${multi_dir}"
-
- # glibc install its files in ${extra_dir}/{usr/,}lib
- # while gcc expects them in {,usr/}lib/${extra_dir}.
- # Prepare some symlinks so glibc installs in fact in
- # the proper place
- # We do it in the start-files step, so it is not needed
- # to do it in the final step, as the symlinks will
- # already exist
- if [ "${libc_mode}" = "startfiles" ]; then
- CT_Pushd "${CT_SYSROOT_DIR}"
- CT_DoExecLog ALL mkdir -p "lib/${multi_dir}" \
- "usr/lib/${multi_dir}" \
- "${multi_dir}" \
- "${multi_dir}/usr"
- CT_DoExecLog ALL ln -sf "../lib/${multi_dir}" "${multi_dir}/lib"
- CT_DoExecLog ALL ln -sf "../../usr/lib/${multi_dir}" "${multi_dir}/usr/lib"
- CT_Popd
- fi
- libc_headers=
- else
- extra_dir=
- extra_flags=
- libc_headers="${hdr}"
- fi
-
- CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}${extra_dir//\//_}"
-
- target=$( CT_DoMultilibTarget "${CT_TARGET}" ${extra_flags} )
- case "${target}" in
- # SPARC quirk: glibc 2.23 and newer dropped support for SPARCv8 and
- # earlier (corresponding pthread barrier code is missing). Until this
- # support is reintroduced, configure as sparcv9.
- sparc-*)
- if [ "${CT_LIBC_GLIBC_2_23_or_later}" = y ]; then
- target=${target/#sparc-/sparcv9-}
- fi
- ;;
- # x86 quirk: architecture name is i386, but glibc expects i[4567]86 - to
- # indicate the desired optimization. If it was a multilib variant of x86_64,
- # then it targets at least NetBurst a.k.a. i786, but we'll follow arch/x86.sh
- # and set the optimization to i686. Otherwise, replace with the most
- # conservative choice, i486.
- i386-*)
- if [ "${CT_TARGET_ARCH}" = "x86_64" ]; then
- target=${target/#i386-/i686-}
- else
- target=${target/#i386-/i486-}
- fi
- ;;
- esac
-
- do_libc_backend_once extra_dir="${extra_dir}" \
- extra_flags="${extra_flags}" \
- libc_headers="${libc_headers}" \
- libc_startfiles="${libc_startfiles}" \
- libc_full="${libc_full}" \
- target="${target}"
-
- CT_Popd
-
- if [ "${multi_dir}" != "." ]; then
- if [ "${libc_mode}" = "final" ]; then
- CT_DoLog EXTRA "Fixing up multilib location"
-
- # rewrite the library multiplexers
- for d in "lib/${multi_dir}" "usr/lib/${multi_dir}"; do
- for l in libc libpthread libgcc_s; do
- if [ -f "${CT_SYSROOT_DIR}/${d}/${l}.so" \
- -a ! -L ${CT_SYSROOT_DIR}/${d}/${l}.so ]
- then
- CT_DoExecLog DEBUG ${sed} -r -i \
- -e "s:/lib/:/lib/${multi_dir}/:g;" \
- "${CT_SYSROOT_DIR}/${d}/${l}.so"
- fi
- done
- done
- # Remove the multi_dir now it is no longer useful
- CT_DoExecLog DEBUG rm -rf "${CT_SYSROOT_DIR}/${multi_dir}"
- fi # libc_mode == final
-
- CT_EndStep
- fi
- done
-
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}"
+ CT_IterateMultilibs do_libc_backend_once multilib libc_mode="${libc_mode}"
+ CT_Popd
CT_EndStep
}
# This backend builds the C library once
# Usage: do_libc_backend_once param=value [...]
-# Parameter : Definition : Type : Default
-# libc_headers : Build libc headers : bool : n
-# libc_startfiles : Build libc start-files : bool : n
-# libc_full : Build full libc : bool : n
-# extra_flags : Extra CFLAGS to use (for multilib) : string : (empty)
-# extra_dir : Extra subdir for multilib : string : (empty)
-# target : Build libc using this target (for multilib) : string : ${CT_TARGET}
+# Parameter : Definition : Type
+# libc_mode : 'startfiles' or 'final' : string : (empty)
+# multi_* : as defined in CT_IterateMultilibs : (varies) :
do_libc_backend_once() {
- local libc_headers
- local libc_startfiles
- local libc_full
- local extra_flags
- local extra_dir
+ local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count
+ local startfiles_dir
local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
- local extra_cc_args
local -a extra_config
local -a extra_make_args
local glibc_cflags
- local float_extra
- local endian_extra
- local target
- local arg
+ local arg opt
for arg in "$@"; do
eval "${arg// /\\ }"
done
- if [ "${target}" = "" ]; then
- target="${CT_TARGET}"
+ CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'"
+
+ # Ensure sysroot (with suffix, if applicable) exists
+ CT_DoExecLog ALL mkdir -p "${multi_root}"
+
+ # Adjust target tuple according GLIBC quirks
+ CT_DoArchGlibcAdjustTuple multi_target
+
+ # Glibc seems to be smart enough to know about the cases that can coexist
+ # in the same root and installs them into proper multilib-os directory; all
+ # we need is to point to the right root. We do need to handle multilib-os
+ # here, though, for the first pass where we install crt*.o and a dummy
+ # libc.so; we therefore install it to the most specific location of
+ # <sysroot>/<suffix>/usr/lib/<multilib-os> where it is least likely to clash
+ # with other multilib variants. We then remove these temporary files at
+ # the beginning of the libc-final step and allow glibc to install them
+ # where it thinks is proper.
+ startfiles_dir="${multi_root}/usr/lib/${multi_os_dir}"
+ CT_SanitizeVarDir startfiles_dir
+
+ if [ "${libc_mode}" = "final" ]; then
+ CT_DoLog EXTRA "Cleaning up start files"
+ CT_DoExecLog ALL rm -f "${startfiles_dir}/crt1.o" \
+ "${startfiles_dir}/crti.o" \
+ "${startfiles_dir}/crtn.o" \
+ "${startfiles_dir}/libc.so"
fi
CT_DoLog EXTRA "Configuring C library"
- case "${CT_LIBC}" in
- glibc)
- # glibc can't be built without -O2 (reference needed!)
- OPTIMIZE=-O2
- # Also, if those two are missing, iconv build breaks
- extra_config+=( --disable-debug --disable-sanity-checks )
- ;;
- esac
+ # Also, if those two are missing, iconv build breaks
+ extra_config+=( --disable-debug --disable-sanity-checks )
# always include rpc, the user can still override it with TI-RPC
extra_config+=( --enable-obsolete-rpc )
# Add some default glibc config options if not given by user.
- # We don't need to be conditional on wether the user did set different
+ # We don't need to be conditional on whether the user did set different
# values, as they CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY is passed after
# extra_config
@@ -267,21 +165,6 @@ do_libc_backend_once() {
*) extra_config+=("--disable-shared");;
esac
- float_extra="$( echo "${extra_flags}" \
- |${sed} -r -e '/^(.*[[:space:]])?-m(hard|soft)-float([[:space:]].*)?$/!d;' \
- -e 's//\2/;' \
- )"
- case "${float_extra}" in
- hard) extra_config+=("--with-fp");;
- soft) extra_config+=("--without-fp");;
- "")
- case "${CT_ARCH_FLOAT}" in
- hard|softfp) extra_config+=("--with-fp");;
- soft) extra_config+=("--without-fp");;
- esac
- ;;
- esac
-
if [ "${CT_LIBC_DISABLE_VERSIONING}" = "y" ]; then
extra_config+=("--disable-versioning")
fi
@@ -298,24 +181,6 @@ do_libc_backend_once() {
extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
- # Extract the endianness options if any
- # This should cover all possible endianness options
- # in gcc, but it is prone to bit-rot... :-(
- endian_extra="$( echo "${extra_flags}" \
- |${sed} -r -e '/^(.*[[:space:]])?-(E[BL]|m((big|little)(-endian)?|e?[bl]))([[:space:]].*)?$/!d;' \
- -e 's//\2/;' \
- )"
- # If extra_flags contained an endianness option, no need to add it again. Otherwise,
- # add the option from the configuration.
- case "${endian_extra}" in
- EB|mbig-endian|mbig|meb|mb)
- ;;
- EL|mlittle-endian|mlittle|mel|ml)
- ;;
- "") extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
- ;;
- esac
-
touch config.cache
if [ "${CT_LIBC_GLIBC_FORCE_UNWIND}" = "y" ]; then
echo "libc_cv_forced_unwind=yes" >>config.cache
@@ -325,14 +190,30 @@ do_libc_backend_once() {
# Pre-seed the configparms file with values from the config option
printf "%s\n" "${CT_LIBC_GLIBC_CONFIGPARMS}" > configparms
- cross_cc=$(CT_Which "${CT_TARGET}-gcc")
- extra_cc_args+=" ${extra_flags}"
+ # glibc can't be built without -O2 (reference needed!)
+ glibc_cflags+=" -O2"
case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in
y) ;;
*) glibc_cflags+=" -U_FORTIFY_SOURCE";;
esac
- glibc_cflags+=" ${CT_TARGET_CFLAGS} ${OPTIMIZE} ${CT_LIBC_GLIBC_EXTRA_CFLAGS}"
+
+ # In the order of increasing precedence. Flags common to compiler and linker.
+ glibc_cflags+=" ${CT_TARGET_CFLAGS}"
+ glibc_cflags+=" ${CT_LIBC_GLIBC_EXTRA_CFLAGS}"
+ glibc_cflags+=" ${multi_flags}"
+
+ # Analyze the resulting options for any extra configure switches to throw in.
+ for opt in ${glibc_cflags}; do
+ case ${opt} in
+ -mhard-float|-mfloat-abi=hard|-mfloat-abi=softfp|-mno-soft-float|-mfpu)
+ extra_config+=("--with-fp")
+ ;;
+ -msoft-float|-mfloat-abi=soft|-mno-float|-mno-fpu)
+ extra_config+=("--without-fp")
+ ;;
+ esac
+ done
# ./configure is mislead by our tools override wrapper for bash
# so just tell it where the real bash is _on_the_target_!
@@ -349,31 +230,35 @@ do_libc_backend_once() {
# Configure with --prefix the way we want it on the target...
# There are a whole lot of settings here. You'll probably want
- # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG_ARRAY
- # Compare these options with the ones used when installing the glibc headers above - they're different.
- # Adding "--without-gd" option to avoid error "memusagestat.c:36:16: gd.h: No such file or directory"
+ # to read up on what they all mean, and customize a bit, possibly
+ # by setting GLIBC_EXTRA_CONFIG_ARRAY.
+ # Compare these options with the ones used when installing
+ # the glibc headers above - they're different.
+ # Adding "--without-gd" option to avoid error "memusagestat.c:36:16:
+ # gd.h: No such file or directory"
# See also http://sources.redhat.com/ml/libc-alpha/2000-07/msg00024.html.
# Set BUILD_CC, or we won't be able to build datafiles
# Run explicitly through CONFIG_SHELL, or the build breaks badly (loop-of-death)
# when the shell is not bash... Sigh... :-(
- CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
- CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
- CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
- CT_DoLog DEBUG "Extra CC args passed : '${glibc_cflags}'"
- CT_DoLog DEBUG "Extra flags (multilib) : '${extra_flags}'"
+ CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
+ CT_DoLog DEBUG "Extra config args passed : '${extra_config[*]}'"
+ CT_DoLog DEBUG "Extra CFLAGS passed : '${glibc_cflags}'"
+ CT_DoLog DEBUG "Placing startfiles into : '${startfiles_dir}'"
+ CT_DoLog DEBUG "Configuring with --host : '${multi_target}'"
+ # CFLAGS are only applied when compiling .c files. .S files are compiled with ASFLAGS,
+ # but they are not passed by configure. Thus, pass everything in CC instead.
CT_DoExecLog CFG \
- BUILD_CC="${CT_BUILD}-gcc" \
- CFLAGS="${glibc_cflags}" \
- CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
+ BUILD_CC=${CT_BUILD}-gcc \
+ CC="${CT_TARGET}-gcc ${glibc_cflags}" \
AR=${CT_TARGET}-ar \
RANLIB=${CT_TARGET}-ranlib \
"${CONFIG_SHELL}" \
"${src_dir}/configure" \
--prefix=/usr \
--build=${CT_BUILD} \
- --host=${target} \
+ --host=${multi_target} \
--cache-file="$(pwd)/config.cache" \
--without-cvs \
--disable-profile \
@@ -409,13 +294,14 @@ do_libc_backend_once() {
;;
esac
- if [ "${libc_headers}" = "y" ]; then
+ if [ "${libc_mode}" = "startfiles" -a ! -r "${multi_root}/.libc_headers_installed" ]; then
CT_DoLog EXTRA "Installing C library headers"
+ CT_DoExecLog ALL touch "${multi_root}/.libc_headers_installed"
# use the 'install-headers' makefile target to install the
# headers
CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
- install_root=${CT_SYSROOT_DIR}${extra_dir} \
+ install_root=${multi_root} \
install-bootstrap-headers=yes \
"${extra_make_args[@]}" \
install-headers
@@ -456,47 +342,52 @@ do_libc_backend_once() {
;;
esac
fi
- fi # libc_headers == y
+ elif [ "${libc_mode}" = "final" -a -r "${multi_root}/.libc_headers_installed" ]; then
+ CT_DoExecLog ALL rm -f "${multi_root}/.libc_headers_installed"
+ fi # installing headers
- if [ "${libc_startfiles}" = "y" ]; then
+ if [ "${libc_mode}" = "startfiles" ]; then
if [ "${CT_THREADS}" = "nptl" ]; then
CT_DoLog EXTRA "Installing C library start files"
# there are a few object files needed to link shared libraries,
# which we build and install by hand
- CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}${extra_dir}/usr/lib"
+ CT_DoExecLog ALL mkdir -p "${startfiles_dir}"
CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
- "${extra_make_args[@]}" \
+ "${extra_make_args[@]}" \
csu/subdir_lib
CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
- "${CT_SYSROOT_DIR}${extra_dir}/usr/lib"
+ "${startfiles_dir}"
# Finally, 'libgcc_s.so' requires a 'libc.so' to link against.
# However, since we will never actually execute its code,
# it doesn't matter what it contains. So, treating '/dev/null'
# as a C source file, we produce a dummy 'libc.so' in one step
- CT_DoExecLog ALL "${cross_cc}" ${extra_flags} \
- -nostdlib \
- -nostartfiles \
- -shared \
- -x c /dev/null \
- -o "${CT_SYSROOT_DIR}${extra_dir}/usr/lib/libc.so"
+ CT_DoExecLog ALL "${CT_TARGET}-gcc" ${multi_flags} \
+ -nostdlib \
+ -nostartfiles \
+ -shared \
+ -x c /dev/null \
+ -o "${startfiles_dir}/libc.so"
fi # threads == nptl
- fi # libc_headers == y
+ fi # libc_mode = startfiles
- if [ "${libc_full}" = "y" ]; then
+ if [ "${libc_mode}" = "final" ]; then
CT_DoLog EXTRA "Building C library"
CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
"${extra_make_args[@]}" \
all
CT_DoLog EXTRA "Installing C library"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
- "${extra_make_args[@]}" \
- install_root="${CT_SYSROOT_DIR}${extra_dir}" \
+ CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
+ "${extra_make_args[@]}" \
+ install_root="${multi_root}" \
install
- if [ "${CT_BUILD_MANUALS}" = "y" ]; then
+ if [ "${CT_BUILD_MANUALS}" = "y" -a "${multi_index}" = "${multi_count}" ]; then
+ # We only need to build the manuals once. Only build them on the
+ # last multilib target. If it's not multilib, it will happen on the
+ # only target.
CT_DoLog EXTRA "Building and installing the C library manual"
# Omit JOBSFLAGS as GLIBC has problems building the
# manuals in parallel
@@ -507,10 +398,12 @@ do_libc_backend_once() {
${CT_PREFIX_DIR}/share/doc
fi
- if [ "${CT_LIBC_LOCALES}" = "y" ]; then
+ if [ "${CT_LIBC_LOCALES}" = "y" -a "${multi_index}" = "${multi_count}" ]; then
do_libc_locales
fi
- fi # libc_full == y
+ fi # libc_mode = final
+
+ CT_EndStep
}
# Build up the addons list, separated with $1
diff --git a/scripts/build/libc/mingw.sh b/scripts/build/libc/mingw.sh
index 964a11d..44ca008 100644
--- a/scripts/build/libc/mingw.sh
+++ b/scripts/build/libc/mingw.sh
@@ -23,10 +23,6 @@ do_libc_extract() {
CT_Popd
}
-do_libc_check_config() {
- :
-}
-
do_set_mingw_install_prefix(){
MINGW_INSTALL_PREFIX=/usr/${CT_TARGET}
if [[ ${CT_WINAPI_VERSION} == 2* ]]; then
diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh
index 2699d79..2a0c04f 100644
--- a/scripts/build/libc/musl.sh
+++ b/scripts/build/libc/musl.sh
@@ -16,10 +16,6 @@ do_libc_extract() {
CT_Patch "musl" "${CT_LIBC_VERSION}"
}
-do_libc_check_config() {
- :
-}
-
# Build and install headers and start files
do_libc_start_files() {
# Start files and Headers should be configured the same way as the
@@ -36,36 +32,51 @@ do_libc_post_cc() {
:
}
+do_libc_backend() {
+ local libc_mode
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ case "${libc_mode}" in
+ startfiles) CT_DoStep INFO "Installing C library headers & start files";;
+ final) CT_DoStep INFO "Installing C library";;
+ *) CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";;
+ esac
+
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}"
+ CT_IterateMultilibs do_libc_backend_once multilib libc_mode="${libc_mode}"
+ CT_Popd
+ CT_EndStep
+}
+
# This backend builds the C library
# Usage: do_libc_backend param=value [...]
# Parameter : Definition : Type : Default
# libc_mode : 'startfiles' or 'final' : string : (none)
-do_libc_backend() {
+do_libc_backend_once() {
local libc_mode
local -a extra_cflags
local -a extra_config
local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
- local libc_headers libc_startfiles libc_full
+ local multi_dir multi_os_dir multi_root multi_flags multi_index multi_count
+ local multilib_dir
+ local hdr_install_subdir
+ local arg f l
for arg in "$@"; do
eval "${arg// /\\ }"
done
- case "${libc_mode}" in
- startfiles)
- CT_DoStep INFO "Installing C library headers & start files"
- libc_headers=y
- libc_startfiles=y
- libc_full=
- ;;
- final)
- CT_DoStep INFO "Installing C library"
- libc_headers=
- libc_startfiles=
- libc_full=y
- ;;
- *) CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";;
- esac
+ CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'"
+
+ multilib_dir="/usr/lib/${multi_os_dir}"
+ CT_SanitizeVarDir multilib_dir
+ CT_DoExecLog ALL mkdir -p "${multi_root}${multilib_dir}"
+
+ extra_cflags=( ${multi_flags} )
# From buildroot:
# gcc constant folding bug with weak aliases workaround
@@ -84,42 +95,64 @@ do_libc_backend() {
extra_config+=( "--enable-optimize=${CT_LIBC_MUSL_OPTIMIZE}" )
- CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}"
+ # Same problem as with uClibc: different variants sometimes have
+ # incompatible headers.
+ CT_DoArchMUSLHeaderDir hdr_install_subdir "${multi_flags}"
+ if [ -n "${hdr_install_subdir}" ]; then
+ extra_config+=( "--includedir=/usr/include/${hdr_install_subdir}" )
+ fi
# NOTE: musl handles the build/host/target a little bit differently
# then one would expect:
# build : not used
- # host : the machine building musl
+ # host : same as --target
# target : the machine musl runs on
- CT_DoExecLog CFG \
- CFLAGS="${extra_cflags[@]}" \
- CROSS_COMPILE="${CT_TARGET}-" \
- ${src_dir}/configure \
- --host="${CT_TARGET}" \
- --target="${CT_TARGET}" \
- --prefix="/usr" \
- --disable-gcc-wrapper \
+ CT_DoExecLog CFG \
+ CFLAGS="${extra_cflags[*]}" \
+ CROSS_COMPILE="${CT_TARGET}-" \
+ ${src_dir}/configure \
+ --host="${multi_target}" \
+ --target="${multi_target}" \
+ --prefix="/usr" \
+ --libdir="${multilib_dir}" \
+ --disable-gcc-wrapper \
"${extra_config[@]}"
- if [ "${libc_headers}" = "y" ]; then
+ if [ "${libc_mode}" = "startfiles" ]; then
CT_DoLog EXTRA "Installing C library headers"
- CT_DoExecLog ALL ${make} DESTDIR="${CT_SYSROOT_DIR}" install-headers
- fi
- if [ "${libc_startfiles}" = "y" ]; then
+ CT_DoExecLog ALL ${make} DESTDIR="${multi_root}" install-headers
CT_DoLog EXTRA "Building C library start files"
- CT_DoExecLog ALL ${make} DESTDIR="${CT_SYSROOT_DIR}" \
+ CT_DoExecLog ALL ${make} DESTDIR="${multi_root}" \
obj/crt/crt1.o obj/crt/crti.o obj/crt/crtn.o
CT_DoLog EXTRA "Installing C library start files"
- CT_DoExecLog ALL cp -av obj/crt/crt*.o "${CT_SYSROOT_DIR}/usr/lib"
+ CT_DoExecLog ALL cp -av obj/crt/crt*.o "${multi_root}${multilib_dir}"
CT_DoExecLog ALL ${CT_TARGET}-gcc -nostdlib \
- -nostartfiles -shared -x c /dev/null -o "${CT_SYSROOT_DIR}/usr/lib/libc.so"
+ -nostartfiles -shared -x c /dev/null -o "${multi_root}${multilib_dir}/libc.so"
fi
- if [ "${libc_full}" = "y" ]; then
+ if [ "${libc_mode}" = "final" ]; then
+ CT_DoLog EXTRA "Cleaning up start files"
+ CT_DoExecLog ALL rm -f "${multi_root}${multilib_dir}/crt1.o" \
+ "${multi_root}${multilib_dir}/crti.o" \
+ "${multi_root}${multilib_dir}/crtn.o" \
+ "${multi_root}${multilib_dir}/libc.so"
+
CT_DoLog EXTRA "Building C library"
CT_DoExecLog ALL ${make} ${JOBSFLAGS}
CT_DoLog EXTRA "Installing C library"
- CT_DoExecLog ALL ${make} DESTDIR="${CT_SYSROOT_DIR}" install
+ CT_DoExecLog ALL ${make} DESTDIR="${multi_root}" install
+
+ # Convert /lib/ld-* symlinks to relative paths so that they are valid
+ # both on the host and on the target.
+ for f in ${multi_root}/ld-musl-*; do
+ [ -L "${f}" ] || continue
+ l=$( readlink ${f} )
+ case "${l}" in
+ ${multilib_dir}/*)
+ CT_DoExecLog ALL ln -sf "../${l}" "${f}"
+ ;;
+ esac
+ done
fi
CT_EndStep
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index e70b669..d9bda06 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -38,10 +38,6 @@ do_libc_extract() {
fi
}
-do_libc_check_config() {
- :
-}
-
do_libc_start_files() {
CT_DoStep INFO "Installing C library headers & start files"
CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/include/." \
diff --git a/scripts/build/libc/none.sh b/scripts/build/libc/none.sh
index d4bf7dc..8537a8e 100644
--- a/scripts/build/libc/none.sh
+++ b/scripts/build/libc/none.sh
@@ -10,10 +10,6 @@ do_libc_extract() {
:
}
-do_libc_check_config() {
- :
-}
-
do_libc_start_files() {
:
}
diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh
index 422412c..47e135b 100644
--- a/scripts/build/libc/uClibc.sh
+++ b/scripts/build/libc/uClibc.sh
@@ -5,7 +5,7 @@
# This is a constant because it does not change very often.
# We're in 2010, and are still using data from 7 years ago.
uclibc_locales_version=030818
-uclibc_local_tarball="uClibc-locale-${uclibc_locales_version}"
+uclibc_locale_tarball="uClibc-locale-${uclibc_locales_version}"
if [ "${CT_LIBC_UCLIBC_NG}" = "y" ]; then
uclibc_name="uClibc-ng"
@@ -26,7 +26,7 @@ do_libc_get() {
fi
# uClibc locales
if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" ]; then
- CT_GetFile "${uclibc_local_tarball}" ${libc_src}
+ CT_GetFile "${uclibc_locale_tarball}" ${libc_src}
fi
return 0
@@ -41,196 +41,207 @@ do_libc_extract() {
# Extracting pregen locales ourselves is kinda
# broken, so just link it in place...
if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" \
- -a ! -f "${CT_SRC_DIR}/.${uclibc_local_tarball}.extracted" ]; then
+ -a ! -f "${CT_SRC_DIR}/.${uclibc_locale_tarball}.extracted" ]; then
CT_Pushd "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}/extra/locale"
- CT_DoExecLog ALL ln -s "${CT_TARBALLS_DIR}/${uclibc_local_tarball}.tgz" .
+ CT_DoExecLog ALL ln -s "${CT_TARBALLS_DIR}/${uclibc_locale_tarball}.tgz" .
CT_Popd
- touch "${CT_SRC_DIR}/.${uclibc_local_tarball}.extracted"
+ touch "${CT_SRC_DIR}/.${uclibc_locale_tarball}.extracted"
fi
return 0
}
-# Check that uClibc has been previously configured
-do_libc_check_config() {
- CT_DoStep INFO "Checking C library configuration"
+# Build and install headers and start files
+do_libc_start_files() {
+ # Start files and Headers should be configured the same way as the
+ # final libc, but built and installed differently.
+ do_libc_backend libc_mode=startfiles
+}
- # Use the default config if the user did not provide one.
- if [ -z "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
- CT_LIBC_UCLIBC_CONFIG_FILE="${CT_LIB_DIR}/contrib/uClibc-defconfigs/${uclibc_name}.config"
- fi
+# This function builds and install the full C library
+do_libc() {
+ do_libc_backend libc_mode=final
+}
- if ${grep} -E '^KERNEL_SOURCE=' "${CT_LIBC_UCLIBC_CONFIG_FILE}" >/dev/null 2>&1; then
- CT_DoLog WARN "Your uClibc version refers to the kernel _sources_, which is bad."
- CT_DoLog WARN "I can't guarantee that our little hack will work. Please try to upgrade."
- fi
+# Common backend for 1st and 2nd passes.
+do_libc_backend() {
+ local libc_mode
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ case "${libc_mode}" in
+ startfiles) CT_DoStep INFO "Installing C library headers & start files";;
+ final) CT_DoStep INFO "Installing C library";;
+ *) CT_Abort "Unsupported (or unset) libc_mode='${libc_mode}'";;
+ esac
- CT_DoLog EXTRA "Manage uClibc configuration"
- manage_uClibc_config "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_CONFIG_DIR}/uClibc.config"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-${libc_mode}"
+ CT_IterateMultilibs do_libc_backend_once multilib libc_mode="${libc_mode}"
+
+ CT_Popd
CT_EndStep
}
-# Build and install headers and start files
-do_libc_start_files() {
- local cross
+# Common backend for 1st and 2nd passes, once per multilib.
+do_libc_backend_once() {
+ local libc_mode
+ local multi_dir multi_os_dir multi_root multi_flags multi_index multi_count
+ local multilib_dir startfiles_dir
+ local jflag=${CT_LIBC_UCLIBC_PARALLEL:+${JOBSFLAGS}}
+ local -a make_args
+ local extra_cflags f cfg_cflags cf
+ local hdr_install_subdir
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
- CT_DoStep INFO "Installing C library headers"
+ CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'"
# Simply copy files until uClibc has the ability to build out-of-tree
CT_DoLog EXTRA "Copying sources to build dir"
- CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}" \
- "${CT_BUILD_DIR}/build-libc-headers"
- cd "${CT_BUILD_DIR}/build-libc-headers"
-
- # Retrieve the config file
- CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
-
- # uClibc uses the CROSS environment variable as a prefix to the
- # compiler tools to use. Setting it to the empty string forces
- # use of the native build host tools, which we need at this
- # stage, as we don't have target tools yet.
- # BUT! With NPTL, we need a cross-compiler (and we have it)
- if [ "${CT_THREADS}" = "nptl" ]; then
- cross="${CT_TARGET}-"
- fi
+ CT_DoExecLog ALL cp -aT "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}" .
+
+ multilib_dir="lib/${multi_os_dir}"
+ startfiles_dir="${multi_root}/usr/${multilib_dir}"
+ CT_SanitizeVarDir multilib_dir startfiles_dir
+
+ # Construct make arguments:
+ # - uClibc uses the CROSS environment variable as a prefix to the compiler
+ # tools to use. Since it requires core pass-1, thusly named compiler is
+ # already available.
+ # - Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak,
+ # depending on the configuration of the library. That is, they are tailored
+ # to best fit the target. So it is useless and seems to be a bad thing to
+ # use LIBC_EXTRA_CFLAGS here.
+ # - We do _not_ want to strip anything for now, in case we specifically
+ # asked for a debug toolchain, thus the STRIPTOOL= assignment.
+ make_args=( CROSS_COMPILE="${CT_TARGET}-" \
+ PREFIX="${multi_root}/" \
+ MULTILIB_DIR="${multilib_dir}" \
+ LOCALE_DATA_FILENAME="${uclibc_locale_tarball}.tgz" \
+ STRIPTOOL=true \
+ ${CT_LIBC_UCLIBC_VERBOSITY} \
+ )
# Force the date of the pregen locale data, as the
# newer ones that are referenced are not available
CT_DoLog EXTRA "Applying configuration"
- CT_DoYes "" |CT_DoExecLog ALL \
- ${make} CROSS_COMPILE="${cross}" \
- UCLIBC_EXTRA_CFLAGS="-pipe" \
- PREFIX="${CT_SYSROOT_DIR}/" \
- LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
- oldconfig
-
- CT_DoLog EXTRA "Building headers"
- CT_DoExecLog ALL \
- ${make} ${CT_LIBC_UCLIBC_VERBOSITY} \
- CROSS_COMPILE="${cross}" \
- UCLIBC_EXTRA_CFLAGS="-pipe" \
- PREFIX="${CT_SYSROOT_DIR}/" \
- LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
- headers
-
- CT_DoLog EXTRA "Installing headers"
- CT_DoExecLog ALL \
- ${make} ${CT_LIBC_UCLIBC_VERBOSITY} \
- CROSS_COMPILE="${cross}" \
- UCLIBC_EXTRA_CFLAGS="-pipe" \
- PREFIX="${CT_SYSROOT_DIR}/" \
- LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
- install_headers
-
- if [ "${CT_THREADS}" = "nptl" ]; then
- CT_DoLog EXTRA "Building start files"
- CT_DoExecLog ALL \
- ${make} ${CT_LIBC_UCLIBC_PARALLEL:+${JOBSFLAGS}} \
- CROSS_COMPILE="${cross}" \
- UCLIBC_EXTRA_CFLAGS="-pipe" \
- PREFIX="${CT_SYSROOT_DIR}/" \
- STRIPTOOL=true \
- ${CT_LIBC_UCLIBC_VERBOSITY} \
- LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
- lib/crt1.o lib/crti.o lib/crtn.o
-
- # From: http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=ad5668a7ac7e0436db92e55caaf3fdf782b6ba3b
- # libm.so is needed for ppc, as libgcc is linked against libm.so
- # No problem to create it for other archs.
- CT_DoLog EXTRA "Building dummy shared libs"
- CT_DoExecLog ALL "${cross}gcc" -nostdlib \
- -nostartfiles \
- -shared \
- -x c /dev/null \
- -o libdummy.so
-
- CT_DoLog EXTRA "Installing start files"
- CT_DoExecLog ALL ${install} -m 0644 lib/crt1.o lib/crti.o lib/crtn.o \
- "${CT_SYSROOT_DIR}/usr/lib"
-
- CT_DoLog EXTRA "Installing dummy shared libs"
- CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${CT_SYSROOT_DIR}/usr/lib/libc.so"
- CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${CT_SYSROOT_DIR}/usr/lib/libm.so"
- fi # CT_THREADS == nptl
- CT_EndStep
-}
+ # Use the default config if the user did not provide one.
+ if [ -z "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
+ CT_LIBC_UCLIBC_CONFIG_FILE="${CT_LIB_DIR}/contrib/uClibc-defconfigs/${uclibc_name}.config"
+ fi
-# This function build and install the full uClibc
-do_libc() {
- CT_DoStep INFO "Installing C library"
+ manage_uClibc_config "${CT_LIBC_UCLIBC_CONFIG_FILE}" .config "${multi_flags}"
+ CT_DoYes | CT_DoExecLog ALL ${make} "${make_args[@]}" oldconfig
+
+ # Now filter the multilib flags. manage_uClibc_config did the opposite of
+ # what Rules.mak in uClibc would do: by the multilib's CFLAGS, it determined
+ # the applicable configuration options. We don't want to pass the same options
+ # in the UCLIBC_EXTRA_CFLAGS again (on some targets, the options do not correctly
+ # override each other). On the other hand, we do not want to lose the options
+ # that are not reflected in the .config.
+ extra_cflags="-pipe"
+ { echo "include Rules.mak"; echo "show-cpu-flags:"; printf '\t@echo $(CPU_CFLAGS)\n'; } \
+ > .show-cpu-cflags.mk
+ cfg_cflags=$( ${make} "${make_args[@]}" \
+ --no-print-directory -f .show-cpu-cflags.mk show-cpu-flags )
+ CT_DoExecLog ALL rm -f .show-cpu-cflags.mk
+ CT_DoLog DEBUG "CPU_CFLAGS detected by uClibc: ${cfg_cflags[@]}"
+ for f in ${multi_flags}; do
+ for cf in ${cfg_cflags}; do
+ if [ "${f}" = "${cf}" ]; then
+ f=
+ break
+ fi
+ done
+ if [ -n "${f}" ]; then
+ extra_cflags+=" ${f}"
+ fi
+ done
+ CT_DoLog DEBUG "Filtered multilib CFLAGS: ${extra_cflags}"
+ make_args+=( UCLIBC_EXTRA_CFLAGS="${extra_cflags}" )
+
+ # uClibc does not have a way to select the installation subdirectory for headers,
+ # it is always $(DEVEL_PREFIX)/include. Also, we're reinstalling the headers
+ # at the final stage (see the note below), we may already have the subdirectory
+ # in /usr/include.
+ CT_DoArchUClibcHeaderDir hdr_install_subdir "${multi_flags}"
+ if [ -n "${hdr_install_subdir}" ]; then
+ CT_DoExecLog ALL cp -a "${multi_root}/usr/include" "${multi_root}/usr/include.saved"
+ fi
- # Simply copy files until uClibc has the ability to build out-of-tree
- CT_DoLog EXTRA "Copying sources to build dir"
- CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}" \
- "${CT_BUILD_DIR}/build-libc"
- cd "${CT_BUILD_DIR}/build-libc"
-
- # Retrieve the config file
- CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
-
- # uClibc uses the CROSS environment variable as a prefix to the compiler
- # tools to use. The newly built tools should be in our path, so we need
- # only give the correct name for them.
- # Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak,
- # depending on the configuration of the library. That is, they are tailored
- # to best fit the target. So it is useless and seems to be a bad thing to
- # use LIBC_EXTRA_CFLAGS here.
- CT_DoLog EXTRA "Applying configuration"
- CT_DoYes "" |CT_DoExecLog CFG \
- ${make} CROSS_COMPILE=${CT_TARGET}- \
- UCLIBC_EXTRA_CFLAGS="-pipe" \
- PREFIX="${CT_SYSROOT_DIR}/" \
- LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
- oldconfig
-
- # We do _not_ want to strip anything for now, in case we specifically
- # asked for a debug toolchain, thus the STRIPTOOL= assignment
- # /Old/ versions can not build in //
- CT_DoLog EXTRA "Building C library"
- CT_DoExecLog ALL \
- ${make} -j1 \
- CROSS_COMPILE=${CT_TARGET}- \
- UCLIBC_EXTRA_CFLAGS="-pipe" \
- PREFIX="${CT_SYSROOT_DIR}/" \
- STRIPTOOL=true \
- ${CT_LIBC_UCLIBC_VERBOSITY} \
- LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
- pregen
- CT_DoExecLog ALL \
- ${make} ${CT_LIBC_UCLIBC_PARALLEL:+${JOBSFLAGS}} \
- CROSS_COMPILE=${CT_TARGET}- \
- UCLIBC_EXTRA_CFLAGS="-pipe" \
- PREFIX="${CT_SYSROOT_DIR}/" \
- STRIPTOOL=true \
- ${CT_LIBC_UCLIBC_VERBOSITY} \
- LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
- all
-
- # YEM-FIXME:
- # - we want to install 'runtime' files, eg. lib*.{a,so*}, crti.o and
- # such files, except the headers as they already are installed
- # - "make install_dev" installs the headers, the crti.o... and the
- # static libs, but not the dynamic libs
- # - "make install_runtime" installs the dynamic libs only
- # - "make install" calls install_runtime and install_dev
- # - so we're left with re-installing the headers... Sigh...
- #
- # We do _not_ want to strip anything for now, in case we specifically
- # asked for a debug toolchain, hence the STRIPTOOL= assignment
- #
- # Note: JOBSFLAGS is not usefull for installation.
- #
- CT_DoLog EXTRA "Installing C library"
- CT_DoExecLog ALL \
- ${make} CROSS_COMPILE=${CT_TARGET}- \
- UCLIBC_EXTRA_CFLAGS="-pipe" \
- PREFIX="${CT_SYSROOT_DIR}/" \
- STRIPTOOL=true \
- ${CT_LIBC_UCLIBC_VERBOSITY} \
- LOCALE_DATA_FILENAME="${uclibc_local_tarball}.tgz" \
- install
+ if [ "${libc_mode}" = "startfiles" ]; then
+ CT_DoLog EXTRA "Building headers"
+ CT_DoExecLog ALL ${make} "${make_args[@]}" headers
+
+ # Ensure the directory for installing multilib-specific binaries exists.
+ CT_DoExecLog ALL mkdir -p "${startfiles_dir}"
+
+ CT_DoLog EXTRA "Installing headers"
+ CT_DoExecLog ALL ${make} "${make_args[@]}" install_headers
+
+ # The check might look bogus, but it is the same condition as is used
+ # by GCC build script to enable/disable shared library support.
+ if [ "${CT_THREADS}" = "nptl" ]; then
+ CT_DoLog EXTRA "Building start files"
+ CT_DoExecLog ALL ${make} ${jflag} "${make_args[@]}" \
+ lib/crt1.o lib/crti.o lib/crtn.o
+
+ # From: http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=ad5668a7ac7e0436db92e55caaf3fdf782b6ba3b
+ # libm.so is needed for ppc, as libgcc is linked against libm.so
+ # No problem to create it for other archs.
+ CT_DoLog EXTRA "Building dummy shared libs"
+ CT_DoExecLog ALL "${CT_TARGET}-gcc" -nostdlib -nostartfiles \
+ -shared ${multi_flags} -x c /dev/null -o libdummy.so
+
+ CT_DoLog EXTRA "Installing start files"
+ CT_DoExecLog ALL ${install} -m 0644 lib/crt1.o lib/crti.o lib/crtn.o \
+ "${startfiles_dir}"
+
+ CT_DoLog EXTRA "Installing dummy shared libs"
+ CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${startfiles_dir}/libc.so"
+ CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${startfiles_dir}/libm.so"
+ fi # CT_THREADS == nptl
+ fi # libc_mode == startfiles
+
+ if [ "${libc_mode}" = "final" ]; then
+ CT_DoLog EXTRA "Cleaning up startfiles"
+ CT_DoExecLog ALL rm -f "${startfiles_dir}/crt1.o" \
+ "${startfiles_dir}/crti.o" \
+ "${startfiles_dir}/crtn.o" \
+ "${startfiles_dir}/libc.so" \
+ "${startfiles_dir}/libm.so"
+
+ CT_DoLog EXTRA "Building C library"
+ CT_DoExecLog ALL ${make} "${make_args[@]}" pregen
+ CT_DoExecLog ALL ${make} ${jflag} "${make_args[@]}" all
+
+ # YEM-FIXME:
+ # - we want to install 'runtime' files, eg. lib*.{a,so*}, crti.o and
+ # such files, except the headers as they already are installed
+ # - "make install_dev" installs the headers, the crti.o... and the
+ # static libs, but not the dynamic libs
+ # - "make install_runtime" installs the dynamic libs only
+ # - "make install" calls install_runtime and install_dev
+ # - so we're left with re-installing the headers... Sigh...
+ CT_DoLog EXTRA "Installing C library"
+ CT_DoExecLog ALL ${make} "${make_args[@]}" install install_utils
+ fi # libc_mode == final
+
+ # Now, if installing headers into a subdirectory, put everything in its place.
+ # Remove the header subdirectory if it existed already.
+ if [ -n "${hdr_install_subdir}" ]; then
+ CT_DoExecLog ALL mv "${multi_root}/usr/include" "${multi_root}/usr/include.new"
+ CT_DoExecLog ALL mv "${multi_root}/usr/include.saved" "${multi_root}/usr/include"
+ CT_DoExecLog ALL rm -rf "${multi_root}/usr/include/${hdr_install_subdir}"
+ CT_DoExecLog ALL mv "${multi_root}/usr/include.new" "${multi_root}/usr/include/${hdr_install_subdir}"
+ fi
CT_EndStep
}
@@ -241,98 +252,11 @@ do_libc() {
manage_uClibc_config() {
src="$1"
dst="$2"
+ flags="$3"
# Start with fresh files
- CT_DoExecLog ALL rm -f "${dst}"
- CT_DoExecLog ALL mkdir -p "$(dirname ${dst})"
CT_DoExecLog ALL cp "${src}" "${dst}"
- # Hack our target in the config file.
- case "${CT_ARCH}:${CT_ARCH_BITNESS}" in
- x86:32) arch=i386;;
- x86:64) arch=x86_64;;
- sh:32) arch="sh";;
- *) arch="${CT_ARCH}";;
- esac
- # Also remove stripping: its the responsibility of the
- # firmware builder to strip or not.
- ${sed} -i -r -e '/^TARGET_.*/d' "${dst}"
- CT_KconfigEnableOption "TARGET_${arch}" "${dst}"
- CT_KconfigSetOption "TARGET_ARCH" "${arch}" "${dst}"
- CT_KconfigDisableOption "DOSTRIP" "${dst}"
-
- # Ah. We may one day need architecture-specific handler here...
- case "${arch}" in
- arm*)
- if [ "${CT_ARCH_ARM_EABI}" = "y" ]; then
- CT_KconfigDisableOption "CONFIG_ARM_OABI" "${dst}"
- CT_KconfigEnableOption "CONFIG_ARM_EABI" "${dst}"
- else
- CT_KconfigDisableOption "CONFIG_ARM_EABI" "${dst}"
- CT_KconfigEnableOption "CONFIG_ARM_OABI" "${dst}"
- fi
- ;;
- i386)
- # FIXME This doesn't cover all cases of x86_32...
- case ${CT_TARGET_ARCH} in
- i386)
- CT_KconfigEnableOption "CONFIG_386" "${dst}"
- ;;
- i486)
- CT_KconfigEnableOption "CONFIG_486" "${dst}"
- ;;
- i586)
- CT_KconfigEnableOption "CONFIG_586" "${dst}"
- ;;
- i686)
- CT_KconfigEnableOption "CONFIG_686" "${dst}"
- ;;
- esac
- ;;
- mips*)
- CT_KconfigDisableOption "CONFIG_MIPS_O32_ABI" "${dst}"
- CT_KconfigDisableOption "CONFIG_MIPS_N32_ABI" "${dst}"
- CT_KconfigDisableOption "CONFIG_MIPS_N64_ABI" "${dst}"
- CT_KconfigDeleteOption "CONFIG_MIPS_ISA_1" "${dst}"
- CT_KconfigDeleteOption "CONFIG_MIPS_ISA_2" "${dst}"
- CT_KconfigDeleteOption "CONFIG_MIPS_ISA_3" "${dst}"
- CT_KconfigDeleteOption "CONFIG_MIPS_ISA_4" "${dst}"
- CT_KconfigDeleteOption "CONFIG_MIPS_ISA_MIPS32" "${dst}"
- CT_KconfigDeleteOption "CONFIG_MIPS_ISA_MIPS32R2" "${dst}"
- CT_KconfigDeleteOption "CONFIG_MIPS_ISA_MIPS64" "${dst}"
- CT_KconfigDeleteOption "CONFIG_MIPS_ISA_MIPS64R2" "${dst}"
- case "${CT_ARCH_mips_ABI}" in
- 32)
- CT_KconfigEnableOption "CONFIG_MIPS_O32_ABI" "${dst}"
- ;;
- n32)
- CT_KconfigEnableOption "CONFIG_MIPS_N32_ABI" "${dst}"
- ;;
- 64)
- CT_KconfigEnableOption "CONFIG_MIPS_N64_ABI" "${dst}"
- ;;
- esac
- ;;
- powerpc*)
- CT_KconfigDisableOption "CONFIG_E500" "${dst}"
- CT_KconfigDisableOption "CONFIG_CLASSIC" "${dst}"
- CT_KconfigDeleteOption "TARGET_SUBARCH" "${dst}"
- if [ "${CT_ARCH_powerpc_ABI}" = "spe" ]; then
- CT_KconfigEnableOption "CONFIG_E500" "${dst}"
- CT_KconfigSetOption "TARGET_SUBARCH" "e500" "${dst}"
- else
- CT_KconfigEnableOption "CONFIG_CLASSIC" "${dst}"
- CT_KconfigSetOption "TARGET_SUBARCH" "classic" "${dst}"
- fi
- ;;
- sh)
- # all we really support right now is sh4:32
- CT_KconfigEnableOption "CONFIG_SH4" "${dst}"
- ;;
- esac
-
- # Accomodate for old and new uClibc versions, where the
- # way to select between big/little endian has changed
case "${CT_ARCH_ENDIAN}" in
big)
CT_KconfigDisableOption "ARCH_LITTLE_ENDIAN" "${dst}"
@@ -348,14 +272,18 @@ manage_uClibc_config() {
;;
esac
- # Accomodate for old and new uClibc versions, where the
- # MMU settings has different config knobs
if [ "${CT_ARCH_USE_MMU}" = "y" ]; then
CT_KconfigEnableOption "ARCH_USE_MMU" "${dst}"
else
CT_KconfigDisableOption "ARCH_USE_MMU" "${dst}"
fi
+ if [ "${CT_SHARED_LIBS}" = "y" ]; then
+ CT_KconfigEnableOption "HAVE_SHARED" "${dst}"
+ else
+ CT_KconfigDisableOption "HAVE_SHARED" "${dst}"
+ fi
+
# Accomodate for old and new uClibc version, where the
# way to select between hard/soft float has changed
case "${CT_ARCH_FLOAT}" in
@@ -382,7 +310,6 @@ manage_uClibc_config() {
# which is the correct value of ${PREFIX}/${TARGET}.
CT_KconfigSetOption "DEVEL_PREFIX" "\"/usr/\"" "${dst}"
CT_KconfigSetOption "RUNTIME_PREFIX" "\"/\"" "${dst}"
- CT_KconfigSetOption "SHARED_LIB_LOADER_PREFIX" "\"/lib/\"" "${dst}"
CT_KconfigSetOption "KERNEL_HEADERS" "\"${CT_HEADERS_DIR}\"" "${dst}"
# Locales support
@@ -443,29 +370,23 @@ manage_uClibc_config() {
fi
# Push the threading model
+ CT_KconfigDisableOption "UCLIBC_HAS_THREADS" "${dst}"
+ CT_KconfigDisableOption "LINUXTHREADS_OLD" "${dst}"
+ CT_KconfigDisableOption "LINUXTHREADS_NEW" "${dst}"
+ CT_KconfigDisableOption "UCLIBC_HAS_THREADS_NATIVE" "${dst}"
case "${CT_THREADS}:${CT_LIBC_UCLIBC_LNXTHRD}" in
none:)
- CT_KconfigDisableOption "UCLIBC_HAS_THREADS" "${dst}"
- CT_KconfigDisableOption "LINUXTHREADS_OLD" "${dst}"
- CT_KconfigDisableOption "LINUXTHREADS_NEW" "${dst}"
- CT_KconfigDisableOption "UCLIBC_HAS_THREADS_NATIVE" "${dst}"
;;
linuxthreads:old)
CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}"
CT_KconfigEnableOption "LINUXTHREADS_OLD" "${dst}"
- CT_KconfigDisableOption "LINUXTHREADS_NEW" "${dst}"
- CT_KconfigDisableOption "UCLIBC_HAS_THREADS_NATIVE" "${dst}"
;;
linuxthreads:new)
CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}"
- CT_KconfigDisableOption "LINUXTHREADS_OLD" "${dst}"
CT_KconfigEnableOption "LINUXTHREADS_NEW" "${dst}"
- CT_KconfigDisableOption "UCLIBC_HAS_THREADS_NATIVE" "${dst}"
;;
nptl:)
CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}"
- CT_KconfigDisableOption "LINUXTHREADS_OLD" "${dst}"
- CT_KconfigDisableOption "LINUXTHREADS_NEW" "${dst}"
CT_KconfigEnableOption "UCLIBC_HAS_THREADS_NATIVE" "${dst}"
;;
*)
@@ -477,29 +398,22 @@ manage_uClibc_config() {
CT_KconfigEnableOption "PTHREADS_DEBUG_SUPPORT" "${dst}"
# Force on debug options if asked for
+ CT_KconfigDisableOption "DODEBUG" "${dst}"
+ CT_KconfigDisableOption "DODEBUG_PT" "${dst}"
+ CT_KconfigDisableOption "DOASSERTS" "${dst}"
+ CT_KconfigDisableOption "SUPPORT_LD_DEBUG" "${dst}"
+ CT_KconfigDisableOption "SUPPORT_LD_DEBUG_EARLY" "${dst}"
+ CT_KconfigDisableOption "UCLIBC_MALLOC_DEBUGGING" "${dst}"
case "${CT_LIBC_UCLIBC_DEBUG_LEVEL}" in
0)
- CT_KconfigDisableOption "DODEBUG" "${dst}"
- CT_KconfigDisableOption "DODEBUG_PT" "${dst}"
- CT_KconfigDisableOption "DOASSERTS" "${dst}"
- CT_KconfigDisableOption "SUPPORT_LD_DEBUG" "${dst}"
- CT_KconfigDisableOption "SUPPORT_LD_DEBUG_EARLY" "${dst}"
- CT_KconfigDisableOption "UCLIBC_MALLOC_DEBUGGING" "${dst}"
;;
1)
CT_KconfigEnableOption "DODEBUG" "${dst}"
- CT_KconfigDisableOption "DODEBUG_PT" "${dst}"
- CT_KconfigDisableOption "DOASSERTS" "${dst}"
- CT_KconfigDisableOption "SUPPORT_LD_DEBUG" "${dst}"
- CT_KconfigDisableOption "SUPPORT_LD_DEBUG_EARLY" "${dst}"
- CT_KconfigDisableOption "UCLIBC_MALLOC_DEBUGGING" "${dst}"
;;
2)
CT_KconfigEnableOption "DODEBUG" "${dst}"
- CT_KconfigDisableOption "DODEBUG_PT" "${dst}"
CT_KconfigEnableOption "DOASSERTS" "${dst}"
CT_KconfigEnableOption "SUPPORT_LD_DEBUG" "${dst}"
- CT_KconfigDisableOption "SUPPORT_LD_DEBUG_EARLY" "${dst}"
CT_KconfigEnableOption "UCLIBC_MALLOC_DEBUGGING" "${dst}"
;;
3)
@@ -511,8 +425,69 @@ manage_uClibc_config() {
CT_KconfigEnableOption "UCLIBC_MALLOC_DEBUGGING" "${dst}"
;;
esac
+
+ # Remove stripping: its the responsibility of the
+ # firmware builder to strip or not.
+ CT_KconfigDisableOption "DOSTRIP" "${dst}"
+
+ # Now allow architecture to tweak as it wants
+ CT_DoArchUClibcConfig "${dst}"
+ CT_DoArchUClibcCflags "${dst}" "${flags}"
}
do_libc_post_cc() {
- :
+ # uClibc and GCC disagree where the dynamic linker lives. uClibc always
+ # places it in the MULTILIB_DIR, while gcc does that for *some* variants
+ # and expects it in /lib for the other. So, create a symlink from lib
+ # to the actual location, but only if that will not override the actual
+ # file in /lib. Thus, need to do this after all the variants are built.
+ # Moreover, need to do this after the final compiler is built: on targets
+ # that use elf2flt, the core compilers cannot find ld when running elf2flt.
+ CT_DoStep INFO "Checking dynamic linker symlinks"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-post_cc"
+ echo "int main(void) { return 0; }" > test-ldso.c
+ CT_IterateMultilibs do_libc_ldso_fixup ldso_fixup
+ CT_Popd
+ CT_EndStep
+}
+
+do_libc_ldso_fixup() {
+ local multi_dir multi_os_dir multi_root multi_flags multi_index multi_count
+ local binary
+ local ldso ldso_f ldso_d multilib_dir
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ CT_DoLog EXTRA "Checking dynamic linker for multilib '${multi_flags}'"
+
+ multilib_dir="/lib/${multi_os_dir}"
+ CT_SanitizeVarDir multilib_dir
+
+ CT_DoExecLog ALL "${CT_TARGET}-gcc" -o test-ldso ../test-ldso.c ${multi_flags}
+ if [ -r "test-ldso.gdb" ]; then
+ binary="test-ldso.gdb"
+ else
+ binary="test-ldso"
+ fi
+ if ${CT_TARGET}-readelf -Wl "${binary}" | grep -q 'Requesting program interpreter: '; then
+ ldso=$( ${CT_TARGET}-readelf -Wl "${binary}" | \
+ grep 'Requesting program interpreter: ' | \
+ sed -e 's,.*: ,,' -e 's,\].*,,' )
+ fi
+ CT_DoLog DEBUG "Detected dynamic linker for multilib '${multi_flags}': '${ldso}'"
+
+ ldso_d="${ldso%/ld*.so.*}"
+ ldso_f="${ldso##*/}"
+ # Create symlink if GCC produced an executable, dynamically linked, it was requesting
+ # a linker not in the current directory, and there is no such file in the expected
+ # ldso dir.
+ if [ -n "${ldso}" -a "${ldso_d}" != "${multilib_dir}" -a ! -r "${multi_root}${ldso}" ]; then
+ # Convert ldso_d to "how many levels we need to go up" and remove
+ # leading slash.
+ ldso_d=$( echo "${ldso_d#/}" | sed 's,[^/]\+,..,g' )
+ CT_DoExecLog ALL ln -sf "${ldso_d}${multilib_dir}/${ldso_f}" \
+ "${multi_root}${ldso}"
+ fi
}
diff --git a/scripts/config.guess b/scripts/config.guess
index 373a659..c4bd827 100755
--- a/scripts/config.guess
+++ b/scripts/config.guess
@@ -2,7 +2,7 @@
# Attempt to guess a canonical system name.
# Copyright 1992-2016 Free Software Foundation, Inc.
-timestamp='2016-02-11'
+timestamp='2016-05-15'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -186,9 +186,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
+ # to ELF recently (or will in the future) and ABI.
case "${UNAME_MACHINE_ARCH}" in
- arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ earm*)
+ os=netbsdelf
+ ;;
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
@@ -386,7 +389,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH=x86_64
@@ -684,7 +687,7 @@ EOF
exit (0);
}
EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
@@ -701,7 +704,7 @@ EOF
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH=hppa2.0w
@@ -900,7 +903,7 @@ EOF
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
@@ -1276,6 +1279,9 @@ EOF
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
+ SX-ACE:SUPER-UX:*:*)
+ echo sxace-nec-superux${UNAME_RELEASE}
+ exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
@@ -1291,7 +1297,7 @@ EOF
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
@@ -1386,7 +1392,7 @@ EOF
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
@@ -1405,18 +1411,17 @@ esac
cat >&2 <<EOF
$0: unable to guess system type
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
config.guess timestamp = $timestamp
diff --git a/scripts/config.sub b/scripts/config.sub
index 6223dde..9feb73b 100755
--- a/scripts/config.sub
+++ b/scripts/config.sub
@@ -2,7 +2,7 @@
# Configuration validation subroutine script.
# Copyright 1992-2016 Free Software Foundation, Inc.
-timestamp='2016-01-01'
+timestamp='2016-06-20'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -643,6 +643,14 @@ case $basic_machine in
basic_machine=m68k-bull
os=-sysv3
;;
+ e500v[12])
+ basic_machine=powerpc-unknown
+ os=$os"spe"
+ ;;
+ e500v[12]-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=$os"spe"
+ ;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
@@ -1389,7 +1397,7 @@ case $os in
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
@@ -1399,7 +1407,7 @@ case $os in
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
- | -onefs* | -tirtos*)
+ | -onefs* | -tirtos* | -phoenix*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1531,6 +1539,8 @@ case $os in
;;
-nacl*)
;;
+ -ios)
+ ;;
-none)
;;
*)
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index 3c193c3..3d7b91a 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -141,7 +141,7 @@ CT_DoLog INFO "Building environment variables"
# Include sub-scripts instead of calling them: that way, we do not have to
# export any variable, nor re-parse the configuration and functions files.
. "${CT_LIB_DIR}/scripts/build/internals.sh"
-. "${CT_LIB_DIR}/scripts/build/arch/${CT_ARCH}.sh"
+. "${CT_LIB_DIR}/scripts/build/arch.sh"
. "${CT_LIB_DIR}/scripts/build/companion_tools.sh"
. "${CT_LIB_DIR}/scripts/build/kernel/${CT_KERNEL}.sh"
. "${CT_LIB_DIR}/scripts/build/companion_libs.sh"
@@ -181,7 +181,6 @@ CT_SRC_DIR="${CT_WORK_DIR}/src"
CT_BUILD_DIR="${CT_WORK_DIR}/${CT_TARGET}/build"
CT_BUILDTOOLS_PREFIX_DIR="${CT_WORK_DIR}/${CT_TARGET}/buildtools"
CT_STATE_DIR="${CT_WORK_DIR}/${CT_TARGET}/state"
-CT_CONFIG_DIR="${CT_BUILD_DIR}/configs"
# Note about HOST_COMPLIBS_DIR: it's always gonna be in the buildtools dir, or a
# sub-dir. So we won't have to save/restore it, not even create it.
# In case of cross or native, host-complibs are used for build-complibs;
@@ -266,7 +265,6 @@ CT_DoExecLog ALL mkdir -p "${CT_TARBALLS_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_SRC_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_BUILD_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
-CT_DoExecLog ALL mkdir -p "${CT_CONFIG_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_INSTALL_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_HOST_COMPLIBS_DIR}"
@@ -292,13 +290,13 @@ if [ -z "${CT_RESTART}" ]; then
*/*) CT_Abort "Sysroot name contains forbidden slash(es): '${CT_SYSROOT_NAME}'";;
esac
- # Arrange paths depending on wether we use sysroot or not.
+ # Arrange paths depending on whether we use sysroot or not.
if [ "${CT_USE_SYSROOT}" = "y" ]; then
CT_SYSROOT_REL_DIR="${CT_SYSROOT_DIR_PREFIX:+${CT_SYSROOT_DIR_PREFIX}/}${CT_SYSROOT_NAME}"
CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_REL_DIR}"
CT_DEBUGROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}/${CT_SYSROOT_DIR_PREFIX}/debug-root"
CT_HEADERS_DIR="${CT_SYSROOT_DIR}/usr/include"
- CT_SanitiseVarDir CT_SYSROOT_REL_DIR CT_SYSROOT_DIR CT_DEBUGROOT_DIR CT_HEADERS_DIR
+ CT_SanitizeVarDir CT_SYSROOT_REL_DIR CT_SYSROOT_DIR CT_DEBUGROOT_DIR CT_HEADERS_DIR
BINUTILS_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
CC_CORE_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
CC_SYSROOT_ARG="--with-sysroot=${CT_SYSROOT_DIR}"
@@ -312,7 +310,7 @@ if [ -z "${CT_RESTART}" ]; then
CT_SYSROOT_DIR="${CT_PREFIX_DIR}/${CT_TARGET}"
CT_DEBUGROOT_DIR="${CT_SYSROOT_DIR}"
CT_HEADERS_DIR="${CT_SYSROOT_DIR}/include"
- CT_SanitiseVarDir CT_SYSROOT_DIR CT_DEBUGROOT_DIR CT_HEADERS_DIR
+ CT_SanitizeVarDir CT_SYSROOT_DIR CT_DEBUGROOT_DIR CT_HEADERS_DIR
# hack! Always use --with-sysroot for binutils.
# binutils 2.14 and later obey it, older binutils ignore it.
# Lets you build a working 32->64 bit cross gcc
@@ -325,40 +323,14 @@ if [ -z "${CT_RESTART}" ]; then
fi
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}"
CT_DoExecLog ALL mkdir -p "${CT_DEBUGROOT_DIR}"
+ CT_DoExecLog ALL mkdir -p "${CT_HEADERS_DIR}"
- # Prepare the 'lib' directories in sysroot, else the ../lib64 hack used by
- # 32 -> 64 bit crosscompilers won't work, and build of final gcc will fail
- # with: "ld: cannot open crti.o: No such file or directory"
- # Also prepare the lib directory in the install dir, else some 64 bit archs
- # won't build
+ # Need the non-multilib directories: GCC's multi-os-directory is based off them, so
+ # even if the /lib is not used for any of the multilibs, it must be present so that
+ # the paths like 'lib/../lib64' still work.
CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}/lib"
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/lib"
CT_DoExecLog ALL mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
- CT_DoExecLog ALL mkdir -p "${CT_HEADERS_DIR}"
-
- if [ "${CT_USE_SYSROOT}" = "y" ]; then
- # Prevent gcc from installing its libraries outside of the sysroot
- CT_Pushd "${CT_PREFIX_DIR}/${CT_TARGET}"
- CT_DoExecLog ALL ln -sf "${CT_SYSROOT_REL_DIR}/lib" "lib"
- CT_Popd
- fi
-
- # Since we're *not* multilib on the target side, we want all the
- # libraries to end up in "lib". We create "lib64" (for 64-bit
- # build or host architectures) and "lib32" (for 32-bit emulation
- # on 64-bit) as symlinks to "lib".
- #
- # Not all of these symlinks are necessary, but better safe than
- # sorry. They are summarily removed by build/internals.sh:do_finish.
- for d in \
- "${CT_PREFIX_DIR}" \
- "${CT_SYSROOT_DIR}" \
- "${CT_SYSROOT_DIR}/usr" \
- "${CT_PREFIX_DIR}/${CT_TARGET}" \
- ; do
- CT_DoExecLog ALL ln -sf "lib" "${d}/lib32"
- CT_DoExecLog ALL ln -sf "lib" "${d}/lib64"
- done
# Determine build system if not set by the user
if [ -z "${CT_BUILD}" ]; then
@@ -373,7 +345,7 @@ if [ -z "${CT_RESTART}" ]; then
build_mangle="build_"
host_mangle="build_"
target_mangle=""
- install_build_tools_for="BUILD HOST"
+ install_build_tools_for="BUILD"
;;
canadian)
build_mangle="build_"
@@ -500,7 +472,7 @@ if [ -z "${CT_RESTART}" ]; then
CT_CFLAGS_FOR_BUILD+=" ${CT_EXTRA_CFLAGS_FOR_BUILD}"
CT_LDFLAGS_FOR_BUILD=
CT_LDFLAGS_FOR_BUILD+=" ${CT_EXTRA_LDFLAGS_FOR_BUILD}"
-
+
# Help host gcc
# Explicitly optimise, else the lines below will overide the
# package's default optimisation flags
@@ -654,6 +626,14 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
# sub-shell ending with !0. bash-3 does not, while bash-4 does,
# so the following line is for bash-3; bash-4 would choke above.
[ $? -eq 0 ]
+ # Pick up environment changes.
+ if [ -r "${CT_BUILD_DIR}/env.modify.sh" ]; then
+ CT_DoLog DEBUG "Step '${step}' modified the environment:"
+ CT_DoExecLog DEBUG cat "${CT_BUILD_DIR}/env.modify.sh"
+ . "${CT_BUILD_DIR}/env.modify.sh"
+ CT_DoExecLog DEBUG rm -f "${CT_BUILD_DIR}/env.modify.sh"
+
+ fi
if [ "${CT_STOP}" = "${step}" ]; then
do_stop=1
fi
diff --git a/scripts/functions b/scripts/functions
index 62d264e..3717ffd 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1,6 +1,6 @@
# -*- mode: sh; tab-width: 4 -*-
# vi: ts=4:sw=4:sts=4:et
-# This file contains some usefull common functions
+# This file contains some useful common functions
# Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package
@@ -308,21 +308,57 @@ CT_SanitizePath() {
PATH="${new}"
}
-# Sanitise the directory name contained in the variable passed as argument:
+# Sanitize the directory name contained in the variable passed as argument:
# - remove duplicate /
-# Usage: CT_SanitiseVarDir CT_PREFIX_DIR
-CT_SanitiseVarDir() {
+# - remove . (current dir) at the beginning, in the middle or at the end
+# - resolve .. (parent dir) if there is a previous component
+# - remove .. (parent dir) if at the root
+#
+# Usage: CT_SanitizeVarDir CT_PREFIX_DIR
+CT_SanitizeVarDir() {
local var
local old_dir
- local new_dir
+ local new_dir tmp
for var in "$@"; do
eval "old_dir=\"\${${var}}\""
- new_dir="$( printf "${old_dir}" \
- |${sed} -r -e 's:/+:/:g;' \
- )"
+ new_dir=$( echo "${old_dir}" | ${awk} '
+{
+ isabs = $1 == "" # Started with a slash
+ trail = $NF == "" # Ending with a slash
+ ncomp = 0 # Components in a path so far
+ for (i = 1; i <= NF; i++) {
+ # Double-slash or current dir? Ignore
+ if ($i == "" || $i == ".") {
+ continue;
+ }
+ # .. pops the last component unless it is at the beginning
+ if ($i == ".." && ncomp != 0 && comps[ncomp] != "..") {
+ ncomp--;
+ continue;
+ }
+ comps[++ncomp] = $i;
+ }
+ seencomp = 0
+ for (i = 1; i <= ncomp; i++) {
+ if (comps[i] == ".." && isabs) {
+ # /../ at the beginning is equivalent to /
+ continue;
+ }
+ printf "%s%s", isabs || i != 1 ? "/" : "", comps[i];
+ seencomp = 1;
+ }
+ if (!seencomp && !isabs && !trail) {
+ # Eliminated all components, but no trailing slash -
+ # if the result is appened with /foo, must not become absolute
+ printf ".";
+ }
+ if ((!seencomp && isabs) || (seencomp && trail)) {
+ printf "/";
+ }
+}' FS=/ )
eval "${var}=\"${new_dir}\""
- CT_DoLog DEBUG "Sanitised '${var}': '${old_dir}' -> '${new_dir}'"
+ CT_DoLog DEBUG "Sanitized '${var}': '${old_dir}' -> '${new_dir}'"
done
}
@@ -928,7 +964,7 @@ CT_GetGit() {
else
# Woops...
CT_DoExecLog ALL rm -rf "${dir}"
- CT_DoLog Debug "Could not clone '${basename}'"
+ CT_DoLog DEBUG "Could not clone '${basename}'"
return 1
fi
}
@@ -1183,6 +1219,14 @@ CT_DoConfigSub() {
fi
}
+# Normally, each step is executed in a sub-shell and thus cannot modify the
+# environment for the next step(s). When this is needed, it can do so by
+# invoking this function.
+# Usage: CT_EnvModify VAR VALUE
+CT_EnvModify() {
+ echo "${1}=\"${2}\"" >> "${CT_BUILD_DIR}/env.modify.sh"
+}
+
# Compute the target tuple from what is provided by the user
# Usage: CT_DoBuildTargetTuple
# In fact this function takes the environment variables to build the target
@@ -1303,25 +1347,23 @@ CT_DoBuildTargetTuple() {
# Now on for the target LDFLAGS
CT_ARCH_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_ARCH_ENDIAN_LDFLAG}"
-}
-# This function determines the target tuple for a given set of compiler
-# flags, using either GCC's multiarch feature (if supported; if not,
-# GCC prints nothing and exits with status 0), falling back to calling
-# the architecture-specific functions.
-CT_DoMultilibTarget() {
- local target="$1"; shift
- local -a multi_flags=( "$@" )
- local gcc_multiarch
-
- gcc_multiarch=$( "${CT_TARGET}-gcc" -print-multiarch "${multi_flags[@]}" )
- if [ -n "${gcc_multiarch}" ]; then
- echo "${gcc_multiarch}"
- return
+ # Now, a multilib quirk. We may not be able to pass CT_ARCH_TARGET_CFLAGS
+ # and CT_ARCH_TARGET_LDFLAGS to gcc: even though GCC build appends the multilib
+ # flags afterwards, on some architectures the build breaks because some
+ # flags do not completely override each other. For example, on mips target,
+ # 'gcc -mabi=32' and 'gcc -mabi=n32' both work, but 'gcc -mabi=32 -mabi=n32'
+ # triggers an internal linker error. Likely a bug in GNU binutils, but we
+ # have to work it around for now: *do not pass the CT_ARCH_TARGET_ flags*.
+ # Instead, save them into a different variable here. Then, after the first
+ # core pass, we'll know which of them vary with multilibs (i.e. must be
+ # filtered out).
+ if [ "${CT_MULTILIB}" = "y" ]; then
+ CT_ARCH_TARGET_CFLAGS_MULTILIB="${CT_ARCH_TARGET_CFLAGS}"
+ CT_ARCH_TARGET_CFLAGS=
+ CT_ARCH_TARGET_LDFLAGS_MULTILIB="${CT_ARCH_TARGET_LDFLAGS}"
+ CT_ARCH_TARGET_LDFLAGS=
fi
-
- # Fall back to arch-specific guesswork
- CT_DoArchMultilibTarget "${target}" "${multi_flags[@]}"
}
# This function does pause the build until the user strikes "Return"
@@ -1413,7 +1455,6 @@ CT_DoSaveState() {
/^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh"
CT_DoTarballIfExists "${CT_BUILDTOOLS_PREFIX_DIR}" "${state_dir}/buildtools_dir"
- CT_DoTarballIfExists "${CT_CONFIG_DIR}" "${state_dir}/config_dir"
CT_DoTarballIfExists "${CT_PREFIX_DIR}" "${state_dir}/prefix_dir" --exclude '*.log'
CT_DoLog STATE " Saving log file"
@@ -1443,7 +1484,6 @@ CT_DoLoadState(){
CT_DoLog INFO "Restoring state at step '${state_name}', as requested."
CT_DoExtractTarballIfExists "${state_dir}/prefix_dir" "${CT_PREFIX_DIR}"
- CT_DoExtractTarballIfExists "${state_dir}/config_dir" "${CT_CONFIG_DIR}"
CT_DoExtractTarballIfExists "${state_dir}/buildtools_dir" "${CT_BUILDTOOLS_PREFIX_DIR}"
# Restore the environment, discarding any error message
@@ -1470,9 +1510,9 @@ CT_DoLoadState(){
# This function sets a kconfig option to a specific value in a .config file
# Usage: CT_KconfigSetOption <option> <value> <file>
CT_KconfigSetOption() {
- option="$1"
- value="$2"
- file="$3"
+ local option="$1"
+ local value="$2"
+ local file="$3"
${grep} -E -q "^${option}=.*" "${file}" && \
${sed} -i -r -e "s;^${option}=.*$;${option}=${value};" "${file}" || \
@@ -1484,8 +1524,8 @@ CT_KconfigSetOption() {
# This function enables a kconfig option to '=y' in a .config file
# Usage: CT_KconfigEnableOption <option> <file>
CT_KconfigEnableOption() {
- option="$1"
- file="$2"
+ local option="$1"
+ local file="$2"
CT_KconfigSetOption "${option}" "y" "${file}"
}
@@ -1493,8 +1533,8 @@ CT_KconfigEnableOption() {
# This function disables a kconfig option in a .config file
# Usage: CT_KconfigDisableOption <option> <file>
CT_KconfigDisableOption() {
- option="${1}"
- file="${2}"
+ local option="${1}"
+ local file="${2}"
${grep} -E -q "^# ${option} is not set$" "${file}" || \
${grep} -E -q "^${option}=.*$" "${file}" && \
@@ -1506,11 +1546,125 @@ CT_KconfigDisableOption() {
# is set or commented out.
# Usage: CT_KconfigDeleteOption <option> <file>
CT_KconfigDeleteOption() {
- option="${1}"
- file="${2}"
+ local option="${1}"
+ local file="${2}"
${grep} -E -q "^# ${option} is not set$" "${file}" && \
${sed} -i -r -e "/^# ${option} is not set$/d" "${file}" || \
${grep} -E -q "^${option}=.*$" "${file}" && \
${sed} -i -r -e "/^${option}=.*$/d" "${file}" || true
}
+
+# Multilib iterator. The caller should be in a directory where the directories
+# will be created, one per multilib, and the specified command will be run in
+# each of them. The following arguments will be passed to the invoked command:
+# multi_flags CFLAGS for this multilib
+# multi_dir GCC internal library location for the multilib
+# multi_os_dir OS library location for the multilib
+# multi_root Sysroot for this multilib
+# multi_target Target tuple, either as reported by GCC or by our guesswork
+# multi_count Total number of multilibs
+# multi_index Index of the current multilib
+# Any additional arguments passed to this function will be forwarded to the called
+# function as well.
+# Usage: CT_IterateMultilibs <function> <prefix> <additional-args...>
+CT_IterateMultilibs() {
+ local func="${1}"
+ local prefix="${2}"
+ local -a multilibs
+ local multi_dir multi_os_dir multi_root multi_flags multi_index multi_target
+ local root_suffix
+
+ # Name used internally below
+ if [ "${prefix}" = "sysroot-check" ]; then
+ CT_Abort "Bad prefix used in CT_IterateMultilibs"
+ fi
+
+ # Drop mandatory arguments
+ shift 2
+
+ # If gcc is not configured for multilib, it still prints a single line
+ # for the default settings
+ multilibs=( $("${CT_TARGET}-gcc" -print-multi-lib 2>/dev/null) )
+ CT_DoExecLog ALL rm -rf "sysroot-check"
+ for multilib in "${multilibs[@]}"; do
+ # GCC makes the distinction between:
+ # multilib (-print-multi-lib or -print-multi-directory) and
+ # multilib-os (--print-multi-os-directory)
+ # as the gcc library and gcc sysroot library paths, respectively.
+ # For example, on x86_64:
+ # multilib: -m32=32 -m64=.
+ # multilib-os: -m32=../lib -m64=../lib64
+ # Moreover, while some multilibs can coexist in the same sysroot (e.g.
+ # on x86), some have a "sysroot suffix" to separate incompatible variants.
+ # Such sysroot suffixes combine with multilib-os directories, e.g.
+ # on sh4 with -m4a multilib, the search order in sysroot is (dropping some
+ # directories for brevity:
+ # <sysroot>/m4a/lib/m4a/
+ # <sysroot>/m4a/usr/lib/m4a/
+ # <sysroot>/m4a/lib/
+ # <sysroot>/m4a/usr/lib/
+ # The problem is that while GCC itself is aware of these subtleties, the
+ # binutils (notably, ld) it invokes under the hood are not. For example,
+ # if a shared library libfoo.so.1 requires libbar.so.1, ld will only search
+ # for libbar.so.1 in <sysroot>/m4a/usr/lib, but not in <sysroot>/m4a/usr/lib/m4a.
+ # In other words, 'gcc -lfoo -lbar' will work for both the default and -m4a
+ # cases, and 'gcc -lfoo' will work for the default, but not for -m4a. To
+ # address this, we first try to determine if the sysroot alone makes the
+ # configuration sufficiently unique. If there are no multilibs within the
+ # same suffixed sysroot, we can drop the multi_os_dir and both gcc and ld
+ # will work. If not, we'll supply both multi_root/multi_os_dir (which will
+ # likely break later, e.g. while building final GCC with C++ support). But,
+ # we've done all we can.
+ multi_flags=$( echo "${multilib#*;}" | ${sed} -r -e 's/@/ -/g;' )
+ multi_dir="${multilib%%;*}"
+ multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory ${multi_flags} )
+ multi_root=$( "${CT_TARGET}-gcc" -print-sysroot ${multi_flags} )
+ root_suffix="${multi_root#${CT_SYSROOT_DIR}}"
+ CT_DoExecLog ALL mkdir -p "sysroot-check${root_suffix}"
+ if [ -e "sysroot-check${root_suffix}/seen" ]; then
+ CT_DoExecLog ALL rm -f "sysroot-check${root_suffix}/unique"
+ else
+ CT_DoExecLog ALL touch "sysroot-check${root_suffix}/seen" \
+ "sysroot-check${root_suffix}/unique"
+ fi
+ done
+
+ # Now, actual iteration.
+ # This uses either GCC's multiarch feature (if supported; if not,
+ # GCC prints nothing and exits with status 0), falling back to calling
+ # the architecture-specific functions.
+ multi_index=1
+ for multilib in "${multilibs[@]}"; do
+ multi_flags=$( echo "${multilib#*;}" | ${sed} -r -e 's/@/ -/g;' )
+ multi_dir="${multilib%%;*}"
+ multi_os_dir=$( "${CT_TARGET}-gcc" -print-multi-os-directory ${multi_flags} )
+ multi_root=$( "${CT_TARGET}-gcc" -print-sysroot ${multi_flags} )
+ multi_target=$( "${CT_TARGET}-gcc" -print-multiarch ${multi_flags} )
+ root_suffix="${multi_root#${CT_SYSROOT_DIR}}"
+
+ # If GCC did not report the target tuple (i.e. this configuration is not
+ # multiarch-capable), fall back to our guesswork.
+ if [ -z "${multi_target}" ]; then
+ multi_target="${CT_TARGET}"
+ CT_DoArchMultilibTarget multi_target ${multi_flags}
+ fi
+
+ # Avoid multi_os_dir if it's the only directory in this sysroot.
+ if [ -e "sysroot-check${root_suffix}/unique" ]; then
+ multi_os_dir=.
+ fi
+
+ CT_mkdir_pushd "${prefix}_${multi_dir//\//_}"
+ $func multi_dir="${multi_dir}" \
+ multi_os_dir="${multi_os_dir}" \
+ multi_flags="${multi_flags}" \
+ multi_root="${multi_root}" \
+ multi_target="${multi_target}" \
+ multi_index="${multi_index}" \
+ multi_count="${#multilibs[@]}" \
+ "$@"
+ CT_Popd
+ multi_index=$((multi_index+1))
+ done
+}
diff --git a/steps.mk b/steps.mk
index b7e3b02..15b9a01 100644
--- a/steps.mk
+++ b/steps.mk
@@ -16,9 +16,9 @@ help-env::
# The _for_build steps are noop for native and cross,
# but are actual steps for canadian and cross-native.
-# Please keep the last line with a '\' and keep the following empy line:
+# Please keep the last line with a '\' and keep the following empty line:
# it helps when diffing and merging.
-CT_STEPS := libc_check_config \
+CT_STEPS := \
companion_libs_for_build \
binutils_for_build \
companion_libs_for_host \