Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 832377 - flag-o-matic.eclass: test-flags-CCLD doesn't respect "-fuse-ld" flag
Summary: flag-o-matic.eclass: test-flags-CCLD doesn't respect "-fuse-ld" flag
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: systemwide-gold LD-is-lld, systemwide-lld systemwide-mold
  Show dependency tree
 
Reported: 2022-01-30 15:12 UTC by Michael Orlitzky
Modified: 2022-07-26 04:50 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
0001-flag-o-matic.eclass-respect-fuse-ld-in-test-flags-CC.patch (file_832377.txt,1.25 KB, patch)
2022-07-14 05:43 UTC, Sam James
Details | Diff
0001-flag-o-matic.eclass-respect-fuse-ld-in-test-flags-CC.patch (file_832377.txt,1.25 KB, patch)
2022-07-14 05:47 UTC, Sam James
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Orlitzky gentoo-dev 2022-01-30 15:12:18 UTC
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.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-14 05:43:30 UTC
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 ;)
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-14 05:47:52 UTC
Created attachment 791354 [details, diff]
0001-flag-o-matic.eclass-respect-fuse-ld-in-test-flags-CC.patch
Comment 3 Michael Orlitzky gentoo-dev 2022-07-15 22:18:29 UTC
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.)
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-16 14:35:26 UTC
(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.
Comment 5 Larry the Git Cow gentoo-dev 2022-07-26 04:46:51 UTC
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(+)