Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1655,6 +1655,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/ToolChains/CommonArgs.cpp =================================================================== --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -261,6 +261,12 @@ arm::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"