Page MenuHomePhabricator

Driver: Prefer vendor supplied gcc toolchain
Needs ReviewPublic

Authored by tstellar on Jan 26 2018, 3:38 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This patch fixes an issue on Fedora where if you had the x86_64 cross
compiler installed on your x86_64 system, then clang would use that compiler
as the default toolchain. This was happening because the cross compiler
is installed to /usr/lib/gcc/x86_64-linux-gnu/ and this directory comes before
the default compiler directory (/usr/lib/gcc/x86_64-redhat-linux/) in the search
list.

This patch re-orders the search list so that vendor supplied gcc toolchains
are selected before toolchains with a generic target, which should prevent
these kind of issues on other OSes too.

Diff Detail

Event Timeline

tstellar created this revision.Jan 26 2018, 3:38 PM
bruno added a subscriber: bruno.Mar 23 2018, 4:51 PM

The change seems fine.

Perhaps add tests to make sure this won't cause problems in the future? Something along the lines of test/Driver/linux-ld.c?

I've implemented an alternative solution here that I think is a little more robust: https://reviews.llvm.org/D52861