Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -703,9 +703,10 @@ Config->LTOPartitions = parseInt(S.substr(15), Arg); else if (S.startswith("jobs=")) Config->ThinLTOJobs = parseInt(S.substr(5), Arg); + else if (S.startswith("mcpu=")) + LTOOptions.push_back(Saver.save("-" + S).data()); else if (!S.startswith("/") && !S.startswith("-fresolution=") && - !S.startswith("-pass-through=") && !S.startswith("mcpu=") && - !S.startswith("thinlto")) + !S.startswith("-pass-through=") && !S.startswith("thinlto")) LTOOptions.push_back(S.data()); } // Parse and evaluate -mllvm options. Index: test/ELF/lto-plugin-ignore.s =================================================================== --- test/ELF/lto-plugin-ignore.s +++ test/ELF/lto-plugin-ignore.s @@ -3,8 +3,7 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: ld.lld %t -plugin-opt=/foo/bar -plugin-opt=-fresolution=zed \ # RUN: -plugin-opt=-pass-through=-lgcc -plugin-opt=-function-sections \ -# RUN: -plugin-opt=-data-sections -plugin-opt=mcpu=x86-64 \ -# RUN: -plugin-opt=thinlto -o /dev/null +# RUN: -plugin-opt=-data-sections -plugin-opt=thinlto -o /dev/null # RUN: not ld.lld %t -plugin-opt=-data-sectionxxx \ # RUN: -plugin-opt=-function-sectionxxx 2>&1 | FileCheck %s Index: test/ELF/lto/cpu-string.ll =================================================================== --- test/ELF/lto/cpu-string.ll +++ test/ELF/lto/cpu-string.ll @@ -3,14 +3,16 @@ ; RUN: ld.lld %t.o -o %t.so -shared ; RUN: llvm-objdump -d -section=".text" -no-leading-addr -no-show-raw-insn %t.so | FileCheck %s +; CHECK: nop{{$}} ; RUN: ld.lld -mllvm -mcpu=znver1 %t.o -o %t.znver1.so -shared ; RUN: llvm-objdump -d -section=".text" -no-leading-addr -no-show-raw-insn %t.znver1.so | FileCheck -check-prefix=ZNVER1 %s - -; CHECK: nop{{$}} - ; ZNVER1: nopw +; Check we are able to use -plugin-opt=mcpu= to set CPU string. +; RUN: ld.lld -plugin-opt=mcpu=znver1 %t.o -o %t.znver1.so -shared +; RUN: llvm-objdump -d -section=".text" -no-leading-addr -no-show-raw-insn %t.znver1.so | FileCheck -check-prefix=ZNVER1 %s + target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu"