Created attachment 669239 [details, diff] A fix for querying ld kind I am trying to bootstrap prefix on MacOS 10.14 and 10.15. Stage2 bootstrapping produces a bunch of errors and similar noise and I am trying to fix at least some of error messages. The previous bug reports in the series are these: bug 751037, bug 751067, bug 751406, bug 751412, bug 751421, bug 751511. This bug report deals with the ld: unknown option: --version error message which pollutes the build log. After superficial analysis it becomes clear that the error message is indeed benign but it is also easy to fix and fixing it hopefully will save some time for people analysing build failures on non-GNU/Linux platforms. The error is produced by the gen_usr_ldscript() function from the usr-ldscript.eclass. This function checks if the ld is the GNU gold and for this purpose it calls $(tc-getLD) --version. The problem is that Xcode's ld doesn't accept --version option, -v is used instead. GNU ld also accepts -v (synonymous to --version) but replacing --version to -v is a wrong thing to do, for if I remember correctly, Sun's ld accepts --version but does not accept -v (it uses -V instead). FreeBSD version of ld accepts all three -v, -V and --version with subtle differences (-v does not prevent ld from linking is object files are specified). But as far as GNU ld is only concerned, I suggest to just do a minimal change which would mute the error. The patch is attached. I am not sure about -Wl,--verbose behaviour w.r.t. all ever existed variants of gold linkers on all platforms and the comment in the eclass looks misleading (it discusses gold linker at large but the check is for the GNU packaged ld.gold only). But at least this change wouldn't add breakage and wouldn't hide error messages should these appear. Note: A similar problem exists in tc-ld-is-gold() in the toolchain-funcs.eclass.
Could you submit this patch to gentoo-dev mailing list for review?
Yes, could you?
Ping - Alexander, would you mind posting this to the gentoo-dev mailing list?
the xtools ld we currently use supports --version (was specifically added to be more compatible with GNU)