summaryrefslogtreecommitdiffstats
path: root/lib/Driver/ToolChains
diff options
context:
space:
mode:
authorMartell Malone <martellmalone@gmail.com>2017-11-19 00:08:12 +0000
committerMartell Malone <martellmalone@gmail.com>2017-11-19 00:08:12 +0000
commit885ad8eb3a6c8b185fea798a0ea706604c4e6484 (patch)
tree088198716c7299d200697b09aa6dda2412410b46 /lib/Driver/ToolChains
parent77805a3a0fab1339f0c924e46698460875d7b9d1 (diff)
[Driver] add initial support for alpine linux
set -pie as default for musl linux targets add detection of alpine linux append appropriate compile flags for alpine Reviewers: rnk Differential Revision: https://reviews.llvm.org/D39588 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains')
-rw-r--r--lib/Driver/ToolChains/Linux.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index 9b722166c5..ca042f38db 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -210,7 +210,12 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
Distro Distro(D.getVFS());
- if (Distro.IsOpenSUSE() || Distro.IsUbuntu()) {
+ if (Distro.IsAlpineLinux()) {
+ ExtraOpts.push_back("-z");
+ ExtraOpts.push_back("now");
+ }
+
+ if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
}
@@ -232,7 +237,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
// Android loader does not support .gnu.hash.
// Hexagon linker/loader does not support .gnu.hash
if (!IsMips && !IsAndroid && !IsHexagon) {
- if (Distro.IsRedhat() || Distro.IsOpenSUSE() ||
+ if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
(Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
ExtraOpts.push_back("--hash-style=gnu");
@@ -812,7 +817,7 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
bool Linux::isPIEDefault() const {
return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
- getSanitizerArgs().requiresPIE();
+ getTriple().isMusl() || getSanitizerArgs().requiresPIE();
}
SanitizerMask Linux::getSupportedSanitizers() const {