Skip to content

Commit c54c32c

Browse files
committed
[llvm] Update llvm and clang to 14.0.6. JB#58952
Set CLANG_DEFAULT_UNWIND_LIB instead of using custom patch for libgcc. Signed-off-by: Ruben De Smet <[email protected]> Signed-off-by: Matti Lehtimäki <[email protected]>
1 parent 80ba7da commit c54c32c

9 files changed

+164
-121
lines changed

llvm

Submodule llvm updated from ef32c61 to f28c006

rpm/llvm-sailfishos-toolchain.patch renamed to rpm/0001-LLVM-Add-MeeGo-vendor-type.patch

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ruben De Smet <[email protected]>
3+
Date: Sun, 26 Jun 2022 10:48:13 +0200
4+
Subject: [PATCH] LLVM: Add MeeGo vendor type
5+
6+
---
7+
llvm/include/llvm/ADT/Triple.h | 3 ++-
8+
llvm/lib/Support/Triple.cpp | 12 ++++++++++++
9+
llvm/unittests/ADT/TripleTest.cpp | 6 ++++++
10+
3 files changed, 20 insertions(+), 1 deletion(-)
11+
112
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
2-
index 76a754d671f..6ee7f680dee 100644
13+
index 42277c013035..9e36dfd4d2d5 100644
314
--- a/llvm/include/llvm/ADT/Triple.h
415
+++ b/llvm/include/llvm/ADT/Triple.h
5-
@@ -152,7 +152,8 @@ public:
16+
@@ -165,7 +165,8 @@ public:
617
Mesa,
718
SUSE,
819
OpenEmbedded,
@@ -13,26 +24,26 @@ index 76a754d671f..6ee7f680dee 100644
1324
enum OSType {
1425
UnknownOS,
1526
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
16-
index 2c480c1094a..e7d399bfa4f 100644
27+
index a9afcc9db96a..c4307bf457c7 100644
1728
--- a/llvm/lib/Support/Triple.cpp
1829
+++ b/llvm/lib/Support/Triple.cpp
19-
@@ -162,6 +162,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
30+
@@ -177,6 +177,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
2031
case Freescale: return "fsl";
2132
case IBM: return "ibm";
2233
case ImaginationTechnologies: return "img";
2334
+ case MeeGo: return "meego";
2435
case Mesa: return "mesa";
2536
case MipsTechnologies: return "mti";
2637
case Myriad: return "myriad";
27-
@@ -479,6 +480,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
38+
@@ -507,6 +508,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
2839
.Case("mesa", Triple::Mesa)
2940
.Case("suse", Triple::SUSE)
3041
.Case("oe", Triple::OpenEmbedded)
3142
+ .Case("meego", Triple::MeeGo)
3243
.Default(Triple::UnknownVendor);
3344
}
3445

35-
@@ -743,6 +745,9 @@ Triple::Triple(const Twine &Str)
46+
@@ -802,6 +804,9 @@ Triple::Triple(const Twine &Str)
3647
OS = parseOS(Components[2]);
3748
if (Components.size() > 3) {
3849
Environment = parseEnvironment(Components[3]);
@@ -42,7 +53,7 @@ index 2c480c1094a..e7d399bfa4f 100644
4253
ObjectFormat = parseFormat(Components[3]);
4354
}
4455
}
45-
@@ -794,6 +799,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
56+
@@ -853,6 +858,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
4657
ObjectFormat(parseFormat(EnvironmentStr.str())) {
4758
if (ObjectFormat == Triple::UnknownObjectFormat)
4859
ObjectFormat = getDefaultFormat(*this);
@@ -53,8 +64,8 @@ index 2c480c1094a..e7d399bfa4f 100644
5364
}
5465

5566
std::string Triple::normalize(StringRef Str) {
56-
@@ -1056,6 +1065,9 @@ void Triple::getEnvironmentVersion(unsigned &Major, unsigned &Minor,
57-
unsigned &Micro) const {
67+
@@ -1103,6 +1112,9 @@ static VersionTuple parseVersionFromName(StringRef Name) {
68+
VersionTuple Triple::getEnvironmentVersion() const {
5869
StringRef EnvironmentName = getEnvironmentName();
5970
StringRef EnvironmentTypeName = getEnvironmentTypeName(getEnvironment());
6071
+ // MeeGo uses "gnueabi" to mean "gnueabihf"
@@ -64,10 +75,10 @@ index 2c480c1094a..e7d399bfa4f 100644
6475
EnvironmentName = EnvironmentName.substr(EnvironmentTypeName.size());
6576

6677
diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp
67-
index ef7f82d268e..5f9c04832ec 100644
78+
index 3006ab6d40e8..7a28ed624232 100644
6879
--- a/llvm/unittests/ADT/TripleTest.cpp
6980
+++ b/llvm/unittests/ADT/TripleTest.cpp
70-
@@ -355,6 +355,12 @@ TEST(TripleTest, ParsedIDs) {
81+
@@ -384,6 +384,12 @@ TEST(TripleTest, ParsedIDs) {
7182
EXPECT_EQ(Triple::Linux, T.getOS());
7283
EXPECT_EQ(Triple::GNUEABI, T.getEnvironment());
7384

rpm/0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch

Lines changed: 0 additions & 50 deletions
This file was deleted.

rpm/0002-Add-Triple-isMeeGo.patch

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ruben De Smet <[email protected]>
3+
Date: Sun, 26 Jun 2022 10:41:44 +0200
4+
Subject: [PATCH] Add Triple::isMeeGo()
5+
6+
---
7+
llvm/include/llvm/ADT/Triple.h | 3 +++
8+
1 file changed, 3 insertions(+)
9+
10+
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
11+
index 9e36dfd4d2d5..8e66888615ff 100644
12+
--- a/llvm/include/llvm/ADT/Triple.h
13+
+++ b/llvm/include/llvm/ADT/Triple.h
14+
@@ -657,6 +657,9 @@ public:
15+
/// Tests whether the target is Android
16+
bool isAndroid() const { return getEnvironment() == Triple::Android; }
17+
18+
+ /// Tests whether the target is Android
19+
+ bool isMeeGo() const { return getVendor() == Triple::MeeGo; }
20+
+
21+
bool isAndroidVersionLT(unsigned Major) const {
22+
assert(isAndroid() && "Not an Android triple!");
23+

rpm/clang-sailfishos-toolchain.patch renamed to rpm/0003-Clang-SailfishOS-toolchain.patch

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ruben De Smet <[email protected]>
3+
Date: Sun, 26 Jun 2022 10:57:51 +0200
4+
Subject: [PATCH] Clang: SailfishOS toolchain
5+
6+
Signed-off-by: Ruben De Smet <[email protected]>
7+
---
8+
clang/include/clang/Driver/Distro.h | 5 +++++
9+
clang/lib/Driver/Distro.cpp | 3 +++
10+
clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++-
11+
clang/lib/Driver/ToolChains/Linux.cpp | 8 ++++----
12+
4 files changed, 15 insertions(+), 5 deletions(-)
13+
114
diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
2-
index d382cf77a8b..8c06919f1d3 100644
15+
index 2723f75e8945..58616ad541e1 100644
316
--- a/clang/include/clang/Driver/Distro.h
417
+++ b/clang/include/clang/Driver/Distro.h
5-
@@ -42,6 +42,7 @@ public:
18+
@@ -45,6 +45,7 @@ public:
619
Fedora,
720
Gentoo,
821
OpenSUSE,
922
+ Sailfish,
1023
UbuntuHardy,
1124
UbuntuIntrepid,
1225
UbuntuJaunty,
13-
@@ -119,6 +120,10 @@ public:
14-
return DistroVal >= DebianLenny && DistroVal <= DebianBullseye;
26+
@@ -124,6 +125,10 @@ public:
27+
return DistroVal >= DebianLenny && DistroVal <= DebianBookworm;
1528
}
1629

1730
+ bool IsSailfish() const {
1831
+ return DistroVal == Sailfish;
1932
+ }
2033
+
2134
bool IsUbuntu() const {
22-
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuFocal;
35+
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuJammy;
2336
}
2437
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
25-
index 06707fefc9d..cf14a4073fd 100644
38+
index 5ac38c34d112..cccb2026e527 100644
2639
--- a/clang/lib/Driver/Distro.cpp
2740
+++ b/clang/lib/Driver/Distro.cpp
28-
@@ -163,6 +163,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS,
41+
@@ -197,6 +197,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
2942
if (VFS.exists("/etc/gentoo-release"))
3043
return Distro::Gentoo;
3144

@@ -36,40 +49,39 @@ index 06707fefc9d..cf14a4073fd 100644
3649
}
3750

3851
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
39-
index e8ef881e89a..1bad4f13226 100644
52+
index 7a9570a686f4..e7f57c824961 100644
4053
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
4154
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
42-
@@ -1999,7 +1999,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
55+
@@ -2073,7 +2073,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
4356
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
4457
static const char *const AArch64Triples[] = {
4558
"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"};
59+
- "aarch64-suse-linux"};
60+
+ "aarch64-suse-linux", "aarch64-meego-linux-gnu"};
4861
static const char *const AArch64beLibDirs[] = {"/lib"};
4962
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
5063
"aarch64_be-linux-gnu"};
51-
@@ -2009,6 +2009,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
52-
"arm-linux-androideabi"};
64+
@@ -2082,6 +2082,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
65+
static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
5366
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
5467
"armv7hl-redhat-linux-gnueabi",
5568
+ "armv7hl-meego-linux-gnueabi",
5669
"armv6hl-suse-linux-gnueabi",
5770
"armv7hl-suse-linux-gnueabi"};
5871
static const char *const ARMebLibDirs[] = {"/lib"};
59-
@@ -2036,7 +2037,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"};
72+
@@ -2108,6 +2109,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
73+
"i586-linux-gnu", "i686-linux-gnu", "i686-pc-linux-gnu",
74+
"i386-redhat-linux6E", "i686-redhat-linux", "i386-redhat-linux",
75+
"i586-suse-linux", "i686-montavista-linux", "i686-gnu",
76+
+ "i486-meego-linux"
77+
};
6578

66-
static const char *const MIPSLibDirs[] = {"/lib"};
67-
static const char *const MIPSTriples[] = {
79+
static const char *const M68kLibDirs[] = {"/lib"};
6880
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
69-
index 6532c899492..3fa0bea23bd 100644
81+
index 83cb41159de7..e7c2dcaef02a 100644
7082
--- a/clang/lib/Driver/ToolChains/Linux.cpp
7183
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
72-
@@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
84+
@@ -194,7 +194,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
7385
}
7486

7587
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
@@ -78,7 +90,7 @@ index 6532c899492..3fa0bea23bd 100644
7890
ExtraOpts.push_back("-z");
7991
ExtraOpts.push_back("relro");
8092
}
81-
@@ -289,13 +289,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
93+
@@ -233,13 +233,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
8294
// Hexagon linker/loader does not support .gnu.hash
8395
if (!IsMips && !IsHexagon) {
8496
if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
@@ -94,7 +106,7 @@ index 6532c899492..3fa0bea23bd 100644
94106
(IsAndroid && Triple.isAndroidVersionLT(23)))
95107
ExtraOpts.push_back("--hash-style=both");
96108
}
97-
@@ -304,7 +304,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
109+
@@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
98110
ExtraOpts.push_back("--build-id");
99111
#endif
100112

Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
From 690373af5a5d50cf115ed6e4d2849bb786f9dc8e Mon Sep 17 00:00:00 2001
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22
From: serge-sans-paille <[email protected]>
33
Date: Tue, 10 Dec 2019 09:18:03 +0000
44
Subject: [PATCH] Make -funwind-tables the default for all archs
55

66
---
77
clang/lib/Driver/ToolChain.cpp | 2 +-
8-
clang/lib/Driver/ToolChains/Gnu.cpp | 2 +-
9-
2 files changed, 2 insertions(+), 2 deletions(-)
8+
clang/lib/Driver/ToolChains/Gnu.cpp | 3 +++
9+
2 files changed, 4 insertions(+), 1 deletion(-)
1010

1111
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
12-
index 18400d9def5..2643e9decc3 100644
12+
index d657d21bfcdb..eac667382fa9 100644
1313
--- a/clang/lib/Driver/ToolChain.cpp
1414
+++ b/clang/lib/Driver/ToolChain.cpp
15-
@@ -247,7 +247,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
15+
@@ -258,7 +258,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
1616
}
1717

1818
bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const {
@@ -22,18 +22,16 @@ index 18400d9def5..2643e9decc3 100644
2222

2323
Tool *ToolChain::getClang() const {
2424
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
25-
index e8ef881e89a..088a21455ac 100644
25+
index e7f57c824961..9c44b2e741ce 100644
2626
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
2727
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
28-
@@ -2610,7 +2610,7 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const {
28+
@@ -2692,6 +2692,9 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const {
2929
}
3030

3131
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-
32+
+ if (getTriple().isMeeGo()) {
33+
+ return true;
34+
+ }
35+
switch (getArch()) {
36+
case llvm::Triple::aarch64:
37+
case llvm::Triple::ppc:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ruben De Smet <[email protected]>
3+
Date: Sun, 26 Jun 2022 10:42:13 +0200
4+
Subject: [PATCH] Disable out-of-line atomics on MeeGo
5+
6+
---
7+
clang/lib/Driver/ToolChains/Linux.cpp | 2 ++
8+
1 file changed, 2 insertions(+)
9+
10+
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
11+
index e7c2dcaef02a..9b377eca9dc8 100644
12+
--- a/clang/lib/Driver/ToolChains/Linux.cpp
13+
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
14+
@@ -672,6 +672,8 @@ bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const {
15+
// and libgcc since 9.3.1
16+
assert(getTriple().isAArch64() && "expected AArch64 target!");
17+
ToolChain::RuntimeLibType RtLib = GetRuntimeLibType(Args);
18+
+ if (getTriple().isMeeGo())
19+
+ return false;
20+
if (RtLib == ToolChain::RLT_CompilerRT)
21+
return true;
22+
assert(RtLib == ToolChain::RLT_Libgcc && "unexpected runtime library type!");

0 commit comments

Comments
 (0)