summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2019-05-13 00:07:06 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2019-05-13 00:07:06 +0000
commit9131f5a7ac0fceee2ea1dac1b5f451cb133c6cce (patch)
treea812f930ff26c656750a071e65cce08bcb2f43a0
parent67ef41f717a5ff022a8ef6bb348e1341da7c3633 (diff)
Add support for -znoretpolineplt and make -zretpolineplt the default.
Affects i386 and amd64 only. ok deraadt@ kettenis@
-rw-r--r--gnu/llvm/tools/lld/ELF/Driver.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/gnu/llvm/tools/lld/ELF/Driver.cpp b/gnu/llvm/tools/lld/ELF/Driver.cpp
index c064d307698..e425a289aa4 100644
--- a/gnu/llvm/tools/lld/ELF/Driver.cpp
+++ b/gnu/llvm/tools/lld/ELF/Driver.cpp
@@ -344,7 +344,8 @@ static bool isKnown(StringRef S) {
S == "keep-text-section-prefix" || S == "lazy" || S == "muldefs" ||
S == "nocombreloc" || S == "nocopyreloc" || S == "nodelete" ||
S == "nodlopen" || S == "noexecstack" ||
- S == "nokeep-text-section-prefix" || S == "norelro" || S == "notext" ||
+ S == "nokeep-text-section-prefix" || S == "norelro" ||
+ S == "noretpolineplt" || S == "notext" ||
S == "now" || S == "origin" || S == "relro" || S == "retpolineplt" ||
S == "rodynamic" || S == "text" || S == "wxneeded" ||
S.startswith("max-page-size=") || S.startswith("stack-size=");
@@ -860,7 +861,11 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->ZNow = getZFlag(Args, "now", "lazy", false);
Config->ZOrigin = hasZOption(Args, "origin");
Config->ZRelro = getZFlag(Args, "relro", "norelro", true);
- Config->ZRetpolineplt = hasZOption(Args, "retpolineplt");
+#ifndef __OpenBSD__
+ Config->ZRetpolineplt = getZFlag(Args, "retpolineplt", "noretpolineplt", false);
+#else
+ Config->ZRetpolineplt = getZFlag(Args, "retpolineplt", "noretpolineplt", true);
+#endif
Config->ZRodynamic = hasZOption(Args, "rodynamic");
Config->ZStackSize = args::getZOptionValue(Args, OPT_z, "stack-size", 0);
Config->ZText = getZFlag(Args, "text", "notext", true);