This is an archive of the discontinued LLVM Phabricator instance.

Setting linker language for libunwind and libc++
AbandonedPublic

Authored by plotfi on Nov 5 2019, 6:04 PM.

Details

Summary

Sets the linker language to 'C' so that the driver used to link is the 'C' driver (clang) instead of the 'C++' driver (clang++). Since libc++ does not depend on an existing C++ runtime we need to avoid the implicit circular dependency to a C++ library by the driver. This means we should either use the 'C' driver (clang) instead of the 'C++' driver (clang++) or we should use the '-nostdlib++' clang (which is non-portable). Using the C driver for linking has the benefit of not longer requiring the non-portable '-nostdlib++' flag to avoid injecting the link against an existing C++ runtime.

Diff Detail

Event Timeline

plotfi created this revision.Nov 5 2019, 6:04 PM
Herald added a project: Restricted Project. · View Herald Transcript
mgorny requested changes to this revision.Nov 5 2019, 11:42 PM

This version also breaks libc++ tests on NetBSD. Furthermore, a better explanation than 'needs to be set' would be good.

libunwind/src/CMakeLists.txt
130 ↗(On Diff #227990)
This revision now requires changes to proceed.Nov 5 2019, 11:42 PM
plotfi edited the summary of this revision. (Show Details)Nov 6 2019, 9:09 AM
plotfi updated this revision to Diff 228081.Nov 6 2019, 9:16 AM
plotfi edited the summary of this revision. (Show Details)

drop changed already committed by compnerd.
Move -Wl,-z,defs change to another diff.

plotfi marked an inline comment as done.Nov 6 2019, 9:16 AM

This version also breaks libc++ tests on NetBSD. Furthermore, a better explanation than 'needs to be set' would be good.

Sorry about this. Hadn't thought through the full description yesterday. Updated.

Actually, compnerd has reverted his change, so I suppose this is back up for discussion.

plotfi added a comment.Nov 6 2019, 3:09 PM

Actually, compnerd has reverted his change, so I suppose this is back up for discussion.

We are working on a new change to address the netbsd issues. There appears to be a case where cmake is injecting incorrect linkage when building for NetBSD, which caused the bot failures when the linker language was changed.

plotfi abandoned this revision.Nov 6 2019, 3:09 PM