Page MenuHomePhabricator

[compiler-rt] Include -lm when using compiler-rt, due to dependencies in some __div methods.

Authored by rupprecht on Jul 13 2018, 5:02 PM.



Some methods in compiler-rt builtins (divdc3, divsc3, and __divxc3, and maybe others) have dependencies on libm. Therefore building with -rtlib=compiler-rt is completely broken if those symbols are used and users don't include -lm themselves.

Fixes PR32279 and PR28652.

Diff Detail

Event Timeline

rupprecht created this revision.Jul 13 2018, 5:02 PM
rupprecht edited the summary of this revision. (Show Details)Jul 13 2018, 5:04 PM

Probably compiler-rt should be fixed so it doesn't need libm, rather than fixing clang to add -lm. (All the functions it currently uses can be implemented with simple bit manipulation.)

Thanks Eli, I'll see how hard it is to remove those calls to logb/logbf (those seem to be the only ones causing link errors) and revert this change if that's possible.

rupprecht abandoned this revision.Aug 8 2018, 9:17 AM