I believe that the libgcc.a in our toolchain contains Thumb-2 code. I verified this by doing objdump on libgcc.a and I see combinations of 16 and 32 bit instructions. So does that mean that the toolchain is only usable for ARM versions that support Thumb-2?
Thanks, John
On Wed, Oct 6, 2010 at 10:44 AM, John Rigby john.rigby@linaro.org wrote:
I believe that the libgcc.a in our toolchain contains Thumb-2 code. I verified this by doing objdump on libgcc.a and I see combinations of 16 and 32 bit instructions. So does that mean that the toolchain is only usable for ARM versions that support Thumb-2?
Our focus is Thumb-2 on Cortex-A processors. We try to 'do no harm', so Linaro GCC should be as good as the FSF GCC on older ARM architectures or non-ARM architectures such as i686 and x86_64.
The included libgcc is compiled for processors with Thumb-2 and VFPv3-D16. I'm afraid I have no plans for other variants at the moment, but you might want to talk with Marcin and Wookey about this.
-- Michael
Thanks Michael. Just wanted to make sure I understood. The "do no harm" goal and the Thumb2 libgcc seem to be somewhat contradictory however. I realize that choices need to be made and only odd ducks like me will likely run into issues. My particular case is wanting to build u-boot for old and new ARM chips with the same gcc. U-Boot has its own libgcc that I can use as a work around.
John
On Tue, Oct 5, 2010 at 3:57 PM, Michael Hope michael.hope@linaro.org wrote:
On Wed, Oct 6, 2010 at 10:44 AM, John Rigby john.rigby@linaro.org wrote:
I believe that the libgcc.a in our toolchain contains Thumb-2 code. I verified this by doing objdump on libgcc.a and I see combinations of 16 and 32 bit instructions. So does that mean that the toolchain is only usable for ARM versions that support Thumb-2?
Our focus is Thumb-2 on Cortex-A processors. We try to 'do no harm', so Linaro GCC should be as good as the FSF GCC on older ARM architectures or non-ARM architectures such as i686 and x86_64.
The included libgcc is compiled for processors with Thumb-2 and VFPv3-D16. I'm afraid I have no plans for other variants at the moment, but you might want to talk with Marcin and Wookey about this.
-- Michael
On Wed, Oct 6, 2010 at 11:23 AM, John Rigby john.rigby@linaro.org wrote:
Thanks Michael. Just wanted to make sure I understood. The "do no harm" goal and the Thumb2 libgcc seem to be somewhat contradictory however. I realize that choices need to be made and only odd ducks like me will likely run into issues.
I'd like to use our toolchain on my N800 and Cortex-M3 boards as well. The 'do no harm' is at the source level - you should be able to take the Linaro GCC tarball and build a compiler for your particular situation that is as good as and probably more correct than the FSF GCC. Unfortunately we can't make one libgcc that covers all ARM products as some like the Cortex-M series are Thumb-2 only, some like the Cortex-M0 are Thumb-1 only, and some (very old ones) are ARM only. Then you add the floating point options into the mix.
It would be nice to ship multiple builds of libgcc with the cross compiler but that's currently out of scope.
-- Michael
On Tue, Oct 05, 2010 at 04:23:01PM -0600, John Rigby wrote:
Thanks Michael. Just wanted to make sure I understood. The "do no harm" goal and the Thumb2 libgcc seem to be somewhat contradictory however. I realize that choices need to be made and only odd ducks like me will likely run into issues. My particular case is wanting to build u-boot for old and new ARM chips with the same gcc. U-Boot has its own libgcc that I can use as a work around.
However, the "harm" here comes not from any work the Linaro Toolchain WG is doing, it comes from the fact that you're using the Ubuntu toolchain packages, where ARMv7 is targeted as the baseline - and this was the case even before Linaro was off the ground. :) (Even if libgcc were not Thumb2 enabled, you could still have arbitrary, if more subtle, compatibility problems with the Ubuntu armel libgcc and non-ARMv7 chips.)
It sounds like what you need for this is a multilib-enabled armel compiler build, that includes a libgcc build for ARMv7 as well as separate libgcc builds for whichever other ARM targets you're after. You should coordinate this with Marcin (cc:ed), who can help with the toolchain packaging details for either a native or cross- compiler.
OOI, what are the U-Boot targets you're looking to build for that don't support ARMv7? A gcc multilib package for armel will be easy to implement but hard to maintain, and certainly none of the systems Linaro is targeting should require a pre-Thumb-2 U-Boot, so I'm very doubtful that the ongoing effort to maintain such a toolchain in Ubuntu is justified (unless we find that it becomes substantially easier with multiarch, I guess, but we're a ways away from that yet).
Cheers,
On Wednesday 06 October 2010, Steve Langasek wrote:
It sounds like what you need for this is a multilib-enabled armel compiler build, that includes a libgcc build for ARMv7 as well as separate libgcc builds for whichever other ARM targets you're after. You should coordinate this with Marcin (cc:ed), who can help with the toolchain packaging details for either a native or cross- compiler.
The question is how far we want to go, since a real multilib toolchain would require multilib-versions of not only libgcc but also (at least) glibc and libstdc++.
The linaro toolchain is currently very much usable to build a pre-v7 kernel and anything that uses -ffreestanding, and IMHO we should try to keep it that way.
Would there be anything that we might want to build besides u-boot that requires an matching libgcc but not also an matching glibc?
Arnd
On Tue, Oct 05, 2010, Steve Langasek wrote:
OOI, what are the U-Boot targets you're looking to build for that don't support ARMv7? A gcc multilib package for armel will be easy to implement but hard to maintain, and certainly none of the systems Linaro is targeting should require a pre-Thumb-2 U-Boot, so I'm very doubtful that the ongoing effort to maintain such a toolchain in Ubuntu is justified (unless we find that it becomes substantially easier with multiarch, I guess, but we're a ways away from that yet).
Isn't Thumb 2 the actual issue here? U-Boot is built with -marm; does it cause any issue to mix with our Thumb-2 libgcc?
I'm really sorry to have started this, but for completeness here is the rest of the story. The hypothetical scenario is a developer that maintains u-boot for multiple platforms. Using a codesourcery or eldk (from denx.de) toolchain one can use the appropriate -march= to get the right code from the compiler. Also the libgcc.a is ARM so all is well. Using a linaro toolchain using the same -march= you get the right code from the compiler but the result will get linked with a Thumb-2 libgcc.a and the resulting binary will not run on an older ARM. If however libgcc.a was ARM then it would just work. Again, I'm not saying this is a bug or even something for Linaro to care about. It just means that the Linaro toolchain is not something that this hypothetical u-boot maintainer would want to use as his/her one and only toolchain.
The naive magical solution would be to for the linker to understand the -march="old non Thumb-2 ARM" and flag an error when linking with a Thumb-2 libgcc.a. Even better would be for the toolchain to have multiple libgcc's and use the right one.
The answer is that the developer just needs to know that the libgcc in the Linaro toolchain is Thumb-2 so they must use the libgcc included in the u-boot source when building for old ARM targets.
Again, sorry for injecting this noise. My question is answered.
John
On Wed, Oct 6, 2010 at 6:41 AM, Loïc Minier loic.minier@linaro.org wrote:
On Tue, Oct 05, 2010, Steve Langasek wrote:
OOI, what are the U-Boot targets you're looking to build for that don't support ARMv7? A gcc multilib package for armel will be easy to implement but hard to maintain, and certainly none of the systems Linaro is targeting should require a pre-Thumb-2 U-Boot, so I'm very doubtful that the ongoing effort to maintain such a toolchain in Ubuntu is justified (unless we find that it becomes substantially easier with multiarch, I guess, but we're a ways away from that yet).
Isn't Thumb 2 the actual issue here? U-Boot is built with -marm; does it cause any issue to mix with our Thumb-2 libgcc?
-- Loďc Minier
On Wed, Oct 06, 2010, John Rigby wrote:
I'm really sorry to have started this, but for completeness here is the rest of the story.
No need to be sorry, I think you're doing right to bring this up
The hypothetical scenario is a developer that
maintains u-boot for multiple platforms. Using a codesourcery or eldk (from denx.de) toolchain one can use the appropriate -march= to get the right code from the compiler. Also the libgcc.a is ARM so all is well. Using a linaro toolchain using the same -march= you get the right code from the compiler but the result will get linked with a Thumb-2 libgcc.a and the resulting binary will not run on an older ARM. If however libgcc.a was ARM then it would just work. Again, I'm not saying this is a bug or even something for Linaro to care about. It just means that the Linaro toolchain is not something that this hypothetical u-boot maintainer would want to use as his/her one and only toolchain.
So it strikes me as a toolchain bug; if I understand what you're saying above: - libgcc built with -march=armv7a can be used with ARMv4, v5, v6, v7 CPUs (if you pass the correct -march=), so it's backwards compatible even if libgcc is built with -march=armv7a - libgcc built with -mthumb is NOT compatible with CPUs lacking thumb, even if you pass -marm
It gets a bit muddier if one considers that some armv7 CPUs could support Thumb-2 only, but these aren't ARMv7*A*, so I don't think that's relevant for the discussion.
I remember we had a similar case for a VFP libgcc back in jaunty, where doko had experienced a multilib VFP libgcc along the regular non-VFP libgcc.
Is it purely accidental that libgcc built for -march=armv7 works on older CPUs? Why can't this mechanism be extended to -marm/-mthumb and to VFP options?
On 06/10/10 15:48, Loïc Minier wrote:
On Wed, Oct 06, 2010, John Rigby wrote:
The hypothetical scenario is a developer that
maintains u-boot for multiple platforms. Using a codesourcery or eldk (from denx.de) toolchain one can use the appropriate -march= to get the right code from the compiler. Also the libgcc.a is ARM so all is well.
The CodeSourcery toolchain has "multilibs" to support this. That is, there is one copy of libgcc (and glibc/newlib/uclibc, depending on the SG++ you choose) per -march option. Other options (such as -mfloat and -marm/-mthumb, endian, etc) also have specialist libraries available.
Using a linaro toolchain using the same -march= you get the right code from the compiler but the result will get linked with a Thumb-2 libgcc.a and the resulting binary will not run on an older ARM.
The Linaro/Ubuntu binary releases are configured specifically for the architectures they are intended to run on. If you try to build for something else then you're not using the right tool for the job.
I would recommend either building a Linaro compiler from source, with the desired config, or else using a CodeSourcery compiler (the two are *very* closely related).
If however libgcc.a was ARM then it would just work.
This would work, but it doesn't really make much sense for the libgcc to be configured differently to the entire rest of the distribution (and you'd need to do some build system hackery to get gcc installed that way).
Again, I'm not saying this is a bug or even something for Linaro to care about. It just means that the Linaro toolchain is not something that this hypothetical u-boot maintainer would want to use as his/her one and only toolchain.
Agreed. You should use a compiler built for the job.
So it strikes me as a toolchain bug; if I understand what you're saying above:
- libgcc built with -march=armv7a can be used with ARMv4, v5, v6, v7 CPUs (if you pass the correct -march=), so it's backwards compatible even if libgcc is built with -march=armv7a
This statement is false. Code compiled with -march=armv7a will only run on ARMv7a or compatible. It's possible that simple programs might, by chance, work on older cores, but relying on this behaviour even there is just broken.
- libgcc built with -mthumb is NOT compatible with CPUs lacking thumb, even if you pass -marm
No, that's why multilibed compilers (such as CodeSourcery's) substitute a different libgcc when you use those options.
[snip]
Is it purely accidental that libgcc built for -march=armv7 works on older CPUs? Why can't this mechanism be extended to -marm/-mthumb and to VFP options?
See above. Some routines might work on some older hardware, by chance, but it's subject to change at any moment, and I doubt the entire library is backward compatible.
There's another issue here: using a Linux user-space compiler to build for bare-metal is a bad plan. libgcc is built assuming that system calls and exceptions etc. work as they do in Linux user-mode. The Linux kernel is built with a user-space compiler for convenience, but a) the kernel is always configured for the same hardware as the user-space, and b) it has it's own versions of (at least some of) the libgcc routines, customized for it's own environment.
I strongly suggest you use a bare-metal compiler configured for the right architecture(s), such as CodeSourcery's ARM EABI Lite toolchain.
Andrew
On 07.10.2010 13:26, Andrew Stubbs wrote:
On 06/10/10 15:48, Loïc Minier wrote:
On Wed, Oct 06, 2010, John Rigby wrote:
The hypothetical scenario is a developer that maintains u-boot for multiple platforms. Using a codesourcery or eldk (from denx.de) toolchain one can use the appropriate -march= to get the right code from the compiler. Also the libgcc.a is ARM so all is well.
The CodeSourcery toolchain has "multilibs" to support this. That is, there is one copy of libgcc (and glibc/newlib/uclibc, depending on the SG++ you choose) per -march option. Other options (such as -mfloat and -marm/-mthumb, endian, etc) also have specialist libraries available.
last time I checked this "multilibs" feature was implemented by building the toolchain N times. By which magic is the correct library selected? I didn't find anything in fsf trunk which supports this kind of multilibs builds.
Matthias
On 07/10/10 12:36, Matthias Klose wrote:
last time I checked this "multilibs" feature was implemented by building the toolchain N times. By which magic is the correct library selected? I didn't find anything in fsf trunk which supports this kind of multilibs builds.
It's there, and has been since forever. :)
You pass --enable-multilibs when you configure the compiler, and you get all the libgcc.a, crt[in].o, and other such files compiled and installed automatically. If you build for bare-metal, and newlib is in your source tree, that gets built automatically also. I think glibc has to be built multiple times manually.
The compiler selects the libraries by recognising the compiler command line switches and matching them to a library. It then adjusts the search paths accordingly.
If you do "gcc -print-multi-lib" on Ubuntu gcc (Lucid) it says:
.; 32;@m32
This means there are two multilibs: the first has libraries found in directory "." (i.e. the root of the library directory) and is used for the default options (there's a blank after the ";"); and the second has libraries in the directory "32" and is used whenever the -m32 option is passed.
Andrew
On 07.10.2010 13:55, Andrew Stubbs wrote:
On 07/10/10 12:36, Matthias Klose wrote:
last time I checked this "multilibs" feature was implemented by building the toolchain N times. By which magic is the correct library selected? I didn't find anything in fsf trunk which supports this kind of multilibs builds.
It's there, and has been since forever. :)
You pass --enable-multilibs when you configure the compiler, and you get all the libgcc.a, crt[in].o, and other such files compiled and installed automatically.
they must have renamed that recently from --enable-multilib ;)
If you build for bare-metal, and newlib is in your source tree, that gets built automatically also. I think glibc has to be built multiple times manually.
right, the multilib options are in t-arm-elf, not in t-linux-armeabi. The old t-linux has the ones for hard/softfp commented out.
Matthias
On 07/10/10 13:08, Matthias Klose wrote:
they must have renamed that recently from --enable-multilib ;)
Sneaky bunch, those GCC maintainers!
right, the multilib options are in t-arm-elf, not in t-linux-armeabi. The old t-linux has the ones for hard/softfp commented out.
Right, Linux compilers don't typically have much use for multilibs - you know what your configuration is and stick with it.
The the 32/64 bit multilibs exist, of course, but they don't change the architecture settings, and they're "special", in that the libraries are typically installed outside the usual scheme.
Andrew
Matthias Klose doko@ubuntu.com wrote:
last time I checked this "multilibs" feature was implemented by building
the
toolchain N times. By which magic is the correct library selected? I
didn't
find anything in fsf trunk which supports this kind of multilibs builds.
No, you don't need to build the toolchain multiple times. The toolchain build process for a target that supports multilibs will automatically build the *target libraries* multiple times. This is controlled by a bunch of MULTILIB_... variables set in the target makefile fragment. For example, when configuring GCC for arm-linux-androideabi, the makefile fragment config/arm/t-linux-androideabi is used and sets:
MULTILIB_OPTIONS = march=armv7-a mthumb MULTILIB_DIRNAMES = armv7-a thumb
This has two effects: first, during GCC build, two extra sets of libraries are built; one with the flag -march=armv7-a, which is stored in a subdirectory called "armv7-a", and one with the flag -mthumb, which is stored in "thumb".
The second effect is at that runtime, when GCC is invoked with the -march=armv7-a or -mthumb flags, the GCC driver will search for target libraries in the respective directories "armv7-a" and "thumb" first, before falling back to the default location.
This has been supported by GCC for a long time, but it isn't frequently used on Linux targets (except to support -m32/-m64 style bi-arch compilers). One reason is that the GCC multilib scheme only affects target libraries built as part of the GCC build process itself -- it does not solve the problem of providing multiple version of all the other system libraries. (However, embedded targets already make frequent use of multilibs.)
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
-- Dr. Ulrich Weigand | Phone: +49-7031/16-3727 STSM, GNU compiler and toolchain for Linux on System z and Cell/B.E. IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter | Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294
Hi,
There's another issue here: using a Linux user-space compiler to build for bare-metal is a bad plan. libgcc is built assuming that system calls and exceptions etc. work as they do in Linux user-mode. The Linux kernel is built with a user-space compiler for convenience, but a) the kernel is always configured for the same hardware as the user-space, and b) it has it's own versions of (at least some of) the libgcc routines, customized for it's own environment.
Basically the bare-metal situation is just another ABI which could potentially have its own libgcc variant(s) etc, in a similar way to the float-abi issues. libgcc is truly a special case here, because it's needed for the compiler to implement the C language, and so hard not to depend on it even if avoiding all other libraries. Is it worth thinking about how to add this ABI-variant capability to multilibs?
This may be an oversimplification of the situation though, and there are still questions about whether this makes sense, and whether enough people care.
However, just from consistency arguments, I think that if we were to have problems build linaro U-Boot with the linaro toolchain that would be a bad thing (though if I've understood correctly, we have workarounds for this which are valid provided that linaro-supported, i.e. v7-A+, hardware is targeted. The thumb2 libgcc is exposing problems in U-Boot, not gcc/binutils in this case)
Cheers ---Dave
On 10/7/2010 7:03 AM, Dave Martin wrote:
However, just from consistency arguments, I think that if we were to have problems build linaro U-Boot with the linaro toolchain that would be a bad thing
From a practical perspective, that is likely true.
However, the fact that the Linux kernel and U-Boot are traditionally built with toolchains that target Linux is abstractly wrong. The kernel and U-Boot are not Linux applications (which is what a *-linux* toolchain is intended to build); they are bare-metal applications (which is what a *-eabi* toolchain is intended to build). That is one of the reasons that building the kernel and U-Boot tends to require lots of complex command-line options; you have to tell the compiler that it can't assume it's building a Linux application.
On Thu, 7 Oct 2010, Andrew Stubbs wrote:
There's another issue here: using a Linux user-space compiler to build for bare-metal is a bad plan. libgcc is built assuming that system calls and exceptions etc. work as they do in Linux user-mode. The Linux kernel is built with a user-space compiler for convenience, but a) the kernel is always configured for the same hardware as the user-space, and b) it has it's own versions of (at least some of) the libgcc routines, customized for it's own environment.
The kernel does indeed explicitly avoid any linkage with libgcc.a. It is self contained and provide its own set of equivalent functions typically carried by libgcc.a, and explicitly _exclude_ some other functions (such as 64-bit divisions) to ensure they're never used in the kernel.
I strongly suggest you use a bare-metal compiler configured for the right architecture(s), such as CodeSourcery's ARM EABI Lite toolchain.
I think that a perfectly valid alternative is for the bare-metal target program to provide its own support library as the kernel does. So if U-Boot already comes with its own libgcc.a equivalent, then it should just be used.
Nicolas
+++ John Rigby [2010-10-06 08:31 -0600]:
I'm really sorry to have started this, but for completeness here is the rest of the story. The hypothetical scenario is a developer that maintains u-boot for multiple platforms. Using a codesourcery or eldk (from denx.de) toolchain one can use the appropriate -march= to get the right code from the compiler. Also the libgcc.a is ARM so all is well. Using a linaro toolchain using the same -march= you get the right code from the compiler but the result will get linked with a Thumb-2 libgcc.a and the resulting binary will not run on an older ARM. If however libgcc.a was ARM then it would just work. Again, I'm not saying this is a bug or even something for Linaro to care about. It just means that the Linaro toolchain is not something that this hypothetical u-boot maintainer would want to use as his/her one and only toolchain.
You bring up an issue that has bugged me for a while. The way gcc is currently designed, whilst you can choose compile time options (like -march=arm), that doesn't do what someone who is targeting, say, a v5 machine wants, unless the toolchain was built with the relevant multilib options so that it actually has several libgccs (and potentially libgomps and libmudflaps and whatever else it spits out these days).
So in practice you can only really set a 'flavour' (as I shall call the choice of instruction set(s)) at compiler build-time, not package build time.
Your average developer would much prefer it if they could easily choose the flavour at build-time of their package/software, and not have to rebuild the toolchain for that flavour first. And we, as distibutors of binary cross-toolchains, would also like to be able to support people targetting multiple flavours with one toolchain, without having to do that by picking lowest-common-denominator, or build lots of different toolchains.
gcc has the multilib feature, but the way it is implemented means it works well for about 2 or 3 options, but you rapidly get combinatorial explosion of libgcc instances if you try to do more things than that. (i.e if you ask for v5, v6, v7, vfp, and neon options you get 25 versions of libgcc1, most of which are silly combinations)
Joseph Myers of Codesourcery has been looking at making this into a more flexible mechanism where you just choose the combinations you actually cared about, not every possible one. I hope that the output of that work would mean we (or someone else like Debian) could choose to support a couple of other useful options, and maybe even a nice runtime way of selecting them.
This has not been a huge issue to date because few people were using pre-built packaged cross-toolchains - they were building the toolchain for their target. Of course that's still quite easy to do, and indeed ARM (well, linaro/ARM in the form of ppearse) are doing it internally for v5 and v6 targets for ALIP builds. But they won't/can't make those packages available because of legal paranoia about shipping gcc so someone else should do this outside and make a handy repo.
Until then the easiest approach is just to use the emdebian cross-toolchains which are built to Debian armel's v4t-nothumb-novfp maximum-compatibilty flavour: http://emdebian.org/crosstools.html ('binary toolcahins' link).
This issue is a useful subject for UDS discussion, I believe.
Wookey
On 07/10/10 12:03, Wookey wrote:
gcc has the multilib feature, but the way it is implemented means it works well for about 2 or 3 options, but you rapidly get combinatorial explosion of libgcc instances if you try to do more things than that. (i.e if you ask for v5, v6, v7, vfp, and neon options you get 25 versions of libgcc1, most of which are silly combinations)
It's not really the implementation that gives the "combinatorial explosion", so much as the problem.
E.g. Say you want enough libraries to be able to build for: * ARM mode or Thumb mode, * with FP, or without, and * both big endian and little endian.
That's 8 different libraries: 1. ARM FP LE 2. ARM FP BE 3. ARM noFP LE 4. ARM noFP BE 5. Thumb FP LE 6. Thumb FP BE 7. Thumb noFP LE 8. Thumb noFP BE
Joseph Myers of Codesourcery has been looking at making this into a more flexible mechanism where you just choose the combinations you actually cared about, not every possible one. I hope that the output of that work would mean we (or someone else like Debian) could choose to support a couple of other useful options, and maybe even a nice runtime way of selecting them.
SuperH already has this. When you build the toolchain you can choose exactly what multilibs will be available with a few configuration options. Other architectures only let you choose what the default will be, and whether to build all the multilibs or not.
CodeSourcery limits the number of multilibs in our product builds by adding our own custom configuration files into the GCC sources, but these are hardly flexible.
All these solutions still require pre-baking the decision into the toolchain.
A possible solution to the problem would be to include the sources to libgcc.a in the installation, and teach gcc to compile it on-the-fly, as necessary. Obviously, you'd still want to pre-bake the most commonly used configuration, for performance reasons. This wouldn't work for libgcc.so, but you probably wouldn't want it to ...
Andrew
On Thursday 07 October 2010 13:03:14 Wookey wrote:
gcc has the multilib feature, but the way it is implemented means it works well for about 2 or 3 options, but you rapidly get combinatorial explosion of libgcc instances if you try to do more things than that. (i.e if you ask for v5, v6, v7, vfp, and neon options you get 25 versions of libgcc1, most of which are silly combinations)
If I understood Uli correctly, you can have one version of libgcc that is used as the fallback in a multilib setup, and most variants are backwards compatible.
We could have one version for the variant we're targetting (v7-a, thumb2, vfp, neon) and one version as a fallback for most older targets (v5 or v4, arm, novfp, noneon) which would get us a _long_ way, and it would still be compatible with the version we normally use.
There are however some incompatible options (big-endian, thumb 1, hardfloat) that might need an extra multilib variant if we really want them.
Arnd
On 07/10/10 12:54, arnd@arndb.de wrote:
On Thursday 07 October 2010 13:03:14 Wookey wrote:
gcc has the multilib feature, but the way it is implemented means it works well for about 2 or 3 options, but you rapidly get combinatorial explosion of libgcc instances if you try to do more things than that. (i.e if you ask for v5, v6, v7, vfp, and neon options you get 25 versions of libgcc1, most of which are silly combinations)
If I understood Uli correctly, you can have one version of libgcc that is used as the fallback in a multilib setup, and most variants are backwards compatible.
Yes, with some carefully thought out custom configuration patches we can certainly do something like what you suggest.
You can tell GCC exactly what arches you want multilibs for, and what options (neon, vfp, etc) you want multilibs for, and it will automatically fill in the N-dimensional matrix that gives you all those options.
Like Wookey said, this can produce a selection of pointless libraries that either make no sense, or else are duplicates of other libraries, so GCC has ways to deal with this:
1. You can disable any specific option combination you like.
2. You can specify that one set of options should use the library from another, compatible set of options.
3. You can add custom "specs" rules that tell it what to do in the "fall back" case (normal procedure is to use the default library - the primary target for the toolchain, but in this case, we're talking about having a fall-back to a lowest-common-denominator library, which would be far less optimal).
All this can be done with a small patch to two or three files. It's quite easy, but we just need to know what it is we want to achieve. Any such patch should be done in a way that plays nice with other people requirements for building the sources, and even then would probably not be acceptable upstream.
Although these things *can* be done, I'm really not sure that they *should*. As has been pointed out already, this use case really is an abuse of a Linux user-space compiler, and will add features that 99.99% of users will never care about, yet will increase both the build and test burden for developers/packagers all the time, possibly considerably.
Andrew
linaro-toolchain@lists.linaro.org