Follow-up to bug 831282. When checking for linker flag support, the test-flags-CCLD() function doesn't use the user's LDFLAGS. In particular, it doesn't respect the "-fuse-ld" flag (valid for gcc and clang, at least) that overrides which linker gets used. Thus the wrong linker can be tested. For an example, webkit-gtk fails to build with sys-devel/mold and -fuse-ld=ld.mold (requires gcc-12 if you're testing with gcc) because test-flags-CCLD() reports that the linker supports the --no-keep-memory flag, but ld.mold does not. Changing the function to respect LDFLAGS is the first thing that comes to mind, but would be a major change in behavior for this function. So maybe there is a less intrusive way to do it.
Created attachment 791351 [details, diff] 0001-flag-o-matic.eclass-respect-fuse-ld-in-test-flags-CC.patch Not tried it but let me know if it works for you. And if it doesn't, a fixed version is welcome ;)
Created attachment 791354 [details, diff] 0001-flag-o-matic.eclass-respect-fuse-ld-in-test-flags-CC.patch
The patch does allow me to build webkit-gtk with sys-devel/mold-1.2.1-r1 using both gcc-12 and clang, so it's doing something right. Thanks for working on this. (I think it's worth fixing even though the original motivation is obsolete: newer versions of mold ignore the --no-keep-memory flag.)
(In reply to Michael Orlitzky from comment #3) > The patch does allow me to build webkit-gtk with sys-devel/mold-1.2.1-r1 > using both gcc-12 and clang, so it's doing something right. Thanks for > working on this. (I think it's worth fixing even though the original > motivation is obsolete: newer versions of mold ignore the --no-keep-memory > flag.) Thanks! Sent to ML.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2884a7d0131749f8c54c9dac3ee63ef62e4afbf1 commit 2884a7d0131749f8c54c9dac3ee63ef62e4afbf1 Author: Sam James <sam@gentoo.org> AuthorDate: 2022-07-14 05:41:21 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-07-26 04:41:22 +0000 flag-o-matic.eclass: respect -fuse-ld in test-flags-CCLD Closes: https://bugs.gentoo.org/832377 Signed-off-by: Sam James <sam@gentoo.org> eclass/flag-o-matic.eclass | 9 +++++++++ 1 file changed, 9 insertions(+)