David McCullough wrote: > > I have a general question regarding cross-compilers: > > I know that building my own cross compiler is harder than using a pre-built > > one. However, what would be the benefits of building my own cross-compiler > > instead of using the pre-built ones? > > Other than the knowledge gained, pain suffered and a sense of achievement, > not much IMO. > > The only time rebuilding makes sense is if you cannot use the default > location for the pre-built toolchain, or you have a host that has not > pre-built toolchains,
Or if the pre-built toolchain has the wrong options. As was mentioned recently here, a recent distributed pre-built ARM toolchain does not produce correct code with -fpic -msingle-pic-base due to not having the right multilib options when it was built, or something like that. I've been using another pre-built ARM toolchain for some time, which is fine except when threads are used, then the programs tend to crash. I suspect that is due to build-time uClibc or gcc options. I solved it for my project by combining the pre-built tools from that version, with libraries from an even older pre-built toolchain from another source. However, one major advantage of pre-built toolchains is they produce the same code as the host changes over the years. If you build the toolchain from source, then the resulting tools can depend on your host environment which may be different next year when you do it again. For example, if you have a project which was built with a really old GCC like 2.7.2, and you need to reproduce the project with minimal changes (perhaps for a small but critical bug fix in a deployed product), you need GCC 2.7.2. Using a different compiler would be too much change for such a bug fix. But if you build GCC 2.7.2 on a current GNU/Linux with GCC 4.2 as the host compiler, using old built scripts from the time of GCC 2.7.2, there's a chance the freshly built GCC 2.7.2 won't function correctly, as the host compiler has more aggressive optimisations which break the really old compiler, and the really old build scripts don't disable them. A pre-built binary GCC 2.7.2 distribution is likely to always function correctly on future hosts where it will run, and always produce the same code, however. -- Jamie _______________________________________________ uClinux-dev mailing list [email protected] http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by [email protected] To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev
