qt5-build.eclass not conform simple Gentoo style without reason (confoming is trivial). Main problem - it keep gold auto default (and can breaks system-wide LDFLAGS) - this can be "gold" useflag. Also I see 2 more similar things (but less critical) - useflags "pch" and "lto". This is normal to keep this things configurable without tricks and hacks. Next I will post trivial patch to make it more easy ;) Reproducible: Always
Created attachment 456026 [details, diff] useflags: gold, pch, lto Tested with 5.6.2
PS I am sorry to not editing comments in patch - this is night overhead. And there are ld flag for trap to packages vs gold: -Wl,--sort-section=alignment - previous 1 or 2 episodes was parallel to issues for exotic targets, so it is at least good test for package normalization. Even I can suggest this flag to Gentoo defaults (with filtering on USE=gold)) - I unsure about performance benefits, but there are good filter against Gold silent auto-use.
Let's see... *gold: I might consider this, but I don't think it's as easy as your patch seems to suggests, unless the build system changed behavior recently. OTOH, I don't see why anyone would turn this off (if gold is installed and working; if not, it's automatically disabled anyway), and even then, they can add -fuse-ld=bfd to their flags, like any other compiler/linker flags... do we have a USE flag for every compiler flag that upstream uses by default? *lto: same as above, why using a USE flag instead of CXXFLAGS/LDFLAGS? Are we going to add USE=lto to every package in tree now? *pch: what's the benefit? I measured building Qt with and without PCH in the early Qt5 days, and the difference was insignificant. Moreover, PCH are known to cause issues on some architectures, so a pch USE flag would only be a maintenance headache. And last but not least, I don't want the number of USE flags on all Qt modules to explode, just to add some obscure flags that most users won't care about. Not everything needs to be exposed as a USE flag.
gold: it just working. Again: I use -Wl,--sort-section=alignment in ldflags. It breaks gold build (not supported by gold). And works fine system-wide (2 lifetime found exclusions was fixed by others year(s) ago - I remember udev). Now I have 5.6 on one desktop & 5.7 on other - built with standard ld and this flag. No problems. PCH. I start to use PCH only small time ago, just to speedup c++ build (most benefits I get to build boost + ceph - ceph build very slow). It is not too crytical, but simple flag is good option. LTO. System-wide LTO is very selective and build with universal options like -ffat-lto-objects (probably). Some packages don't want to build, etc. So, if upstream developers control special case for package, this is good alternative to keep useflag on this packages and just set system-wide without special care and pain. But primary subject is gold. Others - just "easy same". Also at least one package (I forget what) was fixed vs gold by bug from alpha or power target users - it breaks it. So, using gold by default is not recommended. Even without my "special strange LDFLAGS".