[llvm-branch-commits] [clang] 89a5147 - [clang][AVR] Improve avr-ld command line options

Ben Shi via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Jan 24 20:05:43 PST 2021


Author: Ben Shi
Date: 2021-01-25T12:01:26+08:00
New Revision: 89a5147e5a0c2e886cdf7ffa34799c069d825940

URL: https://github.com/llvm/llvm-project/commit/89a5147e5a0c2e886cdf7ffa34799c069d825940
DIFF: https://github.com/llvm/llvm-project/commit/89a5147e5a0c2e886cdf7ffa34799c069d825940.diff

LOG: [clang][AVR] Improve avr-ld command line options

Added: 
    clang/test/Driver/Inputs/basic_avr_tree/bin/avr-ld
    clang/test/Driver/Inputs/basic_avr_tree/lib/avr/lib/libavr.a
    clang/test/Driver/Inputs/basic_avr_tree/lib/gcc/avr/5.4.0/libgcc.a
    clang/test/Driver/avr-ld.c

Modified: 
    clang/lib/Driver/ToolChains/AVR.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/AVR.cpp b/clang/lib/Driver/ToolChains/AVR.cpp
index ae56b7b5249e..c999c3b87f84 100644
--- a/clang/lib/Driver/ToolChains/AVR.cpp
+++ b/clang/lib/Driver/ToolChains/AVR.cpp
@@ -32,247 +32,248 @@ const struct {
   StringRef Name;
   std::string SubPath;
   StringRef Family;
+  unsigned DataAddr;
 } MCUInfo[] = {
-    {"at90s1200", "", "avr1"},
-    {"attiny11", "", "avr1"},
-    {"attiny12", "", "avr1"},
-    {"attiny15", "", "avr1"},
-    {"attiny28", "", "avr1"},
-    {"at90s2313", "tiny-stack", "avr2"},
-    {"at90s2323", "tiny-stack", "avr2"},
-    {"at90s2333", "tiny-stack", "avr2"},
-    {"at90s2343", "tiny-stack", "avr2"},
-    {"at90s4433", "tiny-stack", "avr2"},
-    {"attiny22", "tiny-stack", "avr2"},
-    {"attiny26", "tiny-stack", "avr2"},
-    {"at90s4414", "", "avr2"},
-    {"at90s4434", "", "avr2"},
-    {"at90s8515", "", "avr2"},
-    {"at90c8534", "", "avr2"},
-    {"at90s8535", "", "avr2"},
-    {"attiny13", "avr25/tiny-stack", "avr25"},
-    {"attiny13a", "avr25/tiny-stack", "avr25"},
-    {"attiny2313", "avr25/tiny-stack", "avr25"},
-    {"attiny2313a", "avr25/tiny-stack", "avr25"},
-    {"attiny24", "avr25/tiny-stack", "avr25"},
-    {"attiny24a", "avr25/tiny-stack", "avr25"},
-    {"attiny25", "avr25/tiny-stack", "avr25"},
-    {"attiny261", "avr25/tiny-stack", "avr25"},
-    {"attiny261a", "avr25/tiny-stack", "avr25"},
-    {"at86rf401", "avr25", "avr25"},
-    {"ata5272", "avr25", "avr25"},
-    {"attiny4313", "avr25", "avr25"},
-    {"attiny44", "avr25", "avr25"},
-    {"attiny44a", "avr25", "avr25"},
-    {"attiny84", "avr25", "avr25"},
-    {"attiny84a", "avr25", "avr25"},
-    {"attiny45", "avr25", "avr25"},
-    {"attiny85", "avr25", "avr25"},
-    {"attiny441", "avr25", "avr25"},
-    {"attiny461", "avr25", "avr25"},
-    {"attiny461a", "avr25", "avr25"},
-    {"attiny841", "avr25", "avr25"},
-    {"attiny861", "avr25", "avr25"},
-    {"attiny861a", "avr25", "avr25"},
-    {"attiny87", "avr25", "avr25"},
-    {"attiny43u", "avr25", "avr25"},
-    {"attiny48", "avr25", "avr25"},
-    {"attiny88", "avr25", "avr25"},
-    {"attiny828", "avr25", "avr25"},
-    {"at43usb355", "avr3", "avr3"},
-    {"at76c711", "avr3", "avr3"},
-    {"atmega103", "avr31", "avr31"},
-    {"at43usb320", "avr31", "avr31"},
-    {"attiny167", "avr35", "avr35"},
-    {"at90usb82", "avr35", "avr35"},
-    {"at90usb162", "avr35", "avr35"},
-    {"ata5505", "avr35", "avr35"},
-    {"atmega8u2", "avr35", "avr35"},
-    {"atmega16u2", "avr35", "avr35"},
-    {"atmega32u2", "avr35", "avr35"},
-    {"attiny1634", "avr35", "avr35"},
-    {"atmega8", "avr4", "avr4"},
-    {"ata6289", "avr4", "avr4"},
-    {"atmega8a", "avr4", "avr4"},
-    {"ata6285", "avr4", "avr4"},
-    {"ata6286", "avr4", "avr4"},
-    {"atmega48", "avr4", "avr4"},
-    {"atmega48a", "avr4", "avr4"},
-    {"atmega48pa", "avr4", "avr4"},
-    {"atmega48pb", "avr4", "avr4"},
-    {"atmega48p", "avr4", "avr4"},
-    {"atmega88", "avr4", "avr4"},
-    {"atmega88a", "avr4", "avr4"},
-    {"atmega88p", "avr4", "avr4"},
-    {"atmega88pa", "avr4", "avr4"},
-    {"atmega88pb", "avr4", "avr4"},
-    {"atmega8515", "avr4", "avr4"},
-    {"atmega8535", "avr4", "avr4"},
-    {"atmega8hva", "avr4", "avr4"},
-    {"at90pwm1", "avr4", "avr4"},
-    {"at90pwm2", "avr4", "avr4"},
-    {"at90pwm2b", "avr4", "avr4"},
-    {"at90pwm3", "avr4", "avr4"},
-    {"at90pwm3b", "avr4", "avr4"},
-    {"at90pwm81", "avr4", "avr4"},
-    {"ata5790", "avr5", "avr5"},
-    {"ata5795", "avr5", "avr5"},
-    {"atmega16", "avr5", "avr5"},
-    {"atmega16a", "avr5", "avr5"},
-    {"atmega161", "avr5", "avr5"},
-    {"atmega162", "avr5", "avr5"},
-    {"atmega163", "avr5", "avr5"},
-    {"atmega164a", "avr5", "avr5"},
-    {"atmega164p", "avr5", "avr5"},
-    {"atmega164pa", "avr5", "avr5"},
-    {"atmega165", "avr5", "avr5"},
-    {"atmega165a", "avr5", "avr5"},
-    {"atmega165p", "avr5", "avr5"},
-    {"atmega165pa", "avr5", "avr5"},
-    {"atmega168", "avr5", "avr5"},
-    {"atmega168a", "avr5", "avr5"},
-    {"atmega168p", "avr5", "avr5"},
-    {"atmega168pa", "avr5", "avr5"},
-    {"atmega168pb", "avr5", "avr5"},
-    {"atmega169", "avr5", "avr5"},
-    {"atmega169a", "avr5", "avr5"},
-    {"atmega169p", "avr5", "avr5"},
-    {"atmega169pa", "avr5", "avr5"},
-    {"atmega32", "avr5", "avr5"},
-    {"atmega32a", "avr5", "avr5"},
-    {"atmega323", "avr5", "avr5"},
-    {"atmega324a", "avr5", "avr5"},
-    {"atmega324p", "avr5", "avr5"},
-    {"atmega324pa", "avr5", "avr5"},
-    {"atmega325", "avr5", "avr5"},
-    {"atmega325a", "avr5", "avr5"},
-    {"atmega325p", "avr5", "avr5"},
-    {"atmega325pa", "avr5", "avr5"},
-    {"atmega3250", "avr5", "avr5"},
-    {"atmega3250a", "avr5", "avr5"},
-    {"atmega3250p", "avr5", "avr5"},
-    {"atmega3250pa", "avr5", "avr5"},
-    {"atmega328", "avr5", "avr5"},
-    {"atmega328p", "avr5", "avr5"},
-    {"atmega329", "avr5", "avr5"},
-    {"atmega329a", "avr5", "avr5"},
-    {"atmega329p", "avr5", "avr5"},
-    {"atmega329pa", "avr5", "avr5"},
-    {"atmega3290", "avr5", "avr5"},
-    {"atmega3290a", "avr5", "avr5"},
-    {"atmega3290p", "avr5", "avr5"},
-    {"atmega3290pa", "avr5", "avr5"},
-    {"atmega406", "avr5", "avr5"},
-    {"atmega64", "avr5", "avr5"},
-    {"atmega64a", "avr5", "avr5"},
-    {"atmega640", "avr5", "avr5"},
-    {"atmega644", "avr5", "avr5"},
-    {"atmega644a", "avr5", "avr5"},
-    {"atmega644p", "avr5", "avr5"},
-    {"atmega644pa", "avr5", "avr5"},
-    {"atmega645", "avr5", "avr5"},
-    {"atmega645a", "avr5", "avr5"},
-    {"atmega645p", "avr5", "avr5"},
-    {"atmega649", "avr5", "avr5"},
-    {"atmega649a", "avr5", "avr5"},
-    {"atmega649p", "avr5", "avr5"},
-    {"atmega6450", "avr5", "avr5"},
-    {"atmega6450a", "avr5", "avr5"},
-    {"atmega6450p", "avr5", "avr5"},
-    {"atmega6490", "avr5", "avr5"},
-    {"atmega6490a", "avr5", "avr5"},
-    {"atmega6490p", "avr5", "avr5"},
-    {"atmega64rfr2", "avr5", "avr5"},
-    {"atmega644rfr2", "avr5", "avr5"},
-    {"atmega16hva", "avr5", "avr5"},
-    {"atmega16hva2", "avr5", "avr5"},
-    {"atmega16hvb", "avr5", "avr5"},
-    {"atmega16hvbrevb", "avr5", "avr5"},
-    {"atmega32hvb", "avr5", "avr5"},
-    {"atmega32hvbrevb", "avr5", "avr5"},
-    {"atmega64hve", "avr5", "avr5"},
-    {"at90can32", "avr5", "avr5"},
-    {"at90can64", "avr5", "avr5"},
-    {"at90pwm161", "avr5", "avr5"},
-    {"at90pwm216", "avr5", "avr5"},
-    {"at90pwm316", "avr5", "avr5"},
-    {"atmega32c1", "avr5", "avr5"},
-    {"atmega64c1", "avr5", "avr5"},
-    {"atmega16m1", "avr5", "avr5"},
-    {"atmega32m1", "avr5", "avr5"},
-    {"atmega64m1", "avr5", "avr5"},
-    {"atmega16u4", "avr5", "avr5"},
-    {"atmega32u4", "avr5", "avr5"},
-    {"atmega32u6", "avr5", "avr5"},
-    {"at90usb646", "avr5", "avr5"},
-    {"at90usb647", "avr5", "avr5"},
-    {"at90scr100", "avr5", "avr5"},
-    {"at94k", "avr5", "avr5"},
-    {"m3000", "avr5", "avr5"},
-    {"atmega128", "avr51", "avr51"},
-    {"atmega128a", "avr51", "avr51"},
-    {"atmega1280", "avr51", "avr51"},
-    {"atmega1281", "avr51", "avr51"},
-    {"atmega1284", "avr51", "avr51"},
-    {"atmega1284p", "avr51", "avr51"},
-    {"atmega128rfa1", "avr51", "avr51"},
-    {"atmega128rfr2", "avr51", "avr51"},
-    {"atmega1284rfr2", "avr51", "avr51"},
-    {"at90can128", "avr51", "avr51"},
-    {"at90usb1286", "avr51", "avr51"},
-    {"at90usb1287", "avr51", "avr51"},
-    {"atmega2560", "avr6", "avr6"},
-    {"atmega2561", "avr6", "avr6"},
-    {"atmega256rfr2", "avr6", "avr6"},
-    {"atmega2564rfr2", "avr6", "avr6"},
-    {"attiny4", "avrtiny", "avrtiny"},
-    {"attiny5", "avrtiny", "avrtiny"},
-    {"attiny9", "avrtiny", "avrtiny"},
-    {"attiny10", "avrtiny", "avrtiny"},
-    {"attiny20", "avrtiny", "avrtiny"},
-    {"attiny40", "avrtiny", "avrtiny"},
-    {"atxmega16a4", "avrxmega2", "avrxmega2"},
-    {"atxmega16a4u", "avrxmega2", "avrxmega2"},
-    {"atxmega16c4", "avrxmega2", "avrxmega2"},
-    {"atxmega16d4", "avrxmega2", "avrxmega2"},
-    {"atxmega32a4", "avrxmega2", "avrxmega2"},
-    {"atxmega32a4u", "avrxmega2", "avrxmega2"},
-    {"atxmega32c4", "avrxmega2", "avrxmega2"},
-    {"atxmega32d4", "avrxmega2", "avrxmega2"},
-    {"atxmega32e5", "avrxmega2", "avrxmega2"},
-    {"atxmega16e5", "avrxmega2", "avrxmega2"},
-    {"atxmega8e5", "avrxmega2", "avrxmega2"},
-    {"atxmega64a3u", "avrxmega4", "avrxmega4"},
-    {"atxmega64a4u", "avrxmega4", "avrxmega4"},
-    {"atxmega64b1", "avrxmega4", "avrxmega4"},
-    {"atxmega64b3", "avrxmega4", "avrxmega4"},
-    {"atxmega64c3", "avrxmega4", "avrxmega4"},
-    {"atxmega64d3", "avrxmega4", "avrxmega4"},
-    {"atxmega64d4", "avrxmega4", "avrxmega4"},
-    {"atxmega64a1", "avrxmega5", "avrxmega5"},
-    {"atxmega64a1u", "avrxmega5", "avrxmega5"},
-    {"atxmega128a3", "avrxmega6", "avrxmega6"},
-    {"atxmega128a3u", "avrxmega6", "avrxmega6"},
-    {"atxmega128b1", "avrxmega6", "avrxmega6"},
-    {"atxmega128b3", "avrxmega6", "avrxmega6"},
-    {"atxmega128c3", "avrxmega6", "avrxmega6"},
-    {"atxmega128d3", "avrxmega6", "avrxmega6"},
-    {"atxmega128d4", "avrxmega6", "avrxmega6"},
-    {"atxmega192a3", "avrxmega6", "avrxmega6"},
-    {"atxmega192a3u", "avrxmega6", "avrxmega6"},
-    {"atxmega192c3", "avrxmega6", "avrxmega6"},
-    {"atxmega192d3", "avrxmega6", "avrxmega6"},
-    {"atxmega256a3", "avrxmega6", "avrxmega6"},
-    {"atxmega256a3u", "avrxmega6", "avrxmega6"},
-    {"atxmega256a3b", "avrxmega6", "avrxmega6"},
-    {"atxmega256a3bu", "avrxmega6", "avrxmega6"},
-    {"atxmega256c3", "avrxmega6", "avrxmega6"},
-    {"atxmega256d3", "avrxmega6", "avrxmega6"},
-    {"atxmega384c3", "avrxmega6", "avrxmega6"},
-    {"atxmega384d3", "avrxmega6", "avrxmega6"},
-    {"atxmega128a1", "avrxmega7", "avrxmega7"},
-    {"atxmega128a1u", "avrxmega7", "avrxmega7"},
-    {"atxmega128a4u", "avrxmega7", "avrxmega7"},
+    {"at90s1200", "", "avr1", 0},
+    {"attiny11", "", "avr1", 0},
+    {"attiny12", "", "avr1", 0},
+    {"attiny15", "", "avr1", 0},
+    {"attiny28", "", "avr1", 0},
+    {"at90s2313", "tiny-stack", "avr2", 0x800060},
+    {"at90s2323", "tiny-stack", "avr2", 0x800060},
+    {"at90s2333", "tiny-stack", "avr2", 0x800060},
+    {"at90s2343", "tiny-stack", "avr2", 0x800060},
+    {"at90s4433", "tiny-stack", "avr2, 0x800060"},
+    {"attiny22", "tiny-stack", "avr2", 0x800060},
+    {"attiny26", "tiny-stack", "avr2", 0x800060},
+    {"at90s4414", "", "avr2", 0x800060},
+    {"at90s4434", "", "avr2", 0x800060},
+    {"at90s8515", "", "avr2", 0x800060},
+    {"at90c8534", "", "avr2", 0x800060},
+    {"at90s8535", "", "avr2", 0x800060},
+    {"attiny13", "avr25/tiny-stack", "avr25", 0x800060},
+    {"attiny13a", "avr25/tiny-stack", "avr25", 0x800060},
+    {"attiny2313", "avr25/tiny-stack", "avr25", 0x800060},
+    {"attiny2313a", "avr25/tiny-stack", "avr25", 0x800060},
+    {"attiny24", "avr25/tiny-stack", "avr25", 0x800060},
+    {"attiny24a", "avr25/tiny-stack", "avr25", 0x800060},
+    {"attiny25", "avr25/tiny-stack", "avr25", 0x800060},
+    {"attiny261", "avr25/tiny-stack", "avr25", 0x800060},
+    {"attiny261a", "avr25/tiny-stack", "avr25", 0x800060},
+    {"at86rf401", "avr25", "avr25", 0x800060},
+    {"ata5272", "avr25", "avr25", 0x800100},
+    {"attiny4313", "avr25", "avr25", 0x800060},
+    {"attiny44", "avr25", "avr25", 0x800060},
+    {"attiny44a", "avr25", "avr25", 0x800060},
+    {"attiny84", "avr25", "avr25", 0x800060},
+    {"attiny84a", "avr25", "avr25", 0x800060},
+    {"attiny45", "avr25", "avr25", 0x800060},
+    {"attiny85", "avr25", "avr25", 0x800060},
+    {"attiny441", "avr25", "avr25", 0x800100},
+    {"attiny461", "avr25", "avr25", 0x800060},
+    {"attiny461a", "avr25", "avr25", 0x800060},
+    {"attiny841", "avr25", "avr25", 0x800100},
+    {"attiny861", "avr25", "avr25", 0x800060},
+    {"attiny861a", "avr25", "avr25", 0x800060},
+    {"attiny87", "avr25", "avr25", 0x800100},
+    {"attiny43u", "avr25", "avr25", 0x800060},
+    {"attiny48", "avr25", "avr25", 0x800100},
+    {"attiny88", "avr25", "avr25", 0x800100},
+    {"attiny828", "avr25", "avr25", 0x800100},
+    {"at43usb355", "avr3", "avr3", 0x800100},
+    {"at76c711", "avr3", "avr3", 0x800060},
+    {"atmega103", "avr31", "avr31", 0x800060},
+    {"at43usb320", "avr31", "avr31", 0x800060},
+    {"attiny167", "avr35", "avr35", 0x800100},
+    {"at90usb82", "avr35", "avr35", 0x800100},
+    {"at90usb162", "avr35", "avr35", 0x800100},
+    {"ata5505", "avr35", "avr35", 0x800100},
+    {"atmega8u2", "avr35", "avr35", 0x800100},
+    {"atmega16u2", "avr35", "avr35", 0x800100},
+    {"atmega32u2", "avr35", "avr35", 0x800100},
+    {"attiny1634", "avr35", "avr35", 0x800100},
+    {"atmega8", "avr4", "avr4", 0x800060},
+    {"ata6289", "avr4", "avr4", 0x800100},
+    {"atmega8a", "avr4", "avr4", 0x800060},
+    {"ata6285", "avr4", "avr4", 0x800100},
+    {"ata6286", "avr4", "avr4", 0x800100},
+    {"atmega48", "avr4", "avr4", 0x800100},
+    {"atmega48a", "avr4", "avr4", 0x800100},
+    {"atmega48pa", "avr4", "avr4", 0x800100},
+    {"atmega48pb", "avr4", "avr4", 0x800100},
+    {"atmega48p", "avr4", "avr4", 0x800100},
+    {"atmega88", "avr4", "avr4", 0x800100},
+    {"atmega88a", "avr4", "avr4", 0x800100},
+    {"atmega88p", "avr4", "avr4", 0x800100},
+    {"atmega88pa", "avr4", "avr4", 0x800100},
+    {"atmega88pb", "avr4", "avr4", 0x800100},
+    {"atmega8515", "avr4", "avr4", 0x800060},
+    {"atmega8535", "avr4", "avr4", 0x800060},
+    {"atmega8hva", "avr4", "avr4", 0x800100},
+    {"at90pwm1", "avr4", "avr4", 0x800100},
+    {"at90pwm2", "avr4", "avr4", 0x800100},
+    {"at90pwm2b", "avr4", "avr4", 0x800100},
+    {"at90pwm3", "avr4", "avr4", 0x800100},
+    {"at90pwm3b", "avr4", "avr4", 0x800100},
+    {"at90pwm81", "avr4", "avr4", 0x800100},
+    {"ata5790", "avr5", "avr5", 0x800100},
+    {"ata5795", "avr5", "avr5", 0x800100},
+    {"atmega16", "avr5", "avr5", 0x800060},
+    {"atmega16a", "avr5", "avr5", 0x800060},
+    {"atmega161", "avr5", "avr5", 0x800060},
+    {"atmega162", "avr5", "avr5", 0x800100},
+    {"atmega163", "avr5", "avr5", 0x800060},
+    {"atmega164a", "avr5", "avr5", 0x800100},
+    {"atmega164p", "avr5", "avr5", 0x800100},
+    {"atmega164pa", "avr5", "avr5", 0x800100},
+    {"atmega165", "avr5", "avr5", 0x800100},
+    {"atmega165a", "avr5", "avr5", 0x800100},
+    {"atmega165p", "avr5", "avr5", 0x800100},
+    {"atmega165pa", "avr5", "avr5", 0x800100},
+    {"atmega168", "avr5", "avr5", 0x800100},
+    {"atmega168a", "avr5", "avr5", 0x800100},
+    {"atmega168p", "avr5", "avr5", 0x800100},
+    {"atmega168pa", "avr5", "avr5", 0x800100},
+    {"atmega168pb", "avr5", "avr5", 0x800100},
+    {"atmega169", "avr5", "avr5", 0x800100},
+    {"atmega169a", "avr5", "avr5", 0x800100},
+    {"atmega169p", "avr5", "avr5", 0x800100},
+    {"atmega169pa", "avr5", "avr5", 0x800100},
+    {"atmega32", "avr5", "avr5", 0x800060},
+    {"atmega32a", "avr5", "avr5", 0x800060},
+    {"atmega323", "avr5", "avr5", 0x800060},
+    {"atmega324a", "avr5", "avr5", 0x800100},
+    {"atmega324p", "avr5", "avr5", 0x800100},
+    {"atmega324pa", "avr5", "avr5", 0x800100},
+    {"atmega325", "avr5", "avr5", 0x800100},
+    {"atmega325a", "avr5", "avr5", 0x800100},
+    {"atmega325p", "avr5", "avr5", 0x800100},
+    {"atmega325pa", "avr5", "avr5", 0x800100},
+    {"atmega3250", "avr5", "avr5", 0x800100},
+    {"atmega3250a", "avr5", "avr5", 0x800100},
+    {"atmega3250p", "avr5", "avr5", 0x800100},
+    {"atmega3250pa", "avr5", "avr5", 0x800100},
+    {"atmega328", "avr5", "avr5", 0x800100},
+    {"atmega328p", "avr5", "avr5", 0x800100},
+    {"atmega329", "avr5", "avr5", 0x800100},
+    {"atmega329a", "avr5", "avr5", 0x800100},
+    {"atmega329p", "avr5", "avr5", 0x800100},
+    {"atmega329pa", "avr5", "avr5", 0x800100},
+    {"atmega3290", "avr5", "avr5", 0x800100},
+    {"atmega3290a", "avr5", "avr5", 0x800100},
+    {"atmega3290p", "avr5", "avr5", 0x800100},
+    {"atmega3290pa", "avr5", "avr5", 0x800100},
+    {"atmega406", "avr5", "avr5", 0x800100},
+    {"atmega64", "avr5", "avr5", 0x800100},
+    {"atmega64a", "avr5", "avr5", 0x800100},
+    {"atmega640", "avr5", "avr5", 0x800200},
+    {"atmega644", "avr5", "avr5", 0x800100},
+    {"atmega644a", "avr5", "avr5", 0x800100},
+    {"atmega644p", "avr5", "avr5", 0x800100},
+    {"atmega644pa", "avr5", "avr5", 0x800100},
+    {"atmega645", "avr5", "avr5", 0x800100},
+    {"atmega645a", "avr5", "avr5", 0x800100},
+    {"atmega645p", "avr5", "avr5", 0x800100},
+    {"atmega649", "avr5", "avr5", 0x800100},
+    {"atmega649a", "avr5", "avr5", 0x800100},
+    {"atmega649p", "avr5", "avr5", 0x800100},
+    {"atmega6450", "avr5", "avr5", 0x800100},
+    {"atmega6450a", "avr5", "avr5", 0x800100},
+    {"atmega6450p", "avr5", "avr5", 0x800100},
+    {"atmega6490", "avr5", "avr5", 0x800100},
+    {"atmega6490a", "avr5", "avr5", 0x800100},
+    {"atmega6490p", "avr5", "avr5", 0x800100},
+    {"atmega64rfr2", "avr5", "avr5", 0x800200},
+    {"atmega644rfr2", "avr5", "avr5", 0x800200},
+    {"atmega16hva", "avr5", "avr5", 0x800100},
+    {"atmega16hva2", "avr5", "avr5", 0x800100},
+    {"atmega16hvb", "avr5", "avr5", 0x800100},
+    {"atmega16hvbrevb", "avr5", "avr5", 0x800100},
+    {"atmega32hvb", "avr5", "avr5", 0x800100},
+    {"atmega32hvbrevb", "avr5", "avr5", 0x800100},
+    {"atmega64hve", "avr5", "avr5", 0x800100},
+    {"at90can32", "avr5", "avr5", 0x800100},
+    {"at90can64", "avr5", "avr5", 0x800100},
+    {"at90pwm161", "avr5", "avr5", 0x800100},
+    {"at90pwm216", "avr5", "avr5", 0x800100},
+    {"at90pwm316", "avr5", "avr5", 0x800100},
+    {"atmega32c1", "avr5", "avr5", 0x800100},
+    {"atmega64c1", "avr5", "avr5", 0x800100},
+    {"atmega16m1", "avr5", "avr5", 0x800100},
+    {"atmega32m1", "avr5", "avr5", 0x800100},
+    {"atmega64m1", "avr5", "avr5", 0x800100},
+    {"atmega16u4", "avr5", "avr5", 0x800100},
+    {"atmega32u4", "avr5", "avr5", 0x800100},
+    {"atmega32u6", "avr5", "avr5", 0x800100},
+    {"at90usb646", "avr5", "avr5", 0x800100},
+    {"at90usb647", "avr5", "avr5", 0x800100},
+    {"at90scr100", "avr5", "avr5", 0x800100},
+    {"at94k", "avr5", "avr5", 0x800060},
+    {"m3000", "avr5", "avr5", 0x800060},
+    {"atmega128", "avr51", "avr51", 0x800100},
+    {"atmega128a", "avr51", "avr51", 0x800100},
+    {"atmega1280", "avr51", "avr51", 0x800200},
+    {"atmega1281", "avr51", "avr51", 0x800200},
+    {"atmega1284", "avr51", "avr51", 0x800100},
+    {"atmega1284p", "avr51", "avr51", 0x800100},
+    {"atmega128rfa1", "avr51", "avr51", 0x800200},
+    {"atmega128rfr2", "avr51", "avr51", 0x800200},
+    {"atmega1284rfr2", "avr51", "avr51", 0x800200},
+    {"at90can128", "avr51", "avr51", 0x800200},
+    {"at90usb1286", "avr51", "avr51", 0x800200},
+    {"at90usb1287", "avr51", "avr51", 0x800200},
+    {"atmega2560", "avr6", "avr6", 0x800200},
+    {"atmega2561", "avr6", "avr6", 0x800200},
+    {"atmega256rfr2", "avr6", "avr6", 0x800200},
+    {"atmega2564rfr2", "avr6", "avr6", 0x800200},
+    {"attiny4", "avrtiny", "avrtiny", 0x800040},
+    {"attiny5", "avrtiny", "avrtiny", 0x800040},
+    {"attiny9", "avrtiny", "avrtiny", 0x800040},
+    {"attiny10", "avrtiny", "avrtiny", 0x800040},
+    {"attiny20", "avrtiny", "avrtiny", 0x800040},
+    {"attiny40", "avrtiny", "avrtiny", 0x800040},
+    {"atxmega16a4", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega16a4u", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega16c4", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega16d4", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega32a4", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega32a4u", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega32c4", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega32d4", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega32e5", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega16e5", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega8e5", "avrxmega2", "avrxmega2", 0x802000},
+    {"atxmega64a3u", "avrxmega4", "avrxmega4", 0x802000},
+    {"atxmega64a4u", "avrxmega4", "avrxmega4", 0x802000},
+    {"atxmega64b1", "avrxmega4", "avrxmega4", 0x802000},
+    {"atxmega64b3", "avrxmega4", "avrxmega4", 0x802000},
+    {"atxmega64c3", "avrxmega4", "avrxmega4", 0x802000},
+    {"atxmega64d3", "avrxmega4", "avrxmega4", 0x802000},
+    {"atxmega64d4", "avrxmega4", "avrxmega4", 0x802000},
+    {"atxmega64a1", "avrxmega5", "avrxmega5", 0x802000},
+    {"atxmega64a1u", "avrxmega5", "avrxmega5", 0x802000},
+    {"atxmega128a3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega128a3u", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega128b1", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega128b3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega128c3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega128d3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega128d4", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega192a3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega192a3u", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega192c3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega192d3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega256a3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega256a3u", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega256a3b", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega256a3bu", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega256c3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega256d3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega384c3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega384d3", "avrxmega6", "avrxmega6", 0x802000},
+    {"atxmega128a1", "avrxmega7", "avrxmega7", 0x802000},
+    {"atxmega128a1u", "avrxmega7", "avrxmega7", 0x802000},
+    {"atxmega128a4u", "avrxmega7", "avrxmega7", 0x802000},
 };
 
 std::string GetMCUSubPath(StringRef MCUName) {
@@ -289,11 +290,11 @@ llvm::Optional<StringRef> GetMCUFamilyName(StringRef MCUName) {
   return Optional<StringRef>();
 }
 
-llvm::Optional<unsigned> GetMCUSectionAddressData(StringRef MCU) {
-  return llvm::StringSwitch<llvm::Optional<unsigned>>(MCU)
-      .Case("atmega328", Optional<unsigned>(0x800100))
-      .Case("atmega328p", Optional<unsigned>(0x800100))
-      .Default(Optional<unsigned>());
+llvm::Optional<unsigned> GetMCUSectionAddressData(StringRef MCUName) {
+  for (const auto &MCU : MCUInfo)
+    if (MCU.Name == MCUName && MCU.DataAddr > 0)
+      return Optional<unsigned>(MCU.DataAddr);
+  return Optional<unsigned>();
 }
 
 const StringRef PossibleAVRLibcLocations[] = {

diff  --git a/clang/test/Driver/Inputs/basic_avr_tree/bin/avr-ld b/clang/test/Driver/Inputs/basic_avr_tree/bin/avr-ld
new file mode 100755
index 000000000000..e69de29bb2d1

diff  --git a/clang/test/Driver/Inputs/basic_avr_tree/lib/avr/lib/libavr.a b/clang/test/Driver/Inputs/basic_avr_tree/lib/avr/lib/libavr.a
new file mode 100644
index 000000000000..e69de29bb2d1

diff  --git a/clang/test/Driver/Inputs/basic_avr_tree/lib/gcc/avr/5.4.0/libgcc.a b/clang/test/Driver/Inputs/basic_avr_tree/lib/gcc/avr/5.4.0/libgcc.a
new file mode 100644
index 000000000000..e69de29bb2d1

diff  --git a/clang/test/Driver/avr-ld.c b/clang/test/Driver/avr-ld.c
new file mode 100644
index 000000000000..535990bf9570
--- /dev/null
+++ b/clang/test/Driver/avr-ld.c
@@ -0,0 +1,44 @@
+// RUN: %clang -### --target=avr -mmcu=at90s2313 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKA %s
+// LINKA: {{".*ld.*"}} {{.*}} {{"-L.*tiny-stack"}} {{.*}} "-Tdata=0x800060" {{.*}} "-lat90s2313" "-mavr2"
+
+// RUN: %clang -### --target=avr -mmcu=at90s8515 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKB %s
+// LINKB: {{".*ld.*"}} {{.*}} "-Tdata=0x800060" {{.*}} "-lat90s8515" "-mavr2"
+
+// RUN: %clang -### --target=avr -mmcu=attiny13 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKC %s
+// LINKC: {{".*ld.*"}} {{.*}} {{"-L.*avr25/tiny-stack"}} {{.*}} "-Tdata=0x800060" {{.*}} "-lattiny13" "-mavr25"
+
+// RUN: %clang -### --target=avr -mmcu=attiny44 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKD %s
+// LINKD: {{".*ld.*"}} {{.*}} {{"-L.*avr25"}} {{.*}} "-Tdata=0x800060" {{.*}} "-lattiny44" "-mavr25"
+
+// RUN: %clang -### --target=avr -mmcu=atmega103 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKE %s
+// LINKE: {{".*ld.*"}} {{.*}} {{"-L.*avr31"}} {{.*}} "-Tdata=0x800060" {{.*}} "-latmega103" "-mavr31"
+
+// RUN: %clang -### --target=avr -mmcu=atmega8u2 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKF %s
+// LINKF: {{".*ld.*"}} {{.*}} {{"-L.*avr35"}} {{.*}} "-Tdata=0x800100" {{.*}} "-latmega8u2" "-mavr35"
+
+// RUN: %clang -### --target=avr -mmcu=atmega48pa --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKG %s
+// LINKG: {{".*ld.*"}} {{.*}} {{"-L.*avr4"}} {{.*}} "-Tdata=0x800100" {{.*}} "-latmega48pa" "-mavr4"
+
+// RUN: %clang -### --target=avr -mmcu=atmega328 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKH %s
+// LINKH: {{".*ld.*"}} {{.*}} {{"-L.*avr5"}} {{.*}} "-Tdata=0x800100" {{.*}} "-latmega328" "-mavr5"
+
+// RUN: %clang -### --target=avr -mmcu=atmega1281 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKI %s
+// LINKI: {{".*ld.*"}} {{.*}} {{"-L.*avr51"}} {{.*}} "-Tdata=0x800200" {{.*}} "-latmega1281" "-mavr51"
+
+// RUN: %clang -### --target=avr -mmcu=atmega2560 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKJ %s
+// LINKJ: {{".*ld.*"}} {{.*}} {{"-L.*avr6"}} {{.*}} "-Tdata=0x800200" {{.*}} "-latmega2560" "-mavr6"
+
+// RUN: %clang -### --target=avr -mmcu=attiny10 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKK %s
+// LINKK: {{".*ld.*"}} {{.*}} {{"-L.*avrtiny"}} {{.*}} "-Tdata=0x800040" {{.*}} "-lattiny10" "-mavrtiny"
+
+// RUN: %clang -### --target=avr -mmcu=atxmega16a4 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKL %s
+// LINKL: {{".*ld.*"}} {{.*}} {{"-L.*avrxmega2"}} {{.*}} "-Tdata=0x802000" {{.*}} "-latxmega16a4" "-mavrxmega2"
+
+// RUN: %clang -### --target=avr -mmcu=atxmega64b3 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKM %s
+// LINKM: {{".*ld.*"}} {{.*}} {{"-L.*avrxmega4"}} {{.*}} "-Tdata=0x802000" {{.*}} "-latxmega64b3" "-mavrxmega4"
+
+// RUN: %clang -### --target=avr -mmcu=atxmega128a3u --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKN %s
+// LINKN: {{".*ld.*"}} {{.*}} {{"-L.*avrxmega6"}} {{.*}} "-Tdata=0x802000" {{.*}} "-latxmega128a3u" "-mavrxmega6"
+
+// RUN: %clang -### --target=avr -mmcu=atxmega128a1 --sysroot %S/Inputs/basic_avr_tree %s 2>&1 | FileCheck -check-prefix LINKO %s
+// LINKO: {{".*ld.*"}} {{.*}} {{"-L.*avrxmega7"}} {{.*}} "-Tdata=0x802000" {{.*}} "-latxmega128a1" "-mavrxmega7"


        


More information about the llvm-branch-commits mailing list