Skip to content

Commit 8e7c9ba

Browse files
committed
[llvm] Update patches to LLVM 18
1 parent 469d1ad commit 8e7c9ba

5 files changed

+67
-133
lines changed

rpm/0001-LLVM-Add-MeeGo-vendor-type.patch

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2-
From: Ruben De Smet <ruben.de.smet@rubdos.be>
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-
12-
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
13-
index 42277c013035..9e36dfd4d2d5 100644
14-
--- a/llvm/include/llvm/ADT/Triple.h
15-
+++ b/llvm/include/llvm/ADT/Triple.h
16-
@@ -165,7 +165,8 @@ public:
1+
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
2+
index 49ec8de9c528..dc195e8dfcfd 100644
3+
--- a/llvm/include/llvm/TargetParser/Triple.h
4+
+++ b/llvm/include/llvm/TargetParser/Triple.h
5+
@@ -182,7 +182,8 @@ public:
176
Mesa,
187
SUSE,
198
OpenEmbedded,
@@ -23,27 +12,27 @@ index 42277c013035..9e36dfd4d2d5 100644
2312
};
2413
enum OSType {
2514
UnknownOS,
26-
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
27-
index a9afcc9db96a..c4307bf457c7 100644
28-
--- a/llvm/lib/Support/Triple.cpp
29-
+++ b/llvm/lib/Support/Triple.cpp
30-
@@ -177,6 +177,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
15+
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
16+
index 0bbe8a3cedfd..eefd6b90ce2d 100644
17+
--- a/llvm/lib/TargetParser/Triple.cpp
18+
+++ b/llvm/lib/TargetParser/Triple.cpp
19+
@@ -221,6 +221,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
3120
case Freescale: return "fsl";
3221
case IBM: return "ibm";
3322
case ImaginationTechnologies: return "img";
3423
+ case MeeGo: return "meego";
3524
case Mesa: return "mesa";
3625
case MipsTechnologies: return "mti";
37-
case Myriad: return "myriad";
38-
@@ -507,6 +508,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
26+
case NVIDIA: return "nvidia";
27+
@@ -602,6 +603,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
3928
.Case("mesa", Triple::Mesa)
4029
.Case("suse", Triple::SUSE)
4130
.Case("oe", Triple::OpenEmbedded)
4231
+ .Case("meego", Triple::MeeGo)
4332
.Default(Triple::UnknownVendor);
4433
}
4534

46-
@@ -802,6 +804,9 @@ Triple::Triple(const Twine &Str)
35+
@@ -938,6 +940,9 @@ Triple::Triple(const Twine &Str)
4736
OS = parseOS(Components[2]);
4837
if (Components.size() > 3) {
4938
Environment = parseEnvironment(Components[3]);
@@ -53,7 +42,7 @@ index a9afcc9db96a..c4307bf457c7 100644
5342
ObjectFormat = parseFormat(Components[3]);
5443
}
5544
}
56-
@@ -853,6 +858,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
45+
@@ -989,6 +994,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
5746
ObjectFormat(parseFormat(EnvironmentStr.str())) {
5847
if (ObjectFormat == Triple::UnknownObjectFormat)
5948
ObjectFormat = getDefaultFormat(*this);
@@ -64,21 +53,21 @@ index a9afcc9db96a..c4307bf457c7 100644
6453
}
6554

6655
std::string Triple::normalize(StringRef Str) {
67-
@@ -1103,6 +1112,9 @@ static VersionTuple parseVersionFromName(StringRef Name) {
68-
VersionTuple Triple::getEnvironmentVersion() const {
56+
@@ -1220,6 +1229,9 @@ VersionTuple Triple::getEnvironmentVersion() const {
57+
StringRef Triple::getEnvironmentVersionString() const {
6958
StringRef EnvironmentName = getEnvironmentName();
7059
StringRef EnvironmentTypeName = getEnvironmentTypeName(getEnvironment());
7160
+ // MeeGo uses "gnueabi" to mean "gnueabihf"
7261
+ if (Vendor == Triple::MeeGo && getEnvironment() == Triple::GNUEABIHF)
7362
+ EnvironmentTypeName = "gnueabi";
74-
if (EnvironmentName.startswith(EnvironmentTypeName))
75-
EnvironmentName = EnvironmentName.substr(EnvironmentTypeName.size());
76-
77-
diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp
78-
index 3006ab6d40e8..7a28ed624232 100644
79-
--- a/llvm/unittests/ADT/TripleTest.cpp
80-
+++ b/llvm/unittests/ADT/TripleTest.cpp
81-
@@ -384,6 +384,12 @@ TEST(TripleTest, ParsedIDs) {
63+
EnvironmentName.consume_front(EnvironmentTypeName);
64+
return EnvironmentName;
65+
}
66+
diff --git a/llvm/unittests/TargetParser/TripleTest.cpp b/llvm/unittests/TargetParser/TripleTest.cpp
67+
index 4db54a08c0f6..5199caabf224 100644
68+
--- a/llvm/unittests/TargetParser/TripleTest.cpp
69+
+++ b/llvm/unittests/TargetParser/TripleTest.cpp
70+
@@ -642,6 +642,12 @@ TEST(TripleTest, ParsedIDs) {
8271
EXPECT_EQ(Triple::Linux, T.getOS());
8372
EXPECT_EQ(Triple::GNUEABI, T.getEnvironment());
8473

rpm/0002-Add-Triple-isMeeGo.patch

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2-
From: Ruben De Smet <ruben.de.smet@rubdos.be>
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:
1+
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
2+
index dc195e8dfcfd..59f58657cae0 100644
3+
--- a/llvm/include/llvm/TargetParser/Triple.h
4+
+++ b/llvm/include/llvm/TargetParser/Triple.h
5+
@@ -744,6 +744,9 @@ public:
156
/// Tests whether the target is Android
167
bool isAndroid() const { return getEnvironment() == Triple::Android; }
178

Lines changed: 23 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,31 @@
1-
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2-
From: Ruben De Smet <ruben.de.smet@rubdos.be>
3-
Date: Sun, 26 Jun 2022 10:57:51 +0200
4-
Subject: [PATCH] Clang: SailfishOS toolchain
5-
6-
Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
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-
141
diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
15-
index 2723f75e8945..58616ad541e1 100644
2+
index a8de94163e8b..240587994938 100644
163
--- a/clang/include/clang/Driver/Distro.h
174
+++ b/clang/include/clang/Driver/Distro.h
18-
@@ -45,6 +45,7 @@ public:
5+
@@ -46,6 +46,7 @@ public:
196
Fedora,
207
Gentoo,
218
OpenSUSE,
229
+ Sailfish,
2310
UbuntuHardy,
2411
UbuntuIntrepid,
2512
UbuntuJaunty,
26-
@@ -124,6 +125,10 @@ public:
27-
return DistroVal >= DebianLenny && DistroVal <= DebianBookworm;
13+
@@ -129,6 +130,10 @@ public:
14+
return DistroVal >= DebianLenny && DistroVal <= DebianTrixie;
2815
}
2916

3017
+ bool IsSailfish() const {
3118
+ return DistroVal == Sailfish;
3219
+ }
3320
+
3421
bool IsUbuntu() const {
35-
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuJammy;
22+
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuNoble;
3623
}
3724
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
38-
index 5ac38c34d112..cccb2026e527 100644
25+
index a7e7f169dc14..cd8684020dfe 100644
3926
--- a/clang/lib/Driver/Distro.cpp
4027
+++ b/clang/lib/Driver/Distro.cpp
41-
@@ -197,6 +197,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
28+
@@ -204,6 +204,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
4229
if (VFS.exists("/etc/gentoo-release"))
4330
return Distro::Gentoo;
4431

@@ -49,10 +36,10 @@ index 5ac38c34d112..cccb2026e527 100644
4936
}
5037

5138
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
52-
index 7a9570a686f4..e7f57c824961 100644
39+
index e5e1b1d77269..3d0d38972977 100644
5340
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
5441
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
55-
@@ -2073,7 +2073,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
42+
@@ -2452,7 +2452,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
5643
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
5744
static const char *const AArch64Triples[] = {
5845
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
@@ -61,27 +48,19 @@ index 7a9570a686f4..e7f57c824961 100644
6148
static const char *const AArch64beLibDirs[] = {"/lib"};
6249
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
6350
"aarch64_be-linux-gnu"};
64-
@@ -2082,6 +2082,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
51+
@@ -2461,6 +2461,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
6552
static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
6653
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
6754
"armv7hl-redhat-linux-gnueabi",
6855
+ "armv7hl-meego-linux-gnueabi",
6956
"armv6hl-suse-linux-gnueabi",
7057
"armv7hl-suse-linux-gnueabi"};
7158
static const char *const ARMebLibDirs[] = {"/lib"};
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-
};
78-
79-
static const char *const M68kLibDirs[] = {"/lib"};
8059
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
81-
index 83cb41159de7..e7c2dcaef02a 100644
60+
index 4300a2bdff17..8ac052972ebb 100644
8261
--- a/clang/lib/Driver/ToolChains/Linux.cpp
8362
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
84-
@@ -194,7 +194,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
63+
@@ -232,7 +232,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
8564
}
8665

8766
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
@@ -90,28 +69,22 @@ index 83cb41159de7..e7c2dcaef02a 100644
9069
ExtraOpts.push_back("-z");
9170
ExtraOpts.push_back("relro");
9271
}
93-
@@ -233,13 +233,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
72+
@@ -275,7 +275,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
9473
// Hexagon linker/loader does not support .gnu.hash
9574
if (!IsMips && !IsHexagon) {
96-
if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
97-
- (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
98-
+ (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) || Distro.IsSailfish() ||
99-
(IsAndroid && !Triple.isAndroidVersionLT(23)))
100-
ExtraOpts.push_back("--hash-style=gnu");
101-
102-
if (Distro.IsDebian() || Distro.IsOpenSUSE() ||
103-
Distro == Distro::UbuntuLucid || Distro == Distro::UbuntuJaunty ||
104-
- Distro == Distro::UbuntuKarmic ||
105-
+ Distro == Distro::UbuntuKarmic || Distro.IsSailfish() ||
75+
if (Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||
76+
- Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic ||
77+
+ Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic || Distro.IsSailfish() ||
10678
(IsAndroid && Triple.isAndroidVersionLT(23)))
10779
ExtraOpts.push_back("--hash-style=both");
108-
}
109-
@@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
80+
else
81+
@@ -286,6 +286,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
11082
ExtraOpts.push_back("--build-id");
11183
#endif
11284

113-
- if (IsAndroid || Distro.IsOpenSUSE())
114-
+ if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsSailfish())
115-
ExtraOpts.push_back("--enable-new-dtags");
116-
85+
+ if (Distro.IsSailfish())
86+
+ ExtraOpts.push_back("--enable-new-dtags");
87+
+
11788
// The selection of paths to try here is designed to match the patterns which
89+
// the GCC driver itself uses, as this is part of the GCC-compatible driver.
90+
// This was determined by running GCC in a fake filesystem, creating all
Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
1-
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2-
From: serge-sans-paille <sguelton@redhat.com>
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 | 3 +++
9-
2 files changed, 4 insertions(+), 1 deletion(-)
10-
111
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
12-
index d657d21bfcdb..eac667382fa9 100644
2+
index 388030592b48..264a849da435 100644
133
--- a/clang/lib/Driver/ToolChain.cpp
144
+++ b/clang/lib/Driver/ToolChain.cpp
15-
@@ -258,7 +258,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
16-
}
5+
@@ -424,7 +424,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
176

18-
bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const {
19-
- return false;
20-
+ return true;
7+
ToolChain::UnwindTableLevel
8+
ToolChain::getDefaultUnwindTableLevel(const ArgList &Args) const {
9+
- return UnwindTableLevel::None;
10+
+ return UnwindTableLevel::Asynchronous;
2111
}
2212

23-
Tool *ToolChain::getClang() const {
13+
unsigned ToolChain::GetDefaultDwarfVersion() const {
2414
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
25-
index e7f57c824961..9c44b2e741ce 100644
15+
index 3d0d38972977..b4b35b753a1c 100644
2616
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
2717
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
28-
@@ -2692,6 +2692,9 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const {
29-
}
18+
@@ -3088,6 +3088,9 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const {
3019

31-
bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
20+
ToolChain::UnwindTableLevel
21+
Generic_GCC::getDefaultUnwindTableLevel(const ArgList &Args) const {
3222
+ if (getTriple().isMeeGo()) {
33-
+ return true;
23+
+ return UnwindTableLevel::Asynchronous;
3424
+ }
3525
switch (getArch()) {
3626
case llvm::Triple::aarch64:
37-
case llvm::Triple::ppc:
27+
case llvm::Triple::aarch64_be:

rpm/0005-Disable-out-of-line-atomics-on-MeeGo.patch

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2-
From: Ruben De Smet <ruben.de.smet@rubdos.be>
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-
101
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
11-
index e7c2dcaef02a..9b377eca9dc8 100644
2+
index 8ac052972ebb..59a6b6555249 100644
123
--- a/clang/lib/Driver/ToolChains/Linux.cpp
134
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
14-
@@ -672,6 +672,8 @@ bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const {
5+
@@ -761,6 +761,8 @@ bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const {
156
// and libgcc since 9.3.1
167
assert(getTriple().isAArch64() && "expected AArch64 target!");
178
ToolChain::RuntimeLibType RtLib = GetRuntimeLibType(Args);

0 commit comments

Comments
 (0)