diff options
| author | Martell Malone <martellmalone@gmail.com> | 2017-11-19 00:08:12 +0000 |
|---|---|---|
| committer | Martell Malone <martellmalone@gmail.com> | 2017-11-19 00:08:12 +0000 |
| commit | 13c5d7379a01e0ad5e2511194058524b594b9a88 (patch) | |
| tree | 121d6adefe6e6e0d576c44b9c45d0f3d9e62eb55 /clang/lib/Driver | |
| parent | c812560c1498a6f20c9fb6dde0c95a30425f8a0f (diff) | |
| download | bcm5719-llvm-13c5d7379a01e0ad5e2511194058524b594b9a88.tar.gz bcm5719-llvm-13c5d7379a01e0ad5e2511194058524b594b9a88.zip | |
[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
llvm-svn: 318608
Diffstat (limited to 'clang/lib/Driver')
| -rw-r--r-- | clang/lib/Driver/Distro.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Driver/ToolChains/Linux.cpp | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp index 9a0b854e32f..f15c919b9aa 100644 --- a/clang/lib/Driver/Distro.cpp +++ b/clang/lib/Driver/Distro.cpp @@ -129,6 +129,9 @@ static Distro::DistroType DetectDistro(vfs::FileSystem &VFS) { if (VFS.exists("/etc/exherbo-release")) return Distro::Exherbo; + if (VFS.exists("/etc/alpine-release")) + return Distro::AlpineLinux; + if (VFS.exists("/etc/arch-release")) return Distro::ArchLinux; diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp index 9b722166c5f..ca042f38db8 100644 --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/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 { |

