Page MenuHomeFreeBSD

csu: test: explicitly add libm as build parameter
ClosedPublic

Authored by alfredo on Jul 1 2022, 3:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 22 2024, 7:15 PM
Unknown Object (File)
Mar 22 2024, 12:36 PM
Unknown Object (File)
Mar 22 2024, 12:35 PM
Unknown Object (File)
Mar 22 2024, 12:22 PM
Unknown Object (File)
Mar 8 2024, 7:20 AM
Unknown Object (File)
Feb 22 2024, 1:09 PM
Unknown Object (File)
Jan 14 2024, 10:12 AM
Unknown Object (File)
Dec 31 2023, 9:53 AM

Details

Summary

CSU tests build fails with '/usr/lib/libgcc_s.so: undefined reference to fma'
when built with LLVM 14 on powerpcspe, so '-lm' is being added explicitly.
It may be linked to https://reviews.llvm.org/D77558

MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

It's been a while since I tried getting powerpcspe to build, but there's something going on with fma that I don't completely understand. I remember there were many more failures due to missing fmas. It might be better to attempt to stop llvm from emitting fmas altogether?

That said, linking libgcc with libm might open up another can of worms. I am not sure if this is the right fix at all.

This might be related to https://reviews.llvm.org/D77558 . I haven't added a reduced test case, so it's not been approved and merged.

Oh, only for tests? I thought this was for the actual csu itself (crt1.o) which set off giant alarm bells in my head. I would suggest refining the commit log to avoid similar explosions for other people. I probably don't care about the test needing this though I would make it specific to the arch (perhaps using Makefile.powepc64 or the like even?) That said, if Justin's upstream fix is the real fix that would be even better.

I agree with john: The tag line is far too scary and is misleading as to what this change does. Please reward the commit message.

Other than that: lgtm

This revision is now accepted and ready to land.Jul 6 2022, 8:21 PM

If libgcc_s.so needs libm now then the change I submitted to LLVM is the right route, but if it's just the test, and libgcc_s.so does not itself need libm, then this is fine. I don't have my beefy hardware yet (still in storage for my move), so can't check myself.

As far as I remember, several libs including libgcc now 'suddenly' required (variations of) fma routines, since they were expanded as libcalls. I think the upstream llvm change is much better: if powerpcse doesn't support fma at all, then it shouldn't be emitted by llvm if at all possible. (And a libcall does not really make sense, since it won't give better performance; it will have to go through the motions of calculating it with separate multiplies and adds...)

I think what @jhibbits is talking about is upstream llvm only wanting to accept that change if a 'good enough' regression test is added too.

Make -lm added to powerpcspe only

This revision now requires review to proceed.Jul 6 2022, 9:39 PM
alfredo retitled this revision from csu: explicitly add libm as build parameter to csu: test: explicitly add libm as build parameter.Jul 6 2022, 9:45 PM
alfredo edited the summary of this revision. (Show Details)

Thanks for the reviews!

I modified the patch to apply the change only to powerpscpe and changed the description/commit message. Please let me know if you're fine with the patch now.

I just updated the review upstream, adding the needed test, so I think it should be good to submit in the next several days. I think that should make this change redundant at that point.

I just updated the review upstream, adding the needed test, so I think it should be good to submit in the next several days. I think that should make this change redundant at that point.

Nice, thanks!
If you agree we can commit this now to unbreak powerpcspe build and remove it later if not needed anymore

I think it's fine, if this is the only fix needed to unbreak the powerpcspe build. Just add a note somewhere that it needs revisited and probably reverted after whatever change brings in https://reviews.llvm.org/D77558 (likely a cherry-pick of it specifically, unless a new release is imminent).

This revision was not accepted when it landed; it landed in state Needs Review.Jul 7 2022, 8:57 PM
This revision was automatically updated to reflect the committed changes.

I think this can be reverted now as the LLVM change was back ported?

In D35691#812594, @jhb wrote:

I think this can be reverted now as the LLVM change was back ported?

Yes.