This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Don't link libm with -Wl,--as-needed on FreeBSD
ClosedPublic

Authored by jbeich on Sep 25 2019, 2:23 PM.

Details

Summary

-Wl,--as-needed omits libm when building with BFD linker (e.g., from GNU binutils 2.32). Affects FreeBSD 11.* amd64/armv6/i386, 12.0 armv6/i386 (where LLD is not default yet).

Fixes https://bugs.llvm.org/show_bug.cgi?id=32279

$ LDFLAGS=-fuse-ld=bfd cmake .
$ make libomp-micro-tests
[...]
ld: error: runtime/src/libomp.so: undefined reference to scalbnl
ld: error: runtime/src/libomp.so: undefined reference to fmaxl
ld: error: runtime/src/libomp.so: undefined reference to logbl
ld: error: runtime/src/libomp.so: undefined reference to scalbnf
ld: error: runtime/src/libomp.so: undefined reference to scalbn

Diff Detail

Event Timeline

jbeich created this revision.Sep 25 2019, 2:23 PM
dim added a comment.Sep 26 2019, 10:26 AM

LGTM from a FreeBSD point of view. :)

This revision is now accepted and ready to land.Sep 27 2019, 6:07 AM

Can someone land D68045, D68051 (this review), D68053? I didn't test on non-FreeBSD because contributing guide didn't cover how to.

This revision was automatically updated to reflect the committed changes.

Jan,
you may want to ask for D68045 landing there directly, as compiler-rt is a different project which I don't work on.