diff options
author | Dylan McKay <me@dylanmckay.io> | 2019-05-19 09:54:14 +0000 |
---|---|---|
committer | Dylan McKay <me@dylanmckay.io> | 2019-05-19 09:54:14 +0000 |
commit | 83338b1059aaf3393f52da1138425774c3514cdf (patch) | |
tree | 29288bd5ea7b2e92adeb77f49b5b76c7482edd2a /clang/lib/Driver/ToolChains/Gnu.cpp | |
parent | f8fccb14de2e925245d7e8b6b1f13e7ec5836eb0 (diff) | |
download | bcm5719-llvm-83338b1059aaf3393f52da1138425774c3514cdf.tar.gz bcm5719-llvm-83338b1059aaf3393f52da1138425774c3514cdf.zip |
[AVR] Automatically link CRT and libgcc from the system avr-gcc
Summary:
This patch modifies the AVR toolchain so that if avr-gcc and avr-libc
are detected during compilation, the CRT, libgcc, libm, and libc anre
linked.
This matches avr-gcc's default behaviour, and the expected behaviour of
all C compilers - including the C runtime.
avr-gcc also needs a -mmcu specified in order to link runtime libraries.
The difference betwen this patch and avr-gcc is that this patch will
warn users whenever they compile without a runtime, as opposed to GCC,
which silently trims the runtime libs from the linker arguments when no
-mmcu is specified.
Reviewers: aaron.ballman, kparzysz, asb, hfinkel, brucehoult, TimNN
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D54334
llvm-svn: 361116
Diffstat (limited to 'clang/lib/Driver/ToolChains/Gnu.cpp')
-rw-r--r-- | clang/lib/Driver/ToolChains/Gnu.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index 9180afd9105..d233d443ba8 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -1926,6 +1926,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( static const char *const ARMebHFTriples[] = { "armeb-linux-gnueabihf", "armebv7hl-redhat-linux-gnueabi"}; + static const char *const AVRLibDirs[] = {"/lib"}; + static const char *const AVRTriples[] = {"avr"}; + static const char *const X86_64LibDirs[] = {"/lib64", "/lib"}; static const char *const X86_64Triples[] = { "x86_64-linux-gnu", "x86_64-unknown-linux-gnu", @@ -2146,6 +2149,10 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( TripleAliases.append(begin(ARMebTriples), end(ARMebTriples)); } break; + case llvm::Triple::avr: + LibDirs.append(begin(AVRLibDirs), end(AVRLibDirs)); + TripleAliases.append(begin(AVRTriples), end(AVRTriples)); + break; case llvm::Triple::x86_64: LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs)); TripleAliases.append(begin(X86_64Triples), end(X86_64Triples)); @@ -2286,6 +2293,8 @@ bool Generic_GCC::GCCInstallationDetector::ScanGCCForMultilibs( findRISCVMultilibs(D, TargetTriple, Path, Args, Detected); } else if (isMSP430(TargetArch)) { findMSP430Multilibs(D, TargetTriple, Path, Args, Detected); + } else if (TargetArch == llvm::Triple::avr) { + // AVR has no multilibs. } else if (!findBiarchMultilibs(D, TargetTriple, Path, Args, NeedsBiarchSuffix, Detected)) { return false; |