Can I build OpenWrt with llvm toolchain?

I'm trying to build OpenWrt with full LTO, and I noticed "Use external toolchain" in menuconfig. I want to know if I can use the llvm toolchain directly from the system

1 Like

Following the mantra that anything that isn't tested -regularly- must be considered broken, the answer would be 'no'. Even with gcc based toolchains this is 'here are dragons territory' and not a supported method in the sense that you could expect help with- or sympathy for your endeavour, it is a very specialist option and you will have to be your main (and pretty much only) supporter.

That aside, it cannot be expected that llvm will 'just work(TM)' as drop-in replacement. Just get a feel of the usual patching necessary to bump the major components of the regular toolchain, to get a hint what kind of fun you'd have ahead of yourself to get llvm/ clang working - and your experiences will vary wildly between different architectures/ targets. It's not very realistic.

If you are in search of a new, exclusive, hobby and want to wander this path nevertheless, don't take the external toolchain route, but start a patch set to hook up llvm 'properly', just like OpenWrt supports hooking up different gcc versions. Doing it this way is the only approach to get reproducable results and -maaaaybe- find others to join your efforts (with a long term prospect to get things merged, eventually).

3 Likes