Skip to content

Commit 74f771e

Browse files
author
Matti Kosola
committed
Merge branch 'jb50500' into 'master'
Add packaging for clang See merge request mer-core/llvm!10
2 parents 1b2bbd7 + cc5a170 commit 74f771e

6 files changed

+518
-2
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From 690373af5a5d50cf115ed6e4d2849bb786f9dc8e Mon Sep 17 00:00:00 2001
2+
From: serge-sans-paille <[email protected]>
3+
Date: Tue, 10 Dec 2019 09:18:03 +0000
4+
Subject: [PATCH] Make -funwind-tables the default for all archs
5+
6+
---
7+
clang/lib/Driver/ToolChain.cpp | 2 +-
8+
clang/lib/Driver/ToolChains/Gnu.cpp | 2 +-
9+
2 files changed, 2 insertions(+), 2 deletions(-)
10+
11+
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
12+
index b1fddb0af55..43af40ed0e8 100644
13+
--- a/clang/lib/Driver/ToolChain.cpp
14+
+++ b/clang/lib/Driver/ToolChain.cpp
15+
@@ -244,7 +244,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
16+
}
17+
18+
bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const {
19+
- return false;
20+
+ return true;
21+
}
22+
23+
Tool *ToolChain::getClang() const {
24+
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
25+
index 33cdd3585c2..15e82be8f3a 100644
26+
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
27+
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
28+
@@ -2535,7 +2535,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const {
29+
}
30+
31+
bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
32+
- return getArch() == llvm::Triple::x86_64;
33+
+ return true;
34+
}
35+
36+
bool Generic_GCC::isPICDefault() const {
37+
--
38+
2.20.1
39+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
From 09ae3ef5710a89505318ec721c65b6c838147276 Mon Sep 17 00:00:00 2001
2+
From: Tom Stellard <[email protected]>
3+
Date: Thu, 7 Feb 2019 21:05:37 -0800
4+
Subject: [PATCH] ToolChain: Add -lgcc_s to the linker flags when using libc++
5+
6+
The libc++ build for Fedora does not include an implementation of
7+
libunwind, so we need to explicitly link against something that
8+
provides this implementation.
9+
---
10+
clang/lib/Driver/ToolChain.cpp | 1 +
11+
clang/test/Driver/netbsd.cpp | 4 ++--
12+
2 files changed, 3 insertions(+), 2 deletions(-)
13+
14+
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
15+
index 88a627e..cb99844 100644
16+
--- a/clang/lib/Driver/ToolChain.cpp
17+
+++ b/clang/lib/Driver/ToolChain.cpp
18+
@@ -767,6 +767,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
19+
switch (Type) {
20+
case ToolChain::CST_Libcxx:
21+
CmdArgs.push_back("-lc++");
22+
+ CmdArgs.push_back("-lgcc_s");
23+
break;
24+
25+
case ToolChain::CST_Libstdcxx:
26+
diff --git a/clang/test/Driver/netbsd.cpp b/clang/test/Driver/netbsd.cpp
27+
index 4af7d83..ff18c62 100644
28+
--- a/clang/test/Driver/netbsd.cpp
29+
+++ b/clang/test/Driver/netbsd.cpp
30+
@@ -131,7 +131,7 @@
31+
// ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi"
32+
// ARM-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
33+
// ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o"
34+
-// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc"
35+
+// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc"
36+
// ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
37+
38+
// AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd"
39+
@@ -250,7 +250,7 @@
40+
// S-ARM-7: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd7.0.0-eabi"
41+
// S-ARM-7: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
42+
// S-ARM-7: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}eabi{{/|\\\\}}crti.o"
43+
-// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lm" "-lc"
44+
+// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++" "-lgcc_s" "-lm" "-lc"
45+
// S-ARM-7: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
46+
47+
// S-AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd"
48+
--
49+
1.8.3.1
50+

rpm/clang-sailfishos-toolchain.patch

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
2+
index 67dc764fb7d..2ae6c555515 100644
3+
--- a/clang/include/clang/Driver/Distro.h
4+
+++ b/clang/include/clang/Driver/Distro.h
5+
@@ -41,6 +41,7 @@ public:
6+
Fedora,
7+
Gentoo,
8+
OpenSUSE,
9+
+ Sailfish,
10+
UbuntuHardy,
11+
UbuntuIntrepid,
12+
UbuntuJaunty,
13+
@@ -117,6 +118,10 @@ public:
14+
return DistroVal >= DebianLenny && DistroVal <= DebianBullseye;
15+
}
16+
17+
+ bool IsSailfish() const {
18+
+ return DistroVal == Sailfish;
19+
+ }
20+
+
21+
bool IsUbuntu() const {
22+
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuEoan;
23+
}
24+
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
25+
index f2a3074d1e7..b9971b63a81 100644
26+
--- a/clang/lib/Driver/Distro.cpp
27+
+++ b/clang/lib/Driver/Distro.cpp
28+
@@ -145,6 +145,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
29+
if (VFS.exists("/etc/gentoo-release"))
30+
return Distro::Gentoo;
31+
32+
+ if (VFS.exists("/etc/sailfish-release"))
33+
+ return Distro::Sailfish;
34+
+
35+
return Distro::UnknownDistro;
36+
}
37+
38+
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
39+
index 33cdd3585c2..e1890849100 100644
40+
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
41+
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
42+
@@ -1927,7 +1927,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
43+
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
44+
static const char *const AArch64Triples[] = {
45+
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
46+
- "aarch64-suse-linux", "aarch64-linux-android"};
47+
+ "aarch64-suse-linux", "aarch64-linux-android", "aarch64-meego-linux-gnu"};
48+
static const char *const AArch64beLibDirs[] = {"/lib"};
49+
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
50+
"aarch64_be-linux-gnu"};
51+
@@ -1937,6 +1937,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
52+
"arm-linux-androideabi"};
53+
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
54+
"armv7hl-redhat-linux-gnueabi",
55+
+ "armv7hl-meego-linux-gnueabi",
56+
"armv6hl-suse-linux-gnueabi",
57+
"armv7hl-suse-linux-gnueabi"};
58+
static const char *const ARMebLibDirs[] = {"/lib"};
59+
@@ -1964,7 +1965,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
60+
"i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux",
61+
"i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu",
62+
"i686-linux-android", "i386-gnu", "i486-gnu",
63+
- "i586-gnu", "i686-gnu"};
64+
+ "i586-gnu", "i686-gnu", "i486-meego-linux"};
65+
66+
static const char *const MIPSLibDirs[] = {"/lib"};
67+
static const char *const MIPSTriples[] = {
68+
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
69+
index 7f59bc77f52..9cf648e2c08 100644
70+
--- a/clang/lib/Driver/ToolChains/Linux.cpp
71+
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
72+
@@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
73+
}
74+
75+
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
76+
- Triple.isAndroid()) {
77+
+ Triple.isAndroid() || Distro.IsSailfish()) {
78+
ExtraOpts.push_back("-z");
79+
ExtraOpts.push_back("relro");
80+
}
81+
@@ -289,13 +289,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
82+
// Hexagon linker/loader does not support .gnu.hash
83+
if (!IsMips && !IsHexagon) {
84+
if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
85+
- (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
86+
+ (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) || Distro.IsSailfish() ||
87+
(IsAndroid && !Triple.isAndroidVersionLT(23)))
88+
ExtraOpts.push_back("--hash-style=gnu");
89+
90+
if (Distro.IsDebian() || Distro.IsOpenSUSE() ||
91+
Distro == Distro::UbuntuLucid || Distro == Distro::UbuntuJaunty ||
92+
- Distro == Distro::UbuntuKarmic ||
93+
+ Distro == Distro::UbuntuKarmic || Distro.IsSailfish() ||
94+
(IsAndroid && Triple.isAndroidVersionLT(23)))
95+
ExtraOpts.push_back("--hash-style=both");
96+
}
97+
@@ -304,7 +304,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
98+
ExtraOpts.push_back("--build-id");
99+
#endif
100+
101+
- if (IsAndroid || Distro.IsOpenSUSE())
102+
+ if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsSailfish())
103+
ExtraOpts.push_back("--enable-new-dtags");
104+
105+
// The selection of paths to try here is designed to match the patterns which

0 commit comments

Comments
 (0)