Commit c0f3c8c7 authored by Jakub Jirutka's avatar Jakub Jirutka

main/clang: upgrade to 4.0.0

parent 4fa26dee
# Contributor Travis Tilley <ttilley@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=clang
pkgver=3.8.1
pkgrel=3
# Note: Update together with llvm.
pkgver=4.0.0
pkgrel=0
pkgdesc="A C language family front-end for LLVM"
arch="all"
url="http://llvm.org/"
......@@ -12,7 +13,6 @@ makedepends="
isl-dev
libxml2-dev
libxml2-utils
llvm
llvm-dev
llvm-static
paxmark
......@@ -25,7 +25,7 @@ source="http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz
clang-0001-Add-Alpine-Linux-distro.patch
clang-0002-Use-z-relro-on-Alpine-Linux.patch
clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch
clang-0004-Add-musl-targets-and-dynamic-linker.patch
clang-0004-Add-musl-targets.patch
clang-0005-Enable-PIE-by-default-for-alpine-linux.patch
clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch
......@@ -81,11 +81,11 @@ analyzer() {
mv usr/share/scan-* "$subpkgdir"/usr/share/
}
sha512sums="72d23a410271b50f97371b13dd7a6c6c5c0a993e35df436ab716ece8521d83406aa3d4bf8fdecd8154139f39fd5e011e480d405225d8c3ff152d0a2ac4573e04 cfe-3.8.1.src.tar.xz
ed19cb50fe96a5b05754887b055d75f0c0466f77e07e4d4f69b9cea17a3fa88e449d54bd47a791780bee095716cf6b6d8bf16352317192b0ce88d09c603af657 clang-0001-Add-Alpine-Linux-distro.patch
22ad0e449c633f3d5a849207c5e2ed048998e03820c743ad90242d4637c23ba3d2dc8f3c51b923fdfa1891d08d10e934f65dd7b6a90adeb3ce35c3ab923370d3 clang-0002-Use-z-relro-on-Alpine-Linux.patch
c6c1f8693085c375f7039baa64f209834f8fdb8be4c597301e882b3fe099bb91e427beaf6555664e46a4e0aae7dbb4b6e0662a1390c4eaacfdbb138345feb478 clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch
29e92198d164572ac32d43da40c5d01070d45073cbda2338ff1e3949f6807db722ca9d40a4ef03b21de7e9e9d7b0a61e273b760cf8f302d3ec77d1b0027accc2 clang-0004-Add-musl-targets-and-dynamic-linker.patch
c38f973d9ad8f3e535476cf2b617a2a569a15db8e28c2df0d70252cf69ccbdb29ab18d3aa979b4e66d52128ad0fa654fd0ae503e0cd14b0c265addff1ee35268 clang-0005-Enable-PIE-by-default-for-alpine-linux.patch
af79bb12a75866151edb257377dc5c5f47fa69b03c860ffd0d5d569f18385d642a1cf394c1d375f0fa0a2226637b000bb15f9bf3cacd95972bd465dd8fdbed0c clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
a2a9b307d764fed977299b1b9d130d63a60e65889638b1aadcc082ef021170c8c0c38b4107ceef7b85b057ef2a72bc19a84297f5179afaf697983c19b20cab7b clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch"
sha512sums="a0d9972ec337a5c105fcbe7abc4076ba1e580f28908a3318f43bbfe59143f446ed5b78dad210f624145d7e5a3d56c15bfead78826c068422b60120fa1cfa482a cfe-4.0.0.src.tar.xz
4014984a187e4d0331d8315727d1b831e573843cd8d113df43424524cb348bc73ce3d12783351d9a14f9fd14111d75ce71d8f2a85d82b6437a61b11d85796cfb clang-0001-Add-Alpine-Linux-distro.patch
53741890ec3805dd0d5a930ed526cb5bac5f75c459c6910c9461017719186383cf54638af4eea7a38eb7f9f423b18086bd5584b11f7e4babf6cd0edf8b4f4f48 clang-0002-Use-z-relro-on-Alpine-Linux.patch
f06e351785d5755827459f17d3533415772ba84b4fbd4e49f418bafd20394e98d42b33a94aa34cff2a7b54c79cf06a6f5d382af5a55cba63a81116f0568d4b25 clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch
2998ab2dfbc3d5629dd7e65e7e39dc0ab96f61e24733cb8d2d4faee50a89f0f159ad44d10182ed4c96f060180f4e22510881f4e9eb00ced01278bde99adf3389 clang-0004-Add-musl-targets.patch
6215080a796fa1fc6f7634781ef77fc245037880dbf075a656823aae5f9f4911294dc6d61172db399b063adbe445c38b73cec12fc66dbe16bd9d84dc58035846 clang-0005-Enable-PIE-by-default-for-alpine-linux.patch
d151a6ecca470abb1f4dbc06910155db0688322475655e28cdcb9c0b21930c8bcaf166e9df9fc9dca1be654cf497587961e461d91ee2871fdf454bbd33c5fffe clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch
f8c46bb64202c9233595362eb54288c30fbd28309308cbcafe1802dc50ffd676c7a70e6cbdbfd73464f872b40a90acd2eb736dcc9622fd434dbd44a5b0005027 clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch"
From 4559c66aabd8b56f7127c8b1f5d22f59d3ca2390 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 18 Feb 2016 17:40:00 +0100
Subject: [PATCH 1/7] Add Alpine Linux distro
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH] Add Alpine Linux distro
---
lib/Driver/ToolChains.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 99c7b8e..70b53bd 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -3374,6 +3374,7 @@ enum Distro {
// NB: Releases of a particular Linux distro should be kept together
// in this enum, because some tests are done by integer comparison against
// the first and last known member in the family, e.g. IsRedHat().
+ AlpineLinux,
ArchLinux,
DebianLenny,
DebianSqueeze,
@@ -3497,6 +3498,9 @@ static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) {
if (D.getVFS().exists("/etc/arch-release"))
return ArchLinux;
--- a/include/clang/Driver/Distro.h
+++ b/include/clang/Driver/Distro.h
@@ -26,6 +26,7 @@
// NB: Releases of a particular Linux distro should be kept together
// in this enum, because some tests are done by integer comparison against
// the first and last known member in the family, e.g. IsRedHat().
+ AlpineLinux,
ArchLinux,
DebianLenny,
DebianSqueeze,
@@ -97,6 +98,10 @@
/// @name Convenience Predicates
/// @{
+ if (D.getVFS().exists("/etc/alpine-release"))
+ return AlpineLinux;
+ bool IsAlpineLinux() const {
+ return DistroVal == AlpineLinux;
+ }
+
return UnknownDistro;
}
bool IsRedhat() const {
return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7);
}
--- a/lib/Driver/Distro.cpp
+++ b/lib/Driver/Distro.cpp
@@ -128,6 +128,9 @@
if (VFS.exists("/etc/arch-release"))
return Distro::ArchLinux;
--
2.7.3
+ if (VFS.exists("/etc/alpine-release"))
+ return Distro::AlpineLinux;
+
return Distro::UnknownDistro;
}
From 1898d32d22fddf3ba6c88addbd2af0159600b506 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 18 Feb 2016 17:41:23 +0100
Subject: [PATCH 2/7] Use "-z relro" on Alpine Linux
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH] Use "-z relro" on Alpine Linux
---
lib/Driver/ToolChains.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 70b53bd..46326f0 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -3667,7 +3667,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
@@ -4112,7 +4112,7 @@
Distro Distro = DetectDistro(D, Arch);
Distro Distro(D.getVFS());
- if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
+ if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || Distro == AlpineLinux) {
- if (Distro.IsOpenSUSE() || Distro.IsUbuntu()) {
+ if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
}
--
2.7.3
From b880ea7037ea3232be9ba2e96cc179da92ea4b9c Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 18 Feb 2016 17:43:51 +0100
Subject: [PATCH 3/7] Use --hash-style=gnu for Alpine Linux
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH] Use --hash-style=gnu for Alpine Linux
---
lib/Driver/ToolChains.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 46326f0..6b0b31d 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -3687,8 +3687,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
@@ -4132,7 +4132,7 @@
// ABI requires a mapping between the GOT and the symbol table.
// Android loader does not support .gnu.hash.
if (!IsMips && !IsAndroid) {
- if (IsRedhat(Distro) || IsOpenSUSE(Distro) ||
- (IsUbuntu(Distro) && Distro >= UbuntuMaverick))
+ if (IsRedhat(Distro) || IsOpenSUSE(Distro) || Distro == AlpineLinux ||
+ (IsUbuntu(Distro) && Distro >= UbuntuMaverick))
- if (Distro.IsRedhat() || Distro.IsOpenSUSE() ||
+ if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
(Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
ExtraOpts.push_back("--hash-style=gnu");
if (IsDebian(Distro) || IsOpenSUSE(Distro) || Distro == UbuntuLucid ||
--
2.7.3
From 4777c16fc6e717a852366fa2a447c852cca3b62d Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Fri, 19 Feb 2016 13:35:08 +0100
Subject: [PATCH 4/7] Add musl targets and dynamic linker
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH] Add musl targets
---
lib/Basic/Targets.cpp | 2 ++
lib/CodeGen/TargetInfo.cpp | 6 +++++-
lib/Driver/ToolChains.cpp | 15 ++++++++++-----
lib/Driver/Tools.cpp | 44 +++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 60 insertions(+), 7 deletions(-)
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index af8aea0..1e27c7a 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -4513,6 +4513,8 @@ public:
case llvm::Triple::Android:
case llvm::Triple::GNUEABI:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABI:
+ case llvm::Triple::MuslEABIHF:
setABI("aapcs-linux");
break;
case llvm::Triple::EABIHF:
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index 3d1ddef..f6b3474 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -4757,6 +4757,8 @@ public:
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABI:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABI:
+ case llvm::Triple::MuslEABIHF:
return true;
default:
return false;
@@ -4767,6 +4769,7 @@ public:
switch (getTarget().getTriple().getEnvironment()) {
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABIHF:
return true;
default:
return false;
@@ -7492,7 +7495,8 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
Kind = ARMABIInfo::AAPCS16_VFP;
else if (CodeGenOpts.FloatABI == "hard" ||
(CodeGenOpts.FloatABI != "soft" &&
- Triple.getEnvironment() == llvm::Triple::GNUEABIHF))
+ (Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+ Triple.getEnvironment() == llvm::Triple::MuslEABIHF)))
Kind = ARMABIInfo::AAPCS_VFP;
return *(TheTargetCodeGenInfo = new ARMTargetCodeGenInfo(Types, Kind));
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 6b0b31d..0db9644 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1523,7 +1523,8 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
@@ -1644,7 +1644,8 @@
case llvm::Triple::arm:
case llvm::Triple::thumb:
LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
......@@ -68,7 +15,7 @@ index 6b0b31d..0db9644 100644
TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples));
} else {
TripleAliases.append(begin(ARMTriples), end(ARMTriples));
@@ -1532,7 +1533,8 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
@@ -1653,7 +1654,8 @@
case llvm::Triple::armeb:
case llvm::Triple::thumbeb:
LibDirs.append(begin(ARMebLibDirs), end(ARMebLibDirs));
......@@ -78,7 +25,7 @@ index 6b0b31d..0db9644 100644
TripleAliases.append(begin(ARMebHFTriples), end(ARMebHFTriples));
} else {
TripleAliases.append(begin(ARMebTriples), end(ARMebTriples));
@@ -3528,7 +3530,8 @@ static std::string getMultiarchTriple(const Driver &D,
@@ -3956,7 +3958,8 @@
// regardless of what the actual target triple is.
case llvm::Triple::arm:
case llvm::Triple::thumb:
......@@ -88,7 +35,7 @@ index 6b0b31d..0db9644 100644
if (D.getVFS().exists(SysRoot + "/lib/arm-linux-gnueabihf"))
return "arm-linux-gnueabihf";
} else {
@@ -3538,7 +3541,8 @@ static std::string getMultiarchTriple(const Driver &D,
@@ -3966,7 +3969,8 @@
break;
case llvm::Triple::armeb:
case llvm::Triple::thumbeb:
......@@ -98,7 +45,20 @@ index 6b0b31d..0db9644 100644
if (D.getVFS().exists(SysRoot + "/lib/armeb-linux-gnueabihf"))
return "armeb-linux-gnueabihf";
} else {
@@ -3969,7 +3973,8 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
@@ -4334,6 +4338,12 @@
ArchName = "armeb";
IsArm = true;
break;
+ case llvm::Triple::ppc:
+ ArchName = "powerpc";
+ break;
+ case llvm::Triple::x86:
+ ArchName = "i386";
+ break;
default:
ArchName = Triple.getArchName().str();
}
@@ -4544,7 +4554,8 @@
break;
case llvm::Triple::arm:
case llvm::Triple::thumb:
......@@ -108,11 +68,10 @@ index 6b0b31d..0db9644 100644
MultiarchIncludeDirs = ARMHFMultiarchIncludeDirs;
else
MultiarchIncludeDirs = ARMMultiarchIncludeDirs;
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index b7ac24f..ea1ce6f 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -712,6 +712,7 @@ arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
@@ -953,6 +953,7 @@
case llvm::Triple::FreeBSD:
switch (Triple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
......@@ -120,24 +79,7 @@ index b7ac24f..ea1ce6f 100644
ABI = FloatABI::Hard;
break;
default:
@@ -725,6 +726,7 @@ arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
switch (Triple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
case llvm::Triple::EABIHF:
+ case llvm::Triple::MuslEABIHF:
ABI = FloatABI::Hard;
break;
case llvm::Triple::GNUEABI:
@@ -968,6 +970,8 @@ void Clang::AddARMTargetArgs(const llvm::Triple &Triple, const ArgList &Args,
case llvm::Triple::Android:
case llvm::Triple::GNUEABI:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABI:
+ case llvm::Triple::MuslEABIHF:
ABIName = "aapcs-linux";
break;
case llvm::Triple::EABIHF:
@@ -7857,6 +7861,8 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
@@ -9198,6 +9200,8 @@
switch (getToolChain().getTriple().getEnvironment()) {
case llvm::Triple::GNUEABIHF:
case llvm::Triple::GNUEABI:
......@@ -146,7 +88,7 @@ index b7ac24f..ea1ce6f 100644
case llvm::Triple::EABI:
CmdArgs.push_back("-meabi=5");
break;
@@ -8199,10 +8205,12 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
@@ -9541,10 +9545,12 @@
switch (getToolChain().getTriple().getEnvironment()) {
case llvm::Triple::EABI:
case llvm::Triple::GNUEABI:
......@@ -159,7 +101,7 @@ index b7ac24f..ea1ce6f 100644
CmdArgs.push_back("armelf_nbsd_eabihf");
break;
default:
@@ -8219,10 +8227,12 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
@@ -9559,10 +9565,12 @@
switch (getToolChain().getTriple().getEnvironment()) {
case llvm::Triple::EABI:
case llvm::Triple::GNUEABI:
......@@ -172,51 +114,3 @@ index b7ac24f..ea1ce6f 100644
CmdArgs.push_back("armelfb_nbsd_eabihf");
break;
default:
@@ -8623,11 +8633,43 @@ static void AddLibgcc(const llvm::Triple &Triple, const Driver &D,
CmdArgs.push_back("-ldl");
}
+static std::string getMuslDynamicLinker(const llvm::Triple::ArchType Arch,
+ const llvm::Triple::EnvironmentType Env) {
+ switch (Arch) {
+ case llvm::Triple::arm:
+ case llvm::Triple::thumb:
+ return Env == llvm::Triple::MuslEABIHF ?
+ "/lib/ld-musl-armhf.so.1" : "/lib/ld-musl-arm.so.1";
+ case llvm::Triple::armeb:
+ case llvm::Triple::thumbeb:
+ return Env == llvm::Triple::MuslEABIHF ?
+ "/lib/ld-musl-armebhf.so.1" : "/lib/ld-musl-armeb.so.1";
+ case llvm::Triple::aarch64:
+ return "/lib/ld-musl-aarch64.so.1";
+ case llvm::Triple::aarch64_be:
+ return "/lib/ld-musl-aarch64_be.so.1";
+ case llvm::Triple::mips:
+ return "/lib/ld-musl-mips.so.1";
+ case llvm::Triple::mipsel:
+ return "/lib/ld-musl-mipsel.so.1";
+ case llvm::Triple::ppc:
+ return "/lib/ld-musl-powerpc.so.1";
+ case llvm::Triple::x86:
+ return "/lib/ld-musl-i386.so.1";
+//case llvm::Triple::x86_64:
+ default:
+ return "/lib/ld-musl-x86_64.so.1";
+ }
+ return NULL;
+}
+
static std::string getLinuxDynamicLinker(const ArgList &Args,
const toolchains::Linux &ToolChain) {
const llvm::Triple::ArchType Arch = ToolChain.getArch();
- if (ToolChain.getTriple().isAndroid()) {
+ if (ToolChain.getTriple().isMusl()) {
+ return getMuslDynamicLinker(Arch, ToolChain.getTriple().getEnvironment());
+ } else if (ToolChain.getTriple().isAndroid()) {
if (ToolChain.getTriple().isArch64Bit())
return "/system/bin/linker64";
else
--
2.7.3
From efbdf70c883a356106fc1bcb1c2917ec6c0a6157 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 23 Feb 2016 09:35:26 +0100
Subject: [PATCH 5/7] Enable PIE by default for alpine linux
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH] Enable PIE by default for Alpine Linux
Alpine Linux uses PIE by default.
---
lib/Driver/ToolChains.cpp | 5 ++++-
lib/Driver/Tools.cpp | 4 +++-
test/Driver/pic.c | 12 ++++++++++++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 0db9644..82449bf 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -4143,7 +4143,10 @@ void Linux::AddCudaIncludeArgs(const ArgList &DriverArgs,
@@ -4721,7 +4721,10 @@
}
}
......@@ -26,11 +19,9 @@ index 0db9644..82449bf 100644
SanitizerMask Linux::getSupportedSanitizers() const {
const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index ea1ce6f..8fd3649 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -7919,7 +7919,9 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
@@ -9258,7 +9258,9 @@
if (!D.SysRoot.empty())
CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
......@@ -40,12 +31,10 @@ index ea1ce6f..8fd3649 100644
+ else if (IsPIE)
CmdArgs.push_back("-pie");
if (Args.hasArg(options::OPT_static)) {
diff --git a/test/Driver/pic.c b/test/Driver/pic.c
index aeb2ee3..9b8e0f6 100644
CmdArgs.push_back("--eh-frame-hdr");
--- a/test/Driver/pic.c
+++ b/test/Driver/pic.c
@@ -243,6 +243,18 @@
@@ -244,6 +244,18 @@
// RUN: %clang %s -target i386-pc-openbsd -nopie -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD
//
......@@ -64,6 +53,3 @@ index aeb2ee3..9b8e0f6 100644
// On Android PIC is enabled by default
// RUN: %clang -c %s -target i686-linux-android -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
--
2.7.3
From e089ab63916eada060fdfffbf7422c9b20bafe84 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 23 Feb 2016 10:08:17 +0000
Subject: [PATCH 6/7] Link with -z now by default for Alpine Linux
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH] Link with -z now by default for Alpine Linux
---
lib/Driver/ToolChains.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 82449bf..1a8ebf5 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -3671,6 +3671,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
@@ -4116,6 +4116,11 @@
Distro Distro = DetectDistro(D, Arch);
Distro Distro(D.getVFS());
+ if (Distro == AlpineLinux) {
+ if (Distro.IsAlpineLinux()) {
+ ExtraOpts.push_back("-z");
+ ExtraOpts.push_back("now");
+ }
+
if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || Distro == AlpineLinux) {
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
--
2.7.3
From da8ea517105fff702f936695dcfae844ac85260d Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 23 Feb 2016 10:16:54 +0000
Subject: [PATCH 7/7] Enable stack protector by default for alpine linux
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 16 Apr 2017 16:49:00 +0100
Subject: [PATCH] Enable stack protector by default for Alpine Linux
---
lib/Driver/ToolChains.cpp | 7 +++++++
lib/Driver/ToolChains.h | 1 +
test/Driver/stack-protector.c | 14 ++++++++++++++
3 files changed, 22 insertions(+)
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 1a8ebf5..59b7601 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -4193,6 +4193,13 @@ void Linux::addProfileRTLibs(const llvm::opt::ArgList &Args,
ToolChain::addProfileRTLibs(Args, CmdArgs);
@@ -4866,6 +4866,13 @@
CmdArgs.push_back("-lunwind");
}
+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
......@@ -27,20 +19,16 @@ index 1a8ebf5..59b7601 100644
/// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
DragonFly::DragonFly(const Driver &D, const llvm::Triple &Triple,
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index f940e58..977ea66 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -796,6 +796,7 @@ public:
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
@@ -880,6 +880,7 @@
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
bool isPIEDefault() const override;
+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
SanitizerMask getSupportedSanitizers() const override;
void addProfileRTLibs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
index 487af56..2fbd39a 100644
--- a/test/Driver/stack-protector.c
+++ b/test/Driver/stack-protector.c
@@ -24,6 +24,20 @@
......@@ -64,6 +52,3 @@ index 487af56..2fbd39a 100644
// RUN: %clang -target x86_64-scei-ps4 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4
// RUN: %clang -target x86_64-scei-ps4 -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4
// SSP-PS4: "-stack-protector" "2"
--
2.7.3
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment