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]
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]
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
Sent to ML.
The bug has been closed via the following commit(s):
Author: Sam James <firstname.lastname@example.org>
AuthorDate: 2022-07-14 05:41:21 +0000
Commit: Sam James <email@example.com>
CommitDate: 2022-07-26 04:41:22 +0000
flag-o-matic.eclass: respect -fuse-ld in test-flags-CCLD
Signed-off-by: Sam James <firstname.lastname@example.org>
eclass/flag-o-matic.eclass | 9 +++++++++
1 file changed, 9 insertions(+)