summaryrefslogtreecommitdiffstats
path: root/lib/Driver/ToolChains/Darwin.cpp
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2019-03-26 21:22:42 +0000
committerJessica Paquette <jpaquette@apple.com>2019-03-26 21:22:42 +0000
commit1eeae75f3fc8e59305cc7f738b11a0976cb4f0bc (patch)
tree1d83f0c783bf60e0fd67acbe8206fcb03821cde2 /lib/Driver/ToolChains/Darwin.cpp
parent7e997c278b6a5b1e2e39c7242dd854b3d10b58ee (diff)
Make -mno-outline pass -enable-machine-outliner=never to ld in LTO
Since AArch64 has default outlining behaviour, we need to make sure that -mno-outline is actually passed along to the linker in this case. Otherwise, it will run by default on minsize functions even when -mno-outline is specified. Also fix the darwin-ld test for this, which wasn't actually doing anything. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357031 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains/Darwin.cpp')
-rw-r--r--lib/Driver/ToolChains/Darwin.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp
index f91ab1946f..e113f9a679 100644
--- a/lib/Driver/ToolChains/Darwin.cpp
+++ b/lib/Driver/ToolChains/Darwin.cpp
@@ -494,14 +494,23 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
}
// Propagate the -moutline flag to the linker in LTO.
- if (Args.hasFlag(options::OPT_moutline, options::OPT_mno_outline, false)) {
- if (getMachOToolChain().getMachOArchName(Args) == "arm64") {
- CmdArgs.push_back("-mllvm");
- CmdArgs.push_back("-enable-machine-outliner");
+ if (Arg *A =
+ Args.getLastArg(options::OPT_moutline, options::OPT_mno_outline)) {
+ if (A->getOption().matches(options::OPT_moutline)) {
+ if (getMachOToolChain().getMachOArchName(Args) == "arm64") {
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("-enable-machine-outliner");
- // Outline from linkonceodr functions by default in LTO.
+ // Outline from linkonceodr functions by default in LTO.
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("-enable-linkonceodr-outlining");
+ }
+ } else {
+ // Disable all outlining behaviour if we have mno-outline. We need to do
+ // this explicitly, because targets which support default outlining will
+ // try to do work if we don't.
CmdArgs.push_back("-mllvm");
- CmdArgs.push_back("-enable-linkonceodr-outlining");
+ CmdArgs.push_back("-enable-machine-outliner=never");
}
}