This is an archive of the discontinued LLVM Phabricator instance.

[libunwind] Emit dependent libraries only when detected by CMake
ClosedPublic

Authored by mgorny on Nov 30 2019, 6:20 AM.

Details

Summary

996e62eef75 added Linux-specific dependent libraries to libunwind
sources. As a result, building libunwind with modern LLD on *BSD
started failing due to trying to link libdl. Instead, add those
libraries only if they were detected by CMake.

While technically we could create a long list of systems that need -ldl
and -lpthread, maintaining a duplicate list makes little sense when
CMake needs to detect it for non-LLD systems anyway. Remove existing
system exceptions since they should be covered by the CMake check
anyway.

Remove -D_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA since it is no longer
explicitly needed, if we make the library-specific defines dependent
on presence of this pragma support.

Diff Detail

Event Timeline

mgorny created this revision.Nov 30 2019, 6:20 AM
phosek accepted this revision.Nov 30 2019, 7:27 PM

LGTM, thanks! Would it be possible to make the same change to libc++abi and libc++ as well (since they also use dependent library feature)?

This revision is now accepted and ready to land.Nov 30 2019, 7:27 PM
mgorny added a comment.Dec 1 2019, 8:17 AM

I'll look into it a bit later. I've focused on libunwind since it's breaking NetBSD buildbot.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptDec 1 2019, 8:23 AM