*add clang15
This commit is contained in:
parent
4dfef89dcb
commit
d7b496366a
133
clang15/PKGBUILD
Normal file
133
clang15/PKGBUILD
Normal file
@ -0,0 +1,133 @@
|
||||
# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
|
||||
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
|
||||
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
|
||||
|
||||
pkgname=clang15
|
||||
pkgver=15.0.7
|
||||
pkgrel=2
|
||||
pkgdesc="C language family frontend for LLVM 15"
|
||||
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
|
||||
url="https://clang.llvm.org/"
|
||||
license=('custom:Apache 2.0 with LLVM Exception')
|
||||
depends=('llvm15-libs' 'gcc' 'compiler-rt15')
|
||||
makedepends=('llvm15' 'cmake' 'ninja' 'python')
|
||||
optdepends=('openmp: OpenMP support in clang with -fopenmp'
|
||||
'llvm15: referenced by some clang headers')
|
||||
checkdepends=('llvm')
|
||||
_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver
|
||||
source=($_source_base/clang-$pkgver.src.tar.xz{,.sig}
|
||||
$_source_base/llvm-$pkgver.src.tar.xz{,.sig}
|
||||
$_source_base/cmake-$pkgver.src.tar.xz{,.sig}
|
||||
$pkgname-linker-wrapper-tool-r1.patch::https://github.com/llvm/llvm-project/commit/c2aabcfc8395.patch
|
||||
lit16.patch
|
||||
enable-fstack-protector-strong-by-default.patch
|
||||
clang-ppc64-elfv2.patch
|
||||
llvm-ppc64-elfv2.patch
|
||||
clang-ppc64-dynamic-linker-path.patch)
|
||||
sha256sums=('a6b673ef15377fb46062d164e8ddc4d05c348ff8968f015f7f4af03f51000067'
|
||||
'SKIP'
|
||||
'4ad8b2cc8003c86d0078d15d987d84e3a739f24aae9033865c027abae93ee7a4'
|
||||
'SKIP'
|
||||
'8986f29b634fdaa9862eedda78513969fe9788301c9f2d938f4c10a3e7a3e7ea'
|
||||
'SKIP'
|
||||
'75f220b68622a57b49a9480fe2ee321c7ff9b5ce643091b6cb510b9e38400e92'
|
||||
'8c8e1a01d3a46b20a78eccec29904edca46caa2c15fb4e8998423098b482e1a2'
|
||||
'7a9ce949579a3b02d4b91b6835c4fb45adc5f743007572fb0e28e6433e48f3a5'
|
||||
'7bcf1da7fa23b0d45bc6814284ec968d3481d24d05694ea39dd68c881bc8e4a5'
|
||||
'd3b3d13f05b17c62108345aa4ac555c656c3f8dbdb24551004b06ef652bef94d'
|
||||
'654b9eafcd20125319b3c319ab6674a940ddef400821c80813c16011ef8b6086')
|
||||
validpgpkeys=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar@redhat.com>
|
||||
|
||||
# Utilizing LLVM_DISTRIBUTION_COMPONENTS to avoid
|
||||
# installing static libraries; inspired by Gentoo
|
||||
_get_distribution_components() {
|
||||
local target
|
||||
ninja -t targets | grep -Po 'install-\K.*(?=-stripped:)' | while read -r target; do
|
||||
case $target in
|
||||
clang-libraries|distribution)
|
||||
continue
|
||||
;;
|
||||
# trim static analyzer and other bits
|
||||
bash-autocomplete|clang-format|clang-rename|hmaptool|scan-*)
|
||||
continue
|
||||
;;
|
||||
clang|clang-*)
|
||||
;;
|
||||
clang*|findAllSymbols)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
echo $target
|
||||
done
|
||||
}
|
||||
|
||||
prepare() {
|
||||
mv cmake{-$pkgver.src,}
|
||||
cd clang-$pkgver.src
|
||||
mkdir build
|
||||
patch -Np2 -i ../enable-fstack-protector-strong-by-default.patch
|
||||
|
||||
# https://reviews.llvm.org/D145862
|
||||
patch -Np2 -l -i ../$pkgname-linker-wrapper-tool-r1.patch
|
||||
|
||||
# Fix testing with lit from LLVM 16
|
||||
patch -Np2 -i ../lit16.patch
|
||||
|
||||
# powerpc64 uses ELFv2
|
||||
patch -Np2 -i ../clang-ppc64-elfv2.patch
|
||||
patch -Np2 -i ../clang-ppc64-dynamic-linker-path.patch
|
||||
patch -Np2 -d "$srcdir/llvm-$pkgver.src" -i ../llvm-ppc64-elfv2.patch
|
||||
|
||||
# Remove a couple of failing tests
|
||||
rm test/Driver/XRay/xray-instrument-{cpu,os}.c
|
||||
}
|
||||
|
||||
build() {
|
||||
cd clang-$pkgver.src/build
|
||||
|
||||
# Build only minimal debug info to reduce size
|
||||
CFLAGS=${CFLAGS/-g /-g1 }
|
||||
CXXFLAGS=${CXXFLAGS/-g /-g1 }
|
||||
|
||||
local cmake_args=(
|
||||
-G Ninja
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm15
|
||||
-DCMAKE_SKIP_RPATH=ON
|
||||
-DCLANG_DEFAULT_PIE_ON_LINUX=ON
|
||||
-DCLANG_LINK_CLANG_DYLIB=ON
|
||||
-DENABLE_LINKER_BUILD_ID=ON
|
||||
-DLLVM_BUILD_TESTS=ON
|
||||
-DLLVM_CONFIG=/usr/lib/llvm15/bin/llvm-config
|
||||
-DLLVM_ENABLE_RTTI=ON
|
||||
-DLLVM_EXTERNAL_LIT=/usr/bin/lit
|
||||
-DLLVM_LINK_LLVM_DYLIB=ON
|
||||
-DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
|
||||
)
|
||||
|
||||
cmake .. "${cmake_args[@]}"
|
||||
local distribution_components=$(_get_distribution_components | paste -sd\;)
|
||||
test -n "$distribution_components"
|
||||
cmake_args+=(-DLLVM_DISTRIBUTION_COMPONENTS="$distribution_components")
|
||||
|
||||
cmake .. "${cmake_args[@]}"
|
||||
ninja
|
||||
}
|
||||
|
||||
check() {
|
||||
cd clang-$pkgver.src/build
|
||||
LD_LIBRARY_PATH=$PWD/lib ninja check-clang
|
||||
}
|
||||
|
||||
package() {
|
||||
cd clang-$pkgver.src/build
|
||||
|
||||
DESTDIR="$pkgdir" ninja install-distribution
|
||||
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
|
||||
mv "$pkgdir"/usr/lib/{llvm15/lib/,}libclang-cpp.so.15
|
||||
ln -s ../../libclang-cpp.so.15 "$pkgdir/usr/lib/llvm15/lib/libclang-cpp.so.15"
|
||||
ln -s llvm15/lib/libclang.so.15 "$pkgdir"/usr/lib/libclang.so.15
|
||||
}
|
||||
|
||||
# vim:set ts=2 sw=2 et:
|
13
clang15/clang-ppc64-dynamic-linker-path.patch
Normal file
13
clang15/clang-ppc64-dynamic-linker-path.patch
Normal file
@ -0,0 +1,13 @@
|
||||
--- a/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
@@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
|
||||
Loader = "ld.so.1";
|
||||
break;
|
||||
case llvm::Triple::ppc64:
|
||||
- LibDir = "lib64";
|
||||
- Loader =
|
||||
- (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
|
||||
- break;
|
||||
case llvm::Triple::ppc64le:
|
||||
LibDir = "lib64";
|
||||
Loader =
|
48
clang15/clang-ppc64-elfv2.patch
Normal file
48
clang15/clang-ppc64-elfv2.patch
Normal file
@ -0,0 +1,48 @@
|
||||
--- a/clang/lib/Basic/Targets/PPC.h
|
||||
+++ b/clang/lib/Basic/Targets/PPC.h
|
||||
@@ -415,11 +415,10 @@ public:
|
||||
LongDoubleFormat = &llvm::APFloat::IEEEdouble();
|
||||
} else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
|
||||
DataLayout = "e-m:e-i64:64-n32:64";
|
||||
- ABI = "elfv2";
|
||||
} else {
|
||||
DataLayout = "E-m:e-i64:64-n32:64";
|
||||
- ABI = "elfv1";
|
||||
}
|
||||
+ ABI = "elfv2";
|
||||
|
||||
if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) {
|
||||
LongDoubleWidth = LongDoubleAlign = 64;
|
||||
--- a/clang/lib/CodeGen/TargetInfo.cpp
|
||||
+++ b/clang/lib/CodeGen/TargetInfo.cpp
|
||||
@@ -10927,9 +10927,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
|
||||
return SetCGInfo(new AIXTargetCodeGenInfo(Types, /*Is64Bit*/ true));
|
||||
|
||||
if (Triple.isOSBinFormatELF()) {
|
||||
- PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv1;
|
||||
- if (getTarget().getABI() == "elfv2")
|
||||
- Kind = PPC64_SVR4_ABIInfo::ELFv2;
|
||||
+ PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv2;
|
||||
+ if (getTarget().getABI() == "elfv1")
|
||||
+ Kind = PPC64_SVR4_ABIInfo::ELFv1;
|
||||
bool IsSoftFloat = CodeGenOpts.FloatABI == "soft";
|
||||
|
||||
return SetCGInfo(
|
||||
--- a/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
@@ -1920,14 +1920,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
|
||||
const llvm::Triple &T = getToolChain().getTriple();
|
||||
if (T.isOSBinFormatELF()) {
|
||||
switch (getToolChain().getArch()) {
|
||||
- case llvm::Triple::ppc64: {
|
||||
- if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
|
||||
- T.isOSOpenBSD() || T.isMusl())
|
||||
- ABIName = "elfv2";
|
||||
- else
|
||||
- ABIName = "elfv1";
|
||||
- break;
|
||||
- }
|
||||
+ case llvm::Triple::ppc64:
|
||||
case llvm::Triple::ppc64le:
|
||||
ABIName = "elfv2";
|
||||
break;
|
72
clang15/enable-fstack-protector-strong-by-default.patch
Normal file
72
clang15/enable-fstack-protector-strong-by-default.patch
Normal file
@ -0,0 +1,72 @@
|
||||
From 75c02a21f954574675020e1d76391b4896211fc7 Mon Sep 17 00:00:00 2001
|
||||
From: Evangelos Foutras <evangelos@foutrelis.com>
|
||||
Date: Sun, 24 Apr 2022 06:29:44 +0300
|
||||
Subject: [PATCH] Enable -fstack-protector-strong by default
|
||||
|
||||
---
|
||||
clang/lib/Driver/ToolChains/Linux.h | 5 +++++
|
||||
clang/test/Driver/fsanitize.c | 6 +++---
|
||||
clang/test/Driver/stack-protector.c | 4 ++--
|
||||
3 files changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h
|
||||
index a5648d79d655..3c4546cb9204 100644
|
||||
--- a/clang/lib/Driver/ToolChains/Linux.h
|
||||
+++ b/clang/lib/Driver/ToolChains/Linux.h
|
||||
@@ -10,6 +10,7 @@
|
||||
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_LINUX_H
|
||||
|
||||
#include "Gnu.h"
|
||||
+#include "clang/Basic/LangOptions.h"
|
||||
#include "clang/Driver/ToolChain.h"
|
||||
|
||||
namespace clang {
|
||||
@@ -46,6 +47,10 @@ public:
|
||||
IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const override;
|
||||
bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
|
||||
bool IsMathErrnoDefault() const override;
|
||||
+ LangOptions::StackProtectorMode
|
||||
+ GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
|
||||
+ return LangOptions::SSPStrong;
|
||||
+ }
|
||||
SanitizerMask getSupportedSanitizers() const override;
|
||||
void addProfileRTLibs(const llvm::opt::ArgList &Args,
|
||||
llvm::opt::ArgStringList &CmdArgs) const override;
|
||||
diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
|
||||
index 17fce1981eea..a732d29b7688 100644
|
||||
--- a/clang/test/Driver/fsanitize.c
|
||||
+++ b/clang/test/Driver/fsanitize.c
|
||||
@@ -666,12 +666,12 @@
|
||||
// RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP
|
||||
// NOSP-NOT: "-fsanitize=safe-stack"
|
||||
|
||||
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
|
||||
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
|
||||
// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN
|
||||
// RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
|
||||
// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
|
||||
-// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
|
||||
-// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
|
||||
+// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
|
||||
+// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
|
||||
// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
|
||||
// NO-SP-NOT: stack-protector
|
||||
// NO-SP: "-fsanitize=safe-stack"
|
||||
diff --git a/clang/test/Driver/stack-protector.c b/clang/test/Driver/stack-protector.c
|
||||
index a3e40b50eed8..dfffe0d6cf85 100644
|
||||
--- a/clang/test/Driver/stack-protector.c
|
||||
+++ b/clang/test/Driver/stack-protector.c
|
||||
@@ -3,11 +3,11 @@
|
||||
// NOSSP-NOT: "-stack-protector-buffer-size"
|
||||
|
||||
// RUN: %clang -target i386-unknown-linux -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP
|
||||
-// SSP: "-stack-protector" "1"
|
||||
+// SSP: "-stack-protector" "2"
|
||||
// SSP-NOT: "-stack-protector-buffer-size"
|
||||
|
||||
// RUN: %clang -target i386-unknown-linux -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF
|
||||
-// SSP-BUF: "-stack-protector" "1"
|
||||
+// SSP-BUF: "-stack-protector" "2"
|
||||
// SSP-BUF: "-stack-protector-buffer-size" "16"
|
||||
|
||||
// RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD
|
@ -0,0 +1,29 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBFrqgT0BEAC7xo0WH+eNrLlU5LrCk59KmImn1abFcmWNd8kYr5XfqmJKyVqo
|
||||
EY7A/yRjf+Yn1621EDkpKPjbql7q7MlZMpqKVdOWKWgmhvz08IOKJxaIABd/iIRT
|
||||
FwhIvB68YjtmzcoOJRi1wLnwuG55fJ9E69HyZ33jgAlRaWV3bE/YyszoTlZriUOE
|
||||
RbzC5WzX004cE9evlrr+YLt5Y6z7tntOdSXPLyGOFAO5LYMsHsEdi2JBYWrjlslG
|
||||
6iJr5iEt9v442PrJ79YYbu5QWe/6APRWtI3AtKBp7y250oon2lbj+bIVD7U9fOBB
|
||||
n/Frqx54UN22sJycET63hgYW4pIjIi5zq+FF15aU+ZqBdtNltoX4hEN7wlDpuNc0
|
||||
ezVu2Z8hdt8thpjiFUioTQ1t3RmsN6N548VwxmHdoYpAmiZqPIYBYvm85JB7S/3h
|
||||
RLuoeGxufBhXGCpnG8ghTOGtbbdanuLB/UROFXTdyZbTCBN5S6jvwkPSaHG7H35Z
|
||||
3fazMriTXwL1RGAbKITSWhDe5dXy/yOInWe8emJx+35vwQYCB2L4S8wRyQyRw6x4
|
||||
YoXCscW041DUMBX2CC7SjMCcmAC39UX1c3GbTpS3rkJR9cmXt50nviMnKpIwlIPd
|
||||
ZYhmxKifwTJ70+c4GVK2o0MG9bTYvpYhLnYxv6iJCfgmT40E+qkDSzSoZwARAQAB
|
||||
tCJUb20gU3RlbGxhcmQgPHRzdGVsbGFyQHJlZGhhdC5jb20+iQJWBBMBCABAAhsD
|
||||
BwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AWIQRHTiIxar9HhaiMbo6ix5SphkGd
|
||||
igUCYJMrXwUJCWsRIgAKCRCix5SphkGdir/GD/4zT43DAD9GU6VHGFeOphisH2kN
|
||||
IORVDEn8T+7iR7XLY9nVHJDxqQPUgB/gKYibrVYE0KVqjSSj3dr1cTorubMsDYgy
|
||||
gjjJSroOZupYC1+Yd8wb0jfdB6Z+CNKh0QN64BDS6D7P1GAcaIbxTyITjoz6jhyF
|
||||
Lkj4QCLiGWsMbapQA7MB4ij8t/AKORp1kW+tMyn6wfjfmYjrYOyE65UxmJtrV9Fv
|
||||
YllBt9oCAP0V9qphT6C6wxarJOuhIq9BoZOYKaUa5qRJfzNZagPG8ZalraP/MFfM
|
||||
g20hLuX5jN1jdzlHEgNt5WCYuI+uekOIUuT1PiFrmWwYXKWMAxnsVefpv8kmW8LR
|
||||
2TCG+ALvnYCRwr0Ykqh4KZcn4mpsV+QnwNAyVR6Bl6QTsPGtoHkU9Pg640mzkvgg
|
||||
w55X5kC3x4IxLskD1PFdFpW9LSRL5zz6jT5gL9Eb+zAuKpg/8w64MLnXaX69cR/p
|
||||
1rrNqZUfBOqf8fbrzy296ZSfeK4tV414iT8j76swQMAONGXoNKxO7E1cAgtxPUWW
|
||||
u3R4de3sZHGXTiEv70UNRv1TWjlVMK3Av7yDIGUnt+2wi3jilYjLWnAIgSQ46CDQ
|
||||
tUCdhdwmFcJLa3IJrs/UvHtlq6nU1sIo4wqJwfNBMHx0JZc+bKf41OgYL9ve11F5
|
||||
IKZNcvom0Pf7MkUKRQ==
|
||||
=Kuwb
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
214
clang15/lit16.patch
Normal file
214
clang15/lit16.patch
Normal file
@ -0,0 +1,214 @@
|
||||
From 28412d1800e391c5ba8e7607bb15c74b106d581b Mon Sep 17 00:00:00 2001
|
||||
From: "Joel E. Denny" <jdenny.ornl@gmail.com>
|
||||
Date: Wed, 21 Sep 2022 11:32:05 -0400
|
||||
Subject: [PATCH] [lit] Implement DEFINE and REDEFINE directives
|
||||
|
||||
These directives define per-test lit substitutions. The concept was
|
||||
discussed at
|
||||
<https://discourse.llvm.org/t/iterating-lit-run-lines/62596/10>.
|
||||
|
||||
For example, the following directives can be inserted into a test file
|
||||
to define `%{cflags}` and `%{fcflags}` substitutions with empty
|
||||
initial values, which serve as the parameters of another newly defined
|
||||
`%{check}` substitution:
|
||||
|
||||
```
|
||||
// DEFINE: %{cflags} =
|
||||
// DEFINE: %{fcflags} =
|
||||
|
||||
// DEFINE: %{check} = %clang_cc1 %{cflags} -emit-llvm -o - %s | \
|
||||
// DEFINE: FileCheck %{fcflags} %s
|
||||
```
|
||||
|
||||
The following directives then redefine the parameters before each use
|
||||
of `%{check}`:
|
||||
|
||||
```
|
||||
// REDEFINE: %{cflags} = -foo
|
||||
// REDEFINE: %{fcflags} = -check-prefix=FOO
|
||||
// RUN: %{check}
|
||||
|
||||
// REDEFINE: %{cflags} = -bar
|
||||
// REDEFINE: %{fcflags} = -check-prefix=BAR
|
||||
// RUN: %{check}
|
||||
```
|
||||
|
||||
Of course, `%{check}` would typically be more elaborate, increasing
|
||||
the benefit of the reuse.
|
||||
|
||||
One issue is that the strings `DEFINE:` and `REDEFINE:` already appear
|
||||
in 5 tests. This patch adjusts those tests not to use those strings.
|
||||
Our prediction is that, in the vast majority of cases, if a test
|
||||
author mistakenly uses one of those strings for another purpose, the
|
||||
text appearing after the string will not happen to have the syntax
|
||||
required for these directives. Thus, the test author will discover
|
||||
the mistake immediately when lit reports the syntax error.
|
||||
|
||||
This patch also expands the documentation on existing lit substitution
|
||||
behavior.
|
||||
|
||||
Reviewed By: jhenderson, MaskRay, awarzynski
|
||||
|
||||
Differential Revision: https://reviews.llvm.org/D132513
|
||||
---
|
||||
clang/test/CodeGen/attr-noundef.cpp | 60 ++++++++++++-------------
|
||||
clang/test/CodeGen/indirect-noundef.cpp | 4 +-
|
||||
clang/test/Preprocessor/init.c | 12 ++---
|
||||
3 files changed, 38 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/clang/test/CodeGen/attr-noundef.cpp b/clang/test/CodeGen/attr-noundef.cpp
|
||||
index f0570a5390a2..ab167281817e 100644
|
||||
--- a/clang/test/CodeGen/attr-noundef.cpp
|
||||
+++ b/clang/test/CodeGen/attr-noundef.cpp
|
||||
@@ -15,10 +15,10 @@ struct Trivial {
|
||||
};
|
||||
Trivial ret_trivial() { return {}; }
|
||||
void pass_trivial(Trivial e) {}
|
||||
-// CHECK-INTEL: [[DEFINE:define( dso_local)?]] i32 @{{.*}}ret_trivial
|
||||
-// CHECK-AARCH: [[DEFINE:define( dso_local)?]] i32 @{{.*}}ret_trivial
|
||||
-// CHECK-INTEL: [[DEFINE]] void @{{.*}}pass_trivial{{.*}}(i32 %
|
||||
-// CHECK-AARCH: [[DEFINE]] void @{{.*}}pass_trivial{{.*}}(i64 %
|
||||
+// CHECK-INTEL: [[DEF:define( dso_local)?]] i32 @{{.*}}ret_trivial
|
||||
+// CHECK-AARCH: [[DEF:define( dso_local)?]] i32 @{{.*}}ret_trivial
|
||||
+// CHECK-INTEL: [[DEF]] void @{{.*}}pass_trivial{{.*}}(i32 %
|
||||
+// CHECK-AARCH: [[DEF]] void @{{.*}}pass_trivial{{.*}}(i64 %
|
||||
|
||||
struct NoCopy {
|
||||
int a;
|
||||
@@ -26,16 +26,16 @@ struct NoCopy {
|
||||
};
|
||||
NoCopy ret_nocopy() { return {}; }
|
||||
void pass_nocopy(NoCopy e) {}
|
||||
-// CHECK: [[DEFINE]] void @{{.*}}ret_nocopy{{.*}}(%"struct.check_structs::NoCopy"* noalias sret({{[^)]+}}) align 4 %
|
||||
-// CHECK: [[DEFINE]] void @{{.*}}pass_nocopy{{.*}}(%"struct.check_structs::NoCopy"* noundef %
|
||||
+// CHECK: [[DEF]] void @{{.*}}ret_nocopy{{.*}}(%"struct.check_structs::NoCopy"* noalias sret({{[^)]+}}) align 4 %
|
||||
+// CHECK: [[DEF]] void @{{.*}}pass_nocopy{{.*}}(%"struct.check_structs::NoCopy"* noundef %
|
||||
|
||||
struct Huge {
|
||||
int a[1024];
|
||||
};
|
||||
Huge ret_huge() { return {}; }
|
||||
void pass_huge(Huge h) {}
|
||||
-// CHECK: [[DEFINE]] void @{{.*}}ret_huge{{.*}}(%"struct.check_structs::Huge"* noalias sret({{[^)]+}}) align 4 %
|
||||
-// CHECK: [[DEFINE]] void @{{.*}}pass_huge{{.*}}(%"struct.check_structs::Huge"* noundef
|
||||
+// CHECK: [[DEF]] void @{{.*}}ret_huge{{.*}}(%"struct.check_structs::Huge"* noalias sret({{[^)]+}}) align 4 %
|
||||
+// CHECK: [[DEF]] void @{{.*}}pass_huge{{.*}}(%"struct.check_structs::Huge"* noundef
|
||||
} // namespace check_structs
|
||||
|
||||
//************ Passing unions by value
|
||||
@@ -47,10 +47,10 @@ union Trivial {
|
||||
};
|
||||
Trivial ret_trivial() { return {}; }
|
||||
void pass_trivial(Trivial e) {}
|
||||
-// CHECK-INTEL: [[DEFINE]] i32 @{{.*}}ret_trivial
|
||||
-// CHECK-AARCH: [[DEFINE]] i32 @{{.*}}ret_trivial
|
||||
-// CHECK-INTEL: [[DEFINE]] void @{{.*}}pass_trivial{{.*}}(i32 %
|
||||
-// CHECK-AARCH: [[DEFINE]] void @{{.*}}pass_trivial{{.*}}(i64 %
|
||||
+// CHECK-INTEL: [[DEF]] i32 @{{.*}}ret_trivial
|
||||
+// CHECK-AARCH: [[DEF]] i32 @{{.*}}ret_trivial
|
||||
+// CHECK-INTEL: [[DEF]] void @{{.*}}pass_trivial{{.*}}(i32 %
|
||||
+// CHECK-AARCH: [[DEF]] void @{{.*}}pass_trivial{{.*}}(i64 %
|
||||
|
||||
union NoCopy {
|
||||
int a;
|
||||
@@ -58,8 +58,8 @@ union NoCopy {
|
||||
};
|
||||
NoCopy ret_nocopy() { return {}; }
|
||||
void pass_nocopy(NoCopy e) {}
|
||||
-// CHECK: [[DEFINE]] void @{{.*}}ret_nocopy{{.*}}(%"union.check_unions::NoCopy"* noalias sret({{[^)]+}}) align 4 %
|
||||
-// CHECK: [[DEFINE]] void @{{.*}}pass_nocopy{{.*}}(%"union.check_unions::NoCopy"* noundef %
|
||||
+// CHECK: [[DEF]] void @{{.*}}ret_nocopy{{.*}}(%"union.check_unions::NoCopy"* noalias sret({{[^)]+}}) align 4 %
|
||||
+// CHECK: [[DEF]] void @{{.*}}pass_nocopy{{.*}}(%"union.check_unions::NoCopy"* noundef %
|
||||
} // namespace check_unions
|
||||
|
||||
//************ Passing `this` pointers
|
||||
@@ -100,9 +100,9 @@ i32x3 ret_vec() {
|
||||
void pass_vec(i32x3 v) {
|
||||
}
|
||||
|
||||
-// CHECK: [[DEFINE]] noundef <3 x i32> @{{.*}}ret_vec{{.*}}()
|
||||
-// CHECK-INTEL: [[DEFINE]] void @{{.*}}pass_vec{{.*}}(<3 x i32> noundef %
|
||||
-// CHECK-AARCH: [[DEFINE]] void @{{.*}}pass_vec{{.*}}(<4 x i32> %
|
||||
+// CHECK: [[DEF]] noundef <3 x i32> @{{.*}}ret_vec{{.*}}()
|
||||
+// CHECK-INTEL: [[DEF]] void @{{.*}}pass_vec{{.*}}(<3 x i32> noundef %
|
||||
+// CHECK-AARCH: [[DEF]] void @{{.*}}pass_vec{{.*}}(<4 x i32> %
|
||||
} // namespace check_vecs
|
||||
|
||||
//************ Passing exotic types
|
||||
@@ -145,23 +145,23 @@ void pass_large_BitInt(_BitInt(127) e) {
|
||||
}
|
||||
|
||||
// Pointers to arrays/functions are always noundef
|
||||
-// CHECK: [[DEFINE]] noundef [32 x i32]* @{{.*}}ret_arrptr{{.*}}()
|
||||
-// CHECK: [[DEFINE]] noundef i32 (i32)* @{{.*}}ret_fnptr{{.*}}()
|
||||
+// CHECK: [[DEF]] noundef [32 x i32]* @{{.*}}ret_arrptr{{.*}}()
|
||||
+// CHECK: [[DEF]] noundef i32 (i32)* @{{.*}}ret_fnptr{{.*}}()
|
||||
|
||||
// Pointers to members are never noundef
|
||||
-// CHECK: [[DEFINE]] i64 @{{.*}}ret_mdptr{{.*}}()
|
||||
-// CHECK-INTEL: [[DEFINE]] { i64, i64 } @{{.*}}ret_mfptr{{.*}}()
|
||||
-// CHECK-AARCH: [[DEFINE]] [2 x i64] @{{.*}}ret_mfptr{{.*}}()
|
||||
+// CHECK: [[DEF]] i64 @{{.*}}ret_mdptr{{.*}}()
|
||||
+// CHECK-INTEL: [[DEF]] { i64, i64 } @{{.*}}ret_mfptr{{.*}}()
|
||||
+// CHECK-AARCH: [[DEF]] [2 x i64] @{{.*}}ret_mfptr{{.*}}()
|
||||
|
||||
// nullptr_t is never noundef
|
||||
-// CHECK: [[DEFINE]] i8* @{{.*}}ret_npt{{.*}}()
|
||||
-// CHECK: [[DEFINE]] void @{{.*}}pass_npt{{.*}}(i8* %
|
||||
+// CHECK: [[DEF]] i8* @{{.*}}ret_npt{{.*}}()
|
||||
+// CHECK: [[DEF]] void @{{.*}}pass_npt{{.*}}(i8* %
|
||||
|
||||
// TODO: for now, ExtInt is only noundef if it is sign/zero-extended
|
||||
-// CHECK-INTEL: [[DEFINE]] noundef signext i3 @{{.*}}ret_BitInt{{.*}}()
|
||||
-// CHECK-AARCH: [[DEFINE]] i3 @{{.*}}ret_BitInt{{.*}}()
|
||||
-// CHECK-INTEL: [[DEFINE]] void @{{.*}}pass_BitInt{{.*}}(i3 noundef signext %
|
||||
-// CHECK-AARCH: [[DEFINE]] void @{{.*}}pass_BitInt{{.*}}(i3 %
|
||||
-// CHECK-INTEL: [[DEFINE]] void @{{.*}}pass_large_BitInt{{.*}}(i64 %{{.*}}, i64 %
|
||||
-// CHECK-AARCH: [[DEFINE]] void @{{.*}}pass_large_BitInt{{.*}}(i127 %
|
||||
+// CHECK-INTEL: [[DEF]] noundef signext i3 @{{.*}}ret_BitInt{{.*}}()
|
||||
+// CHECK-AARCH: [[DEF]] i3 @{{.*}}ret_BitInt{{.*}}()
|
||||
+// CHECK-INTEL: [[DEF]] void @{{.*}}pass_BitInt{{.*}}(i3 noundef signext %
|
||||
+// CHECK-AARCH: [[DEF]] void @{{.*}}pass_BitInt{{.*}}(i3 %
|
||||
+// CHECK-INTEL: [[DEF]] void @{{.*}}pass_large_BitInt{{.*}}(i64 %{{.*}}, i64 %
|
||||
+// CHECK-AARCH: [[DEF]] void @{{.*}}pass_large_BitInt{{.*}}(i127 %
|
||||
} // namespace check_exotic
|
||||
diff --git a/clang/test/CodeGen/indirect-noundef.cpp b/clang/test/CodeGen/indirect-noundef.cpp
|
||||
index 0f63daac044c..1d82aa60ad1e 100644
|
||||
--- a/clang/test/CodeGen/indirect-noundef.cpp
|
||||
+++ b/clang/test/CodeGen/indirect-noundef.cpp
|
||||
@@ -13,9 +13,9 @@ int (*indirect_callee_int_ptr)(int);
|
||||
// CHECK: @indirect_callee_union_ptr = [[GLOBAL]] i32 (i32)*
|
||||
union u1 (*indirect_callee_union_ptr)(union u1);
|
||||
|
||||
-// CHECK: [[DEFINE:define( dso_local)?]] noundef i32 @{{.*}}indirect_callee_int{{.*}}(i32 noundef %
|
||||
+// CHECK: [[DEF:define( dso_local)?]] noundef i32 @{{.*}}indirect_callee_int{{.*}}(i32 noundef %
|
||||
int indirect_callee_int(int a) { return a; }
|
||||
-// CHECK: [[DEFINE]] i32 @{{.*}}indirect_callee_union{{.*}}(i32 %
|
||||
+// CHECK: [[DEF]] i32 @{{.*}}indirect_callee_union{{.*}}(i32 %
|
||||
union u1 indirect_callee_union(union u1 a) {
|
||||
return a;
|
||||
}
|
||||
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
|
||||
index 028f3448f8bd..8e3c87e7675f 100644
|
||||
--- a/clang/test/Preprocessor/init.c
|
||||
+++ b/clang/test/Preprocessor/init.c
|
||||
@@ -1396,13 +1396,13 @@
|
||||
// SPARC64-OBSD:#define __UINTMAX_C_SUFFIX__ ULL
|
||||
// SPARC64-OBSD:#define __UINTMAX_TYPE__ long long unsigned int
|
||||
//
|
||||
-// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-pc-kfreebsd-gnu < /dev/null | FileCheck -match-full-lines -check-prefix KFREEBSD-DEFINE %s
|
||||
-// KFREEBSD-DEFINE:#define __FreeBSD_kernel__ 1
|
||||
-// KFREEBSD-DEFINE:#define __GLIBC__ 1
|
||||
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-pc-kfreebsd-gnu < /dev/null | FileCheck -match-full-lines -check-prefix KFREEBSD-DEF %s
|
||||
+// KFREEBSD-DEF:#define __FreeBSD_kernel__ 1
|
||||
+// KFREEBSD-DEF:#define __GLIBC__ 1
|
||||
//
|
||||
-// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i686-pc-kfreebsd-gnu < /dev/null | FileCheck -match-full-lines -check-prefix KFREEBSDI686-DEFINE %s
|
||||
-// KFREEBSDI686-DEFINE:#define __FreeBSD_kernel__ 1
|
||||
-// KFREEBSDI686-DEFINE:#define __GLIBC__ 1
|
||||
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i686-pc-kfreebsd-gnu < /dev/null | FileCheck -match-full-lines -check-prefix KFREEBSDI686-DEF %s
|
||||
+// KFREEBSDI686-DEF:#define __FreeBSD_kernel__ 1
|
||||
+// KFREEBSDI686-DEF:#define __GLIBC__ 1
|
||||
//
|
||||
// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-runtime=gcc -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix GNUSOURCE %s
|
||||
// RUN: %clang_cc1 -x c++ -triple sparc-rtems-elf -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix GNUSOURCE %s
|
30
clang15/llvm-ppc64-elfv2.patch
Normal file
30
clang15/llvm-ppc64-elfv2.patch
Normal file
@ -0,0 +1,30 @@
|
||||
This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
|
||||
need this because unlike most distros we use ELFv2 for both glibc and musl
|
||||
on big endian ppc64.
|
||||
|
||||
diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
index 0634833e..b7cbc2e7 100644
|
||||
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
|
||||
@@ -222,9 +222,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
|
||||
|
||||
switch (TT.getArch()) {
|
||||
case Triple::ppc64le:
|
||||
- return PPCTargetMachine::PPC_ABI_ELFv2;
|
||||
case Triple::ppc64:
|
||||
- return PPCTargetMachine::PPC_ABI_ELFv1;
|
||||
+ return PPCTargetMachine::PPC_ABI_ELFv2;
|
||||
default:
|
||||
return PPCTargetMachine::PPC_ABI_UNKNOWN;
|
||||
}
|
||||
diff --git a/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
index 8b1cf6b5..296a2afa 100644
|
||||
--- a/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
+++ b/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll
|
||||
@@ -1,4 +1,5 @@
|
||||
-; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
|
||||
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
|
||||
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
|
||||
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
|
||||
; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
|
||||
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
|
Loading…
x
Reference in New Issue
Block a user