Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM 18 #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm
Submodule llvm updated from 8dfdcc to 3b5b5c
59 changes: 24 additions & 35 deletions rpm/0001-LLVM-Add-MeeGo-vendor-type.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ruben De Smet <ruben.de.smet@rubdos.be>
Date: Sun, 26 Jun 2022 10:48:13 +0200
Subject: [PATCH] LLVM: Add MeeGo vendor type

---
llvm/include/llvm/ADT/Triple.h | 3 ++-
llvm/lib/Support/Triple.cpp | 12 ++++++++++++
llvm/unittests/ADT/TripleTest.cpp | 6 ++++++
3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index 42277c013035..9e36dfd4d2d5 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -165,7 +165,8 @@ public:
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 49ec8de9c528..dc195e8dfcfd 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -182,7 +182,8 @@ public:
Mesa,
SUSE,
OpenEmbedded,
Expand All @@ -23,27 +12,27 @@ index 42277c013035..9e36dfd4d2d5 100644
};
enum OSType {
UnknownOS,
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index a9afcc9db96a..c4307bf457c7 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -177,6 +177,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index 0bbe8a3cedfd..eefd6b90ce2d 100644
--- a/llvm/lib/TargetParser/Triple.cpp
+++ b/llvm/lib/TargetParser/Triple.cpp
@@ -221,6 +221,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
case Freescale: return "fsl";
case IBM: return "ibm";
case ImaginationTechnologies: return "img";
+ case MeeGo: return "meego";
case Mesa: return "mesa";
case MipsTechnologies: return "mti";
case Myriad: return "myriad";
@@ -507,6 +508,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
case NVIDIA: return "nvidia";
@@ -602,6 +603,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
.Case("mesa", Triple::Mesa)
.Case("suse", Triple::SUSE)
.Case("oe", Triple::OpenEmbedded)
+ .Case("meego", Triple::MeeGo)
.Default(Triple::UnknownVendor);
}

@@ -802,6 +804,9 @@ Triple::Triple(const Twine &Str)
@@ -938,6 +940,9 @@ Triple::Triple(const Twine &Str)
OS = parseOS(Components[2]);
if (Components.size() > 3) {
Environment = parseEnvironment(Components[3]);
Expand All @@ -53,7 +42,7 @@ index a9afcc9db96a..c4307bf457c7 100644
ObjectFormat = parseFormat(Components[3]);
}
}
@@ -853,6 +858,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
@@ -989,6 +994,10 @@ Triple::Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
ObjectFormat(parseFormat(EnvironmentStr.str())) {
if (ObjectFormat == Triple::UnknownObjectFormat)
ObjectFormat = getDefaultFormat(*this);
Expand All @@ -64,21 +53,21 @@ index a9afcc9db96a..c4307bf457c7 100644
}

std::string Triple::normalize(StringRef Str) {
@@ -1103,6 +1112,9 @@ static VersionTuple parseVersionFromName(StringRef Name) {
VersionTuple Triple::getEnvironmentVersion() const {
@@ -1220,6 +1229,9 @@ VersionTuple Triple::getEnvironmentVersion() const {
StringRef Triple::getEnvironmentVersionString() const {
StringRef EnvironmentName = getEnvironmentName();
StringRef EnvironmentTypeName = getEnvironmentTypeName(getEnvironment());
+ // MeeGo uses "gnueabi" to mean "gnueabihf"
+ if (Vendor == Triple::MeeGo && getEnvironment() == Triple::GNUEABIHF)
+ EnvironmentTypeName = "gnueabi";
if (EnvironmentName.startswith(EnvironmentTypeName))
EnvironmentName = EnvironmentName.substr(EnvironmentTypeName.size());

diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp
index 3006ab6d40e8..7a28ed624232 100644
--- a/llvm/unittests/ADT/TripleTest.cpp
+++ b/llvm/unittests/ADT/TripleTest.cpp
@@ -384,6 +384,12 @@ TEST(TripleTest, ParsedIDs) {
EnvironmentName.consume_front(EnvironmentTypeName);
return EnvironmentName;
}
diff --git a/llvm/unittests/TargetParser/TripleTest.cpp b/llvm/unittests/TargetParser/TripleTest.cpp
index 4db54a08c0f6..5199caabf224 100644
--- a/llvm/unittests/TargetParser/TripleTest.cpp
+++ b/llvm/unittests/TargetParser/TripleTest.cpp
@@ -642,6 +642,12 @@ TEST(TripleTest, ParsedIDs) {
EXPECT_EQ(Triple::Linux, T.getOS());
EXPECT_EQ(Triple::GNUEABI, T.getEnvironment());

Expand Down
19 changes: 5 additions & 14 deletions rpm/0002-Add-Triple-isMeeGo.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ruben De Smet <ruben.de.smet@rubdos.be>
Date: Sun, 26 Jun 2022 10:41:44 +0200
Subject: [PATCH] Add Triple::isMeeGo()

---
llvm/include/llvm/ADT/Triple.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index 9e36dfd4d2d5..8e66888615ff 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -657,6 +657,9 @@ public:
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index dc195e8dfcfd..59f58657cae0 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -744,6 +744,9 @@ public:
/// Tests whether the target is Android
bool isAndroid() const { return getEnvironment() == Triple::Android; }

Expand Down
73 changes: 23 additions & 50 deletions rpm/0003-Clang-SailfishOS-toolchain.patch
Original file line number Diff line number Diff line change
@@ -1,44 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ruben De Smet <ruben.de.smet@rubdos.be>
Date: Sun, 26 Jun 2022 10:57:51 +0200
Subject: [PATCH] Clang: SailfishOS toolchain

Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
---
clang/include/clang/Driver/Distro.h | 5 +++++
clang/lib/Driver/Distro.cpp | 3 +++
clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++-
clang/lib/Driver/ToolChains/Linux.cpp | 8 ++++----
4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
index 2723f75e8945..58616ad541e1 100644
index a8de94163e8b..240587994938 100644
--- a/clang/include/clang/Driver/Distro.h
+++ b/clang/include/clang/Driver/Distro.h
@@ -45,6 +45,7 @@ public:
@@ -46,6 +46,7 @@ public:
Fedora,
Gentoo,
OpenSUSE,
+ Sailfish,
UbuntuHardy,
UbuntuIntrepid,
UbuntuJaunty,
@@ -124,6 +125,10 @@ public:
return DistroVal >= DebianLenny && DistroVal <= DebianBookworm;
@@ -129,6 +130,10 @@ public:
return DistroVal >= DebianLenny && DistroVal <= DebianTrixie;
}

+ bool IsSailfish() const {
+ return DistroVal == Sailfish;
+ }
+
bool IsUbuntu() const {
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuJammy;
return DistroVal >= UbuntuHardy && DistroVal <= UbuntuNoble;
}
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
index 5ac38c34d112..cccb2026e527 100644
index a7e7f169dc14..cd8684020dfe 100644
--- a/clang/lib/Driver/Distro.cpp
+++ b/clang/lib/Driver/Distro.cpp
@@ -197,6 +197,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
@@ -204,6 +204,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
if (VFS.exists("/etc/gentoo-release"))
return Distro::Gentoo;

Expand All @@ -49,10 +36,10 @@ index 5ac38c34d112..cccb2026e527 100644
}

diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 7a9570a686f4..e7f57c824961 100644
index e5e1b1d77269..3d0d38972977 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2073,7 +2073,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
@@ -2452,7 +2452,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
static const char *const AArch64Triples[] = {
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
Expand All @@ -61,27 +48,19 @@ index 7a9570a686f4..e7f57c824961 100644
static const char *const AArch64beLibDirs[] = {"/lib"};
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
"aarch64_be-linux-gnu"};
@@ -2082,6 +2082,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
@@ -2461,6 +2461,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
"armv7hl-redhat-linux-gnueabi",
+ "armv7hl-meego-linux-gnueabi",
"armv6hl-suse-linux-gnueabi",
"armv7hl-suse-linux-gnueabi"};
static const char *const ARMebLibDirs[] = {"/lib"};
@@ -2108,6 +2109,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
"i586-linux-gnu", "i686-linux-gnu", "i686-pc-linux-gnu",
"i386-redhat-linux6E", "i686-redhat-linux", "i386-redhat-linux",
"i586-suse-linux", "i686-montavista-linux", "i686-gnu",
+ "i486-meego-linux"
};

static const char *const M68kLibDirs[] = {"/lib"};
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 83cb41159de7..e7c2dcaef02a 100644
index 4300a2bdff17..8ac052972ebb 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -194,7 +194,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
@@ -232,7 +232,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
}

if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
Expand All @@ -90,28 +69,22 @@ index 83cb41159de7..e7c2dcaef02a 100644
ExtraOpts.push_back("-z");
ExtraOpts.push_back("relro");
}
@@ -233,13 +233,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
@@ -275,7 +275,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
// Hexagon linker/loader does not support .gnu.hash
if (!IsMips && !IsHexagon) {
if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
- (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
+ (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) || Distro.IsSailfish() ||
(IsAndroid && !Triple.isAndroidVersionLT(23)))
ExtraOpts.push_back("--hash-style=gnu");

if (Distro.IsDebian() || Distro.IsOpenSUSE() ||
Distro == Distro::UbuntuLucid || Distro == Distro::UbuntuJaunty ||
- Distro == Distro::UbuntuKarmic ||
+ Distro == Distro::UbuntuKarmic || Distro.IsSailfish() ||
if (Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||
- Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic ||
+ Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic || Distro.IsSailfish() ||
(IsAndroid && Triple.isAndroidVersionLT(23)))
ExtraOpts.push_back("--hash-style=both");
}
@@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
else
@@ -286,6 +286,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
ExtraOpts.push_back("--build-id");
#endif

- if (IsAndroid || Distro.IsOpenSUSE())
+ if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsSailfish())
ExtraOpts.push_back("--enable-new-dtags");

+ if (Distro.IsSailfish())
+ ExtraOpts.push_back("--enable-new-dtags");
+
// The selection of paths to try here is designed to match the patterns which
// the GCC driver itself uses, as this is part of the GCC-compatible driver.
// This was determined by running GCC in a fake filesystem, creating all
36 changes: 13 additions & 23 deletions rpm/0004-Make-funwind-tables-the-default-for-all-archs.patch
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Tue, 10 Dec 2019 09:18:03 +0000
Subject: [PATCH] Make -funwind-tables the default for all archs

---
clang/lib/Driver/ToolChain.cpp | 2 +-
clang/lib/Driver/ToolChains/Gnu.cpp | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index d657d21bfcdb..eac667382fa9 100644
index 388030592b48..264a849da435 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -258,7 +258,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {
}
@@ -424,7 +424,7 @@ std::string ToolChain::getInputFilename(const InputInfo &Input) const {

bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const {
- return false;
+ return true;
ToolChain::UnwindTableLevel
ToolChain::getDefaultUnwindTableLevel(const ArgList &Args) const {
- return UnwindTableLevel::None;
+ return UnwindTableLevel::Asynchronous;
}

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

bool Generic_GCC::IsUnwindTablesDefault(const ArgList &Args) const {
ToolChain::UnwindTableLevel
Generic_GCC::getDefaultUnwindTableLevel(const ArgList &Args) const {
+ if (getTriple().isMeeGo()) {
+ return true;
+ return UnwindTableLevel::Asynchronous;
+ }
switch (getArch()) {
case llvm::Triple::aarch64:
case llvm::Triple::ppc:
case llvm::Triple::aarch64_be:
22 changes: 0 additions & 22 deletions rpm/0005-Disable-out-of-line-atomics-on-MeeGo.patch

This file was deleted.

17 changes: 9 additions & 8 deletions rpm/clang.spec
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
%global maj_ver 15
%global min_ver 0
%global patch_ver 7
%global maj_ver 18
%global min_ver 1
%global patch_ver 8

%global clang_tools_binaries \
%{_bindir}/amdgpu-arch \
%{_bindir}/clang-apply-replacements \
%{_bindir}/clang-change-namespace \
%{_bindir}/clang-check \
%{_bindir}/clang-doc \
%{_bindir}/clang-extdef-mapping \
%{_bindir}/clang-format \
%{_bindir}/clang-include-cleaner \
%{_bindir}/clang-include-fixer \
%{_bindir}/clang-linker-wrapper \
%{_bindir}/clang-move \
%{_bindir}/clang-nvlink-wrapper \
%{_bindir}/clang-offload-bundler \
%{_bindir}/clang-offload-packager \
%{_bindir}/clang-offload-wrapper \
%{_bindir}/clang-pseudo \
%{_bindir}/clang-query \
%{_bindir}/clang-refactor \
Expand All @@ -27,6 +27,7 @@
%{_bindir}/clangd \
%{_bindir}/diagtool \
%{_bindir}/hmaptool \
%{_bindir}/nvptx-arch \
%{_bindir}/pp-trace \
%{_bindir}/run-clang-tidy

Expand All @@ -50,7 +51,6 @@ Patch1: 0001-LLVM-Add-MeeGo-vendor-type.patch
Patch2: 0002-Add-Triple-isMeeGo.patch
Patch3: 0003-Clang-SailfishOS-toolchain.patch
Patch4: 0004-Make-funwind-tables-the-default-for-all-archs.patch
Patch5: 0005-Disable-out-of-line-atomics-on-MeeGo.patch

BuildRequires: gcc
BuildRequires: gcc-c++
Expand Down Expand Up @@ -173,7 +173,8 @@ pushd build
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
-DCLANG_DEFAULT_UNWINDLIB=libgcc
-DCLANG_DEFAULT_UNWINDLIB=libgcc \
-DLLVM_INCLUDE_TESTS=OFF

%ninja_build
popd
Expand All @@ -188,7 +189,7 @@ pushd clang
mkdir -p %{buildroot}%{python3_sitelib}/clang/

# install scanbuild-py to python sitelib.
mv %{buildroot}%{_prefix}/lib/{libear,libscanbuild} %{buildroot}%{python3_sitelib}
mv %{buildroot}/%{_libdir}/{libear,libscanbuild} %{buildroot}%{python3_sitelib}

# remove editor integrations (bbedit, sublime, emacs, vim)
rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript
Expand Down
Loading