summaryrefslogtreecommitdiffstats
path: root/lld
diff options
context:
space:
mode:
Diffstat (limited to 'lld')
-rw-r--r--lld/ELF/Driver.cpp5
-rw-r--r--lld/test/ELF/lto-plugin-ignore.s3
-rw-r--r--lld/test/ELF/lto/cpu-string.ll8
3 files changed, 9 insertions, 7 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 7e55cd42536..92fcb5eb7d0 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -703,9 +703,10 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
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.
diff --git a/lld/test/ELF/lto-plugin-ignore.s b/lld/test/ELF/lto-plugin-ignore.s
index dfc017330ab..1393df917ed 100644
--- a/lld/test/ELF/lto-plugin-ignore.s
+++ b/lld/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
diff --git a/lld/test/ELF/lto/cpu-string.ll b/lld/test/ELF/lto/cpu-string.ll
index 17c3a7d983d..ff80dbb9a7b 100644
--- a/lld/test/ELF/lto/cpu-string.ll
+++ b/lld/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=<CPU> 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"
OpenPOWER on IntegriCloud