Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1610,6 +1610,7 @@ def municode : Joined<["-"], "municode">, Group, Flags<[DriverOption]>; def mthreads : Joined<["-"], "mthreads">, Group, Flags<[DriverOption]>; def mcpu_EQ : Joined<["-"], "mcpu=">, Group; +def mmcu_EQ : Joined<["-"], "mmcu=">, Group; def mdynamic_no_pic : Joined<["-"], "mdynamic-no-pic">, Group; def mfix_and_continue : Flag<["-"], "mfix-and-continue">, Group; def mieee_fp : Flag<["-"], "mieee-fp">, Group; Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2136,6 +2136,12 @@ getARMArchCPUFromArgs(Args, MArch, MCPU, FromAs); return arm::getARMTargetCPU(MCPU, MArch, T); } + + case llvm::Triple::avr: + if (const Arg *A = Args.getLastArg(options::OPT_mmcu_EQ)) + return A->getValue(); + return ""; + case llvm::Triple::mips: case llvm::Triple::mipsel: case llvm::Triple::mips64: Index: test/Driver/avr-mmcu.c =================================================================== --- /dev/null +++ test/Driver/avr-mmcu.c @@ -0,0 +1,5 @@ +// A test for the propagation of the -mmcu option to -cc1 and -cc1as + +// RUN: %clang -### -target avr -mmcu=atmega328p -save-temps %s 2>&1 | FileCheck %s +// CHECK: clang{{.*}} "-cc1" {{.*}} "-target-cpu" "atmega328p" +// CHECK: clang{{.*}} "-cc1as" {{.*}} "-target-cpu" "atmega328p"