Skip to content

Commit 024a5c8

Browse files
direc85rubdos
authored andcommitted
Fix patches for LLVM 16
1 parent 93bc679 commit 024a5c8

5 files changed

+74
-77
lines changed

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

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ From: Ruben De Smet <[email protected]>
33
Date: Sun, 26 Jun 2022 10:48:13 +0200
44
Subject: [PATCH] LLVM: Add MeeGo vendor type
55

6+
Co-authored-by: Matti Viljanen <[email protected]>
67
---
7-
llvm/include/llvm/ADT/Triple.h | 3 ++-
8-
llvm/lib/Support/Triple.cpp | 12 ++++++++++++
9-
llvm/unittests/ADT/TripleTest.cpp | 6 ++++++
8+
llvm/include/llvm/TargetParser/Triple.h | 3 ++-
9+
llvm/lib/TargetParser/Triple.cpp | 12 ++++++++++++
10+
llvm/unittests/TargetParser/TripleTest.cpp | 6 ++++++
1011
3 files changed, 20 insertions(+), 1 deletion(-)
1112

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:
13+
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
14+
index 59513fa2f2062af90fee7c7c42149674faa05299..5bddc2a52c05172ce444c607b42d037fbc835267 100644
15+
--- a/llvm/include/llvm/TargetParser/Triple.h
16+
+++ b/llvm/include/llvm/TargetParser/Triple.h
17+
@@ -180,7 +180,8 @@ public:
1718
Mesa,
1819
SUSE,
1920
OpenEmbedded,
@@ -23,27 +24,27 @@ index 42277c013035..9e36dfd4d2d5 100644
2324
};
2425
enum OSType {
2526
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) {
27+
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
28+
index a68035989a93ea1f8f81bb5acc07e5c78db19eb5..ef48f02504ace6543e77e5e88622d262168e0e79 100644
29+
--- a/llvm/lib/TargetParser/Triple.cpp
30+
+++ b/llvm/lib/TargetParser/Triple.cpp
31+
@@ -188,6 +188,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
3132
case Freescale: return "fsl";
3233
case IBM: return "ibm";
3334
case ImaginationTechnologies: return "img";
3435
+ case MeeGo: return "meego";
3536
case Mesa: return "mesa";
3637
case MipsTechnologies: return "mti";
3738
case Myriad: return "myriad";
38-
@@ -507,6 +508,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
39+
@@ -552,6 +553,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
3940
.Case("mesa", Triple::Mesa)
4041
.Case("suse", Triple::SUSE)
4142
.Case("oe", Triple::OpenEmbedded)
4243
+ .Case("meego", Triple::MeeGo)
4344
.Default(Triple::UnknownVendor);
4445
}
4546

46-
@@ -802,6 +804,9 @@ Triple::Triple(const Twine &Str)
47+
@@ -902,6 +904,9 @@ Triple::Triple(const Twine &Str)
4748
OS = parseOS(Components[2]);
4849
if (Components.size() > 3) {
4950
Environment = parseEnvironment(Components[3]);
@@ -53,7 +54,7 @@ index a9afcc9db96a..c4307bf457c7 100644
5354
ObjectFormat = parseFormat(Components[3]);
5455
}
5556
}
56-
@@ -853,6 +858,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
57+
@@ -953,6 +958,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
5758
ObjectFormat(parseFormat(EnvironmentStr.str())) {
5859
if (ObjectFormat == Triple::UnknownObjectFormat)
5960
ObjectFormat = getDefaultFormat(*this);
@@ -64,7 +65,7 @@ index a9afcc9db96a..c4307bf457c7 100644
6465
}
6566

6667
std::string Triple::normalize(StringRef Str) {
67-
@@ -1103,6 +1112,9 @@ static VersionTuple parseVersionFromName(StringRef Name) {
68+
@@ -1207,6 +1216,9 @@ static VersionTuple parseVersionFromName(StringRef Name) {
6869
VersionTuple Triple::getEnvironmentVersion() const {
6970
StringRef EnvironmentName = getEnvironmentName();
7071
StringRef EnvironmentTypeName = getEnvironmentTypeName(getEnvironment());
@@ -74,11 +75,11 @@ index a9afcc9db96a..c4307bf457c7 100644
7475
if (EnvironmentName.startswith(EnvironmentTypeName))
7576
EnvironmentName = EnvironmentName.substr(EnvironmentTypeName.size());
7677

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) {
78+
diff --git a/llvm/unittests/TargetParser/TripleTest.cpp b/llvm/unittests/TargetParser/TripleTest.cpp
79+
index 77de43a16d0a24026988c8a5c675c5d8d9bbd816..c25e33d2f235f35316a6a55238981779fd158bd4 100644
80+
--- a/llvm/unittests/TargetParser/TripleTest.cpp
81+
+++ b/llvm/unittests/TargetParser/TripleTest.cpp
82+
@@ -535,6 +535,12 @@ TEST(TripleTest, ParsedIDs) {
8283
EXPECT_EQ(Triple::Linux, T.getOS());
8384
EXPECT_EQ(Triple::GNUEABI, T.getEnvironment());
8485

rpm/0002-Add-Triple-isMeeGo.patch

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ From: Ruben De Smet <[email protected]>
33
Date: Sun, 26 Jun 2022 10:41:44 +0200
44
Subject: [PATCH] Add Triple::isMeeGo()
55

6+
Co-authored-by: Matti Viljanen <[email protected]>
67
---
7-
llvm/include/llvm/ADT/Triple.h | 3 +++
8+
llvm/include/llvm/TargetParser/Triple.h | 3 +++
89
1 file changed, 3 insertions(+)
910

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:
11+
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
12+
index 5bddc2a52c05172ce444c607b42d037fbc835267..978a4231cfd81ea543f810d089f4f702b60b465e 100644
13+
--- a/llvm/include/llvm/TargetParser/Triple.h
14+
+++ b/llvm/include/llvm/TargetParser/Triple.h
15+
@@ -724,6 +724,9 @@ public:
1516
/// Tests whether the target is Android
1617
bool isAndroid() const { return getEnvironment() == Triple::Android; }
1718

rpm/0003-Clang-SailfishOS-toolchain.patch

Lines changed: 29 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,43 @@ From: Ruben De Smet <[email protected]>
33
Date: Sun, 26 Jun 2022 10:57:51 +0200
44
Subject: [PATCH] Clang: SailfishOS toolchain
55

6+
Co-authored-by: Matti Viljanen <[email protected]>
67
Signed-off-by: Ruben De Smet <[email protected]>
78
---
89
clang/include/clang/Driver/Distro.h | 5 +++++
910
clang/lib/Driver/Distro.cpp | 3 +++
1011
clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++-
11-
clang/lib/Driver/ToolChains/Linux.cpp | 8 ++++----
12-
4 files changed, 15 insertions(+), 5 deletions(-)
12+
clang/lib/Driver/ToolChains/Linux.cpp | 7 +++++--
13+
4 files changed, 16 insertions(+), 3 deletions(-)
1314

1415
diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
15-
index 2723f75e8945..58616ad541e1 100644
16+
index 1aaf93ddb7c43ba8202e53288a934f9c76a13e2b..581a1712d9975dfdbd23792da3174644fdbc2d42 100644
1617
--- a/clang/include/clang/Driver/Distro.h
1718
+++ b/clang/include/clang/Driver/Distro.h
18-
@@ -45,6 +45,7 @@ public:
19+
@@ -46,6 +46,7 @@ public:
1920
Fedora,
2021
Gentoo,
2122
OpenSUSE,
2223
+ Sailfish,
2324
UbuntuHardy,
2425
UbuntuIntrepid,
2526
UbuntuJaunty,
26-
@@ -124,6 +125,10 @@ public:
27-
return DistroVal >= DebianLenny && DistroVal <= DebianBookworm;
27+
@@ -127,6 +128,10 @@ public:
28+
return DistroVal >= DebianLenny && DistroVal <= DebianTrixie;
2829
}
2930

3031
+ bool IsSailfish() const {
3132
+ return DistroVal == Sailfish;
3233
+ }
3334
+
3435
bool IsUbuntu() const {
35-
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuJammy;
36+
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuLunar;
3637
}
3738
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
38-
index 5ac38c34d112..cccb2026e527 100644
39+
index 87a0c5a58511561a4eac9e651e313542e638d2ca..de6457bd3dfb8cceeee89fea7cee41308ace337c 100644
3940
--- a/clang/lib/Driver/Distro.cpp
4041
+++ b/clang/lib/Driver/Distro.cpp
41-
@@ -197,6 +197,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
42+
@@ -201,6 +201,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
4243
if (VFS.exists("/etc/gentoo-release"))
4344
return Distro::Gentoo;
4445

@@ -49,10 +50,10 @@ index 5ac38c34d112..cccb2026e527 100644
4950
}
5051

5152
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
52-
index 7a9570a686f4..e7f57c824961 100644
53+
index 4f2340316654301ddcc70e293a9bf0da327a6de3..814f3482a1b598b24e4b3f63d811666791a6e260 100644
5354
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
5455
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
55-
@@ -2073,7 +2073,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
56+
@@ -2218,7 +2218,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
5657
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
5758
static const char *const AArch64Triples[] = {
5859
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
@@ -61,27 +62,27 @@ index 7a9570a686f4..e7f57c824961 100644
6162
static const char *const AArch64beLibDirs[] = {"/lib"};
6263
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
6364
"aarch64_be-linux-gnu"};
64-
@@ -2082,6 +2082,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
65+
@@ -2227,6 +2227,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
6566
static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
6667
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
6768
"armv7hl-redhat-linux-gnueabi",
6869
+ "armv7hl-meego-linux-gnueabi",
6970
"armv6hl-suse-linux-gnueabi",
7071
"armv7hl-suse-linux-gnueabi"};
7172
static const char *const ARMebLibDirs[] = {"/lib"};
72-
@@ -2108,6 +2109,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
73+
@@ -2257,6 +2258,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
7374
"i586-linux-gnu", "i686-linux-gnu", "i686-pc-linux-gnu",
7475
"i386-redhat-linux6E", "i686-redhat-linux", "i386-redhat-linux",
7576
"i586-suse-linux", "i686-montavista-linux", "i686-gnu",
7677
+ "i486-meego-linux"
7778
};
7879

79-
static const char *const M68kLibDirs[] = {"/lib"};
80+
static const char *const LoongArch64LibDirs[] = {"/lib64", "/lib"};
8081
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
81-
index 83cb41159de7..e7c2dcaef02a 100644
82+
index c6fb290ffdb4dc6a779737a4e838befbc7aba16e..72ef4fff4400f08cf429c1072f7edb69d8e440f5 100644
8283
--- a/clang/lib/Driver/ToolChains/Linux.cpp
8384
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
84-
@@ -194,7 +194,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
85+
@@ -197,7 +197,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
8586
}
8687

8788
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
@@ -90,28 +91,20 @@ index 83cb41159de7..e7c2dcaef02a 100644
9091
ExtraOpts.push_back("-z");
9192
ExtraOpts.push_back("relro");
9293
}
93-
@@ -233,13 +233,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
94-
// Hexagon linker/loader does not support .gnu.hash
94+
@@ -241,12 +241,15 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
9595
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() ||
106-
(IsAndroid && Triple.isAndroidVersionLT(23)))
96+
if (Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||
97+
Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic ||
98+
- (IsAndroid && Triple.isAndroidVersionLT(23)))
99+
+ Distro.IsSailfish() || (IsAndroid && Triple.isAndroidVersionLT(23)))
107100
ExtraOpts.push_back("--hash-style=both");
101+
else
102+
ExtraOpts.push_back("--hash-style=gnu");
108103
}
109-
@@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
104+
105+
+ if (Distro.IsSailfish())
106+
+ ExtraOpts.push_back("--enable-new-dtags");
107+
+
108+
#ifdef ENABLE_LINKER_BUILD_ID
110109
ExtraOpts.push_back("--build-id");
111110
#endif
112-
113-
- if (IsAndroid || Distro.IsOpenSUSE())
114-
+ if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsSailfish())
115-
ExtraOpts.push_back("--enable-new-dtags");
116-
117-
// The selection of paths to try here is designed to match the patterns which

rpm/0004-Make-funwind-tables-the-default-for-all-archs.patch

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,35 @@ 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

6+
Co-authored-by: Matti Viljanen <[email protected]>
67
---
78
clang/lib/Driver/ToolChain.cpp | 2 +-
89
clang/lib/Driver/ToolChains/Gnu.cpp | 3 +++
910
2 files changed, 4 insertions(+), 1 deletion(-)
1011

1112
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
12-
index d657d21bfcdb..eac667382fa9 100644
13+
index bc70205a6c01eb06a27cb6cd590da93318527bc5..bfd34869913f734cae98252da61572bd73d56f19 100644
1314
--- a/clang/lib/Driver/ToolChain.cpp
1415
+++ b/clang/lib/Driver/ToolChain.cpp
15-
@@ -258,7 +258,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
16-
}
16+
@@ -324,7 +324,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
1717

18-
bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const {
19-
- return false;
20-
+ return true;
18+
ToolChain::UnwindTableLevel
19+
ToolChain::getDefaultUnwindTableLevel(const ArgList &Args) const {
20+
- return UnwindTableLevel::None;
21+
+ return UnwindTableLevel::Asynchronous;
2122
}
2223

2324
Tool *ToolChain::getClang() const {
2425
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
25-
index e7f57c824961..9c44b2e741ce 100644
26+
index 814f3482a1b598b24e4b3f63d811666791a6e260..c492e45a2d0b52905234c83c193237999180277b 100644
2627
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
2728
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
28-
@@ -2692,6 +2692,9 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const {
29-
}
29+
@@ -2857,6 +2857,9 @@ void Generic_GCC::printVerboseInfo(raw_ostream &OS) const {
3030

31-
bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
31+
ToolChain::UnwindTableLevel
32+
Generic_GCC::getDefaultUnwindTableLevel(const ArgList &Args) const {
3233
+ if (getTriple().isMeeGo()) {
33-
+ return true;
34+
+ return UnwindTableLevel::Asynchronous;
3435
+ }
3536
switch (getArch()) {
3637
case llvm::Triple::aarch64:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ From: Ruben De Smet <[email protected]>
33
Date: Sun, 26 Jun 2022 10:42:13 +0200
44
Subject: [PATCH] Disable out-of-line atomics on MeeGo
55

6+
Co-authored-by: Matti Viljanen <[email protected]>
67
---
78
clang/lib/Driver/ToolChains/Linux.cpp | 2 ++
89
1 file changed, 2 insertions(+)
910

1011
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
11-
index e7c2dcaef02a..9b377eca9dc8 100644
12+
index 72ef4fff4400f08cf429c1072f7edb69d8e440f5..8ede9b7ce1fd234718390c3b4356521c0763950d 100644
1213
--- a/clang/lib/Driver/ToolChains/Linux.cpp
1314
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
14-
@@ -672,6 +672,8 @@ bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const {
15+
@@ -725,6 +725,8 @@ bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const {
1516
// and libgcc since 9.3.1
1617
assert(getTriple().isAArch64() && "expected AArch64 target!");
1718
ToolChain::RuntimeLibType RtLib = GetRuntimeLibType(Args);

0 commit comments

Comments
 (0)