This is an archive of the discontinued LLVM Phabricator instance.

Driver: Prefer gcc toolchains with libgcc_s.so when not static linking libgcc
Needs ReviewPublic

Authored by tstellar on Oct 3 2018, 9:29 PM.

Details

Reviewers
rsmith
dlj
Summary

Fedora ships cross-compilers on all platforms, so a user could end up
with a gcc x86_64 cross-compiler installed on an x86_64 system. clang
maintains a list of supported triples for each target and when all
else is equal will prefer toolchains with triples that appear earlier
in the list.

The cross-compiler triple on Fedora is x86_64-linux-gnu and this comes
before the Fedora system compiler's triple: x86_64-redhat-linux in
the triples list, so the cross compiler is always preferred. This
is a problem, because the cross compiler is missing libraries, like
libgcc_s.so, that clang expects to be there so linker invocations
will fail.

This patch fixes this by checking for the existence of libgcc_s.so
when it is required and taking that into account when selecting a
toolchain.

Diff Detail

Event Timeline

tstellar created this revision.Oct 3 2018, 9:29 PM
bruno added a subscriber: bruno.Oct 16 2018, 12:50 PM
jdenny added a subscriber: jdenny.Nov 20 2019, 11:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 20 2019, 11:13 AM

This patch handles libgcc_s.so, but what about libatomic.so? It's also not provided by x86_64-linux-gnu, at least on CentOS Linux release 7.7.1908.