[arch-commits] Commit in lib32-clang/repos (5 files)
Evangelos Foutras
foutrelis at archlinux.org
Thu May 27 04:32:48 UTC 2021
Date: Thursday, May 27, 2021 @ 04:32:48
Author: foutrelis
Revision: 948007
archrelease: copy trunk to multilib-staging-x86_64
Added:
lib32-clang/repos/multilib-staging-x86_64/
lib32-clang/repos/multilib-staging-x86_64/PKGBUILD
(from rev 948006, lib32-clang/trunk/PKGBUILD)
lib32-clang/repos/multilib-staging-x86_64/clang-link-with-Bsymbolic-functions.patch
(from rev 948006, lib32-clang/trunk/clang-link-with-Bsymbolic-functions.patch)
lib32-clang/repos/multilib-staging-x86_64/enable-SSP-and-PIE-by-default.patch
(from rev 948006, lib32-clang/trunk/enable-SSP-and-PIE-by-default.patch)
lib32-clang/repos/multilib-staging-x86_64/opencl-respect-calling-convention-for-builtin.patch
(from rev 948006, lib32-clang/trunk/opencl-respect-calling-convention-for-builtin.patch)
-----------------------------------------------------+
PKGBUILD | 102 +++++
clang-link-with-Bsymbolic-functions.patch | 63 +++
enable-SSP-and-PIE-by-default.patch | 364 ++++++++++++++++++
opencl-respect-calling-convention-for-builtin.patch | 107 +++++
4 files changed, 636 insertions(+)
Copied: lib32-clang/repos/multilib-staging-x86_64/PKGBUILD (from rev 948006, lib32-clang/trunk/PKGBUILD)
===================================================================
--- multilib-staging-x86_64/PKGBUILD (rev 0)
+++ multilib-staging-x86_64/PKGBUILD 2021-05-27 04:32:48 UTC (rev 948007)
@@ -0,0 +1,102 @@
+# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
+# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
+
+pkgname=lib32-clang
+pkgver=12.0.0
+pkgrel=1
+pkgdesc="C language family frontend for LLVM (32-bit)"
+arch=('x86_64')
+url="https://clang.llvm.org/"
+license=('custom:Apache 2.0 with LLVM Exception')
+depends=('lib32-llvm-libs' 'gcc-multilib')
+makedepends=('lib32-llvm' 'cmake' 'ninja' 'python')
+_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}
+ opencl-respect-calling-convention-for-builtin.patch
+ clang-link-with-Bsymbolic-functions.patch
+ enable-SSP-and-PIE-by-default.patch)
+sha256sums=('e26e452e91d4542da3ebbf404f024d3e1cbf103f4cd110c26bf0a19621cca9ed'
+ 'SKIP'
+ '49dc47c8697a1a0abd4ee51629a696d7bfe803662f2a7252a3b16fc75f3a8b50'
+ 'SKIP'
+ '859d34dac43999edfc4c33e1cbb6e7458921fa9f16a93514701c1a9706665d24'
+ '5bc0b47c70990bb8dd0cf4138a8ab9e15cf6b008b7c0cf2c7aac3736b559e0e6'
+ 'a877fa5cf1c1cca3bd55f9a36cf8c1bdd061ff398aeace90fe3cbd9e82550da3')
+validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans at chromium.org>
+validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar at 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
+ ;;
+ clang-tidy-headers)
+ continue
+ ;;
+ clang|clangd|clang-*)
+ ;;
+ clang*|findAllSymbols)
+ continue
+ ;;
+ esac
+ echo $target
+ done
+}
+
+prepare() {
+ cd "$srcdir/clang-$pkgver.src"
+ mkdir build
+ patch -Np2 -i ../enable-SSP-and-PIE-by-default.patch
+
+ # Some fixes from the release/12.x branch
+ patch -Np2 -i ../opencl-respect-calling-convention-for-builtin.patch
+
+ # https://bugs.archlinux.org/task/70697
+ patch -Np2 -i ../clang-link-with-Bsymbolic-functions.patch
+}
+
+build() {
+ cd "$srcdir/clang-$pkgver.src/build"
+
+ export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
+
+ local cmake_args=(
+ -G Ninja
+ -DCMAKE_BUILD_TYPE=Release
+ -DCMAKE_INSTALL_PREFIX=/usr
+ -DLLVM_LIBDIR_SUFFIX=32
+ -DCMAKE_C_FLAGS:STRING=-m32
+ -DCMAKE_CXX_FLAGS:STRING=-m32
+ -DLLVM_CONFIG="/usr/bin/llvm-config32"
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DCLANG_LINK_CLANG_DYLIB=ON
+ -DLLVM_ENABLE_RTTI=ON
+ -DLLVM_BUILD_TESTS=OFF
+ -DLLVM_INCLUDE_DOCS=OFF
+ -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
+}
+
+package() {
+ cd "$srcdir/clang-$pkgver.src/build"
+
+ DESTDIR="$pkgdir" ninja install-distribution
+ rm -rf "$pkgdir"/usr/{bin,include,libexec,share}
+
+ install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
+
+# vim:set ts=2 sw=2 et:
Copied: lib32-clang/repos/multilib-staging-x86_64/clang-link-with-Bsymbolic-functions.patch (from rev 948006, lib32-clang/trunk/clang-link-with-Bsymbolic-functions.patch)
===================================================================
--- multilib-staging-x86_64/clang-link-with-Bsymbolic-functions.patch (rev 0)
+++ multilib-staging-x86_64/clang-link-with-Bsymbolic-functions.patch 2021-05-27 04:32:48 UTC (rev 948007)
@@ -0,0 +1,63 @@
+From 4f05f4c8e66bc76b1d94f5283494404382e3bacd Mon Sep 17 00:00:00 2001
+From: Fangrui Song <i at maskray.me>
+Date: Thu, 13 May 2021 13:44:57 -0700
+Subject: [PATCH] [CMake][ELF] Link libLLVM.so and libclang-cpp.so with
+ -Bsymbolic-functions
+
+llvm-dev message: https://lists.llvm.org/pipermail/llvm-dev/2021-May/150465.html
+
+In an ELF shared object, a default visibility defined symbol is preemptible by
+default. This creates some missed optimization opportunities.
+-Bsymbolic-functions is more aggressive than our current -fvisibility-inlines-hidden
+(present since 2012) as it applies to all function definitions. It can
+
+* avoid PLT for cross-TU function calls && reduce dynamic symbol lookup
+* reduce dynamic symbol lookup for taking function addresses and optimize out GOT/TOC on x86-64/ppc64
+
+In a -DLLVM_TARGETS_TO_BUILD=X86 build, the number of JUMP_SLOT decreases from 12716 to 1628, and the number of GLOB_DAT decreases from 1918 to 1313
+The built clang with `-DLLVM_LINK_LLVM_DYLIB=on -DCLANG_LINK_CLANG_DYLIB=on` is significantly faster.
+See the Linux kernel build result https://bugs.archlinux.org/task/70697
+
+Note: the performance of -fno-semantic-interposition -Bsymbolic-functions
+libLLVM.so and libclang-cpp.so is close to a PIE binary linking against
+`libLLVM*.a` and `libclang*.a`. When the host compiler is Clang,
+-Bsymbolic-functions is the major contributor. On x86-64 (with GOTPCRELX) and
+ppc64 ELFv2, the GOT/TOC relocations can be optimized.
+
+Some implication:
+
+Interposing a subset of functions is no longer supported.
+(This is fragile on ELF and unsupported on Mach-O at all. For Mach-O we don't
+use `ld -interpose` or `-flat_namespace`)
+
+Compiling a program which takes the address of any LLVM function with
+`{gcc,clang} -fno-pic` and expects the address to equal to the address taken
+from libLLVM.so or libclang-cpp.so is unsupported. I am fairly confident that
+llvm-project shouldn't have different behaviors depending on such pointer
+equality (as we've been using -fvisibility-inlines-hidden which applies to
+inline functions for a long time), but if we accidentally do, users should be
+aware that they should not make assumption on pointer equality in `-fno-pic`
+mode.
+
+See more on https://maskray.me/blog/2021-05-09-fno-semantic-interposition
+
+Reviewed By: phosek
+
+Differential Revision: https://reviews.llvm.org/D102090
+---
+ clang/tools/clang-shlib/CMakeLists.txt | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt
+index 5949223fc8e3..d08cf8938328 100644
+--- a/clang/tools/clang-shlib/CMakeLists.txt
++++ b/clang/tools/clang-shlib/CMakeLists.txt
+@@ -48,3 +48,8 @@ add_clang_library(clang-cpp
+ ${_OBJECTS}
+ LINK_LIBS
+ ${_DEPS})
++# Optimize function calls for default visibility definitions to avoid PLT and
++# reduce dynamic relocations.
++if (NOT APPLE)
++ target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
++endif()
Copied: lib32-clang/repos/multilib-staging-x86_64/enable-SSP-and-PIE-by-default.patch (from rev 948006, lib32-clang/trunk/enable-SSP-and-PIE-by-default.patch)
===================================================================
--- multilib-staging-x86_64/enable-SSP-and-PIE-by-default.patch (rev 0)
+++ multilib-staging-x86_64/enable-SSP-and-PIE-by-default.patch 2021-05-27 04:32:48 UTC (rev 948007)
@@ -0,0 +1,364 @@
+From 6878f5376dec0a3d75674d5a2076d4af911f7c7c Mon Sep 17 00:00:00 2001
+From: Evangelos Foutras <evangelos at foutrelis.com>
+Date: Wed, 12 May 2021 08:55:14 +0300
+Subject: [PATCH] Enable SSP and PIE by default
+
+This is a minimal set of changes needed to make clang use SSP and PIE by
+default on Arch Linux. Tests that were easy to adjust have been changed
+accordingly; only test/Driver/linux-ld.c has been marked as "expected
+failure" due to the number of changes it would require (mostly replacing
+crtbegin.o with crtbeginS.o).
+
+Doing so is needed in order to align clang with the new default GCC
+behavior in Arch which generates PIE executables by default and also
+defaults to -fstack-protector-strong. It is not meant to be a long term
+solution, but a simple temporary fix.
+
+Hopefully these changes will be obsoleted by the introduction upstream
+of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410)
+---
+ clang/lib/Driver/ToolChains/Linux.cpp | 10 ++++++++--
+ clang/lib/Driver/ToolChains/Linux.h | 5 +++++
+ clang/test/Driver/cross-linux.c | 16 ++++++++--------
+ clang/test/Driver/env.c | 2 +-
+ clang/test/Driver/fsanitize.c | 14 +++++++-------
+ clang/test/Driver/gcc-toolchain.cpp | 2 +-
+ clang/test/Driver/hexagon-toolchain-elf.c | 2 +-
+ clang/test/Driver/hip-fpie-option.hip | 4 ++--
+ clang/test/Driver/linux-as.c | 4 ++--
+ clang/test/Driver/linux-ld.c | 2 ++
+ clang/test/Driver/ppc-abi.c | 18 +++++++++++-------
+ clang/test/Driver/riscv32-toolchain.c | 4 ++--
+ clang/test/Driver/riscv64-toolchain.c | 4 ++--
+ clang/test/Driver/stack-protector.c | 4 ++--
+ 14 files changed, 54 insertions(+), 37 deletions(-)
+
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index 9663a7390ada..2f8d01092557 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -832,8 +832,14 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
+ }
+
+ bool Linux::isPIEDefault() const {
+- return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
+- getTriple().isMusl() || getSanitizerArgs().requiresPIE();
++ const bool IsMips = getTriple().isMIPS();
++ const bool IsAndroid = getTriple().isAndroid();
++
++ if (IsMips || IsAndroid)
++ return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
++ getTriple().isMusl() || getSanitizerArgs().requiresPIE();
++
++ return true;
+ }
+
+ bool Linux::isNoExecStackDefault() const {
+diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h
+index 6b16b0e64990..04c4d176ca71 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 {
+@@ -39,6 +40,10 @@ public:
+ bool isPIEDefault() const override;
+ bool isNoExecStackDefault() 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/cross-linux.c b/clang/test/Driver/cross-linux.c
+index 6c2dab260695..c28c5653e348 100644
+--- a/clang/test/Driver/cross-linux.c
++++ b/clang/test/Driver/cross-linux.c
+@@ -42,8 +42,8 @@
+ // CHECK-MULTI32-I386: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
+ // CHECK-MULTI32-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
+ // CHECK-MULTI32-I386: "-m" "elf_i386"
+-// CHECK-MULTI32-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o"
+-// CHECK-MULTI32-I386: "-L[[gcc_install]]"
++// CHECK-MULTI32-I386: "crti.o" "crtbeginS.o"
++// CHECK-MULTI32-I386: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]"
+ // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib32"
+ // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
+ // CHECK-MULTI32-I386: "-L[[sysroot]]/lib"
+@@ -60,8 +60,8 @@
+ // CHECK-MULTI32-X86-64: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
+ // CHECK-MULTI32-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
+ // CHECK-MULTI32-X86-64: "-m" "elf_x86_64"
+-// CHECK-MULTI32-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64{{/|\\\\}}crtbegin.o"
+-// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/64"
++// CHECK-MULTI32-X86-64: "crti.o" "crtbeginS.o"
++// CHECK-MULTI32-X86-64: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64"
+ // CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib64"
+ // CHECK-MULTI32-X86-64: "-L[[gcc_install]]"
+ // CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
+@@ -79,8 +79,8 @@
+ // CHECK-MULTI64-I386: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
+ // CHECK-MULTI64-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
+ // CHECK-MULTI64-I386: "-m" "elf_i386"
+-// CHECK-MULTI64-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32{{/|\\\\}}crtbegin.o"
+-// CHECK-MULTI64-I386: "-L[[gcc_install]]/32"
++// CHECK-MULTI64-I386: "crti.o" "crtbeginS.o"
++// CHECK-MULTI64-I386: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32"
+ // CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib32"
+ // CHECK-MULTI64-I386: "-L[[gcc_install]]"
+ // CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
+@@ -98,8 +98,8 @@
+ // CHECK-MULTI64-X86-64: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
+ // CHECK-MULTI64-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
+ // CHECK-MULTI64-X86-64: "-m" "elf_x86_64"
+-// CHECK-MULTI64-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o"
+-// CHECK-MULTI64-X86-64: "-L[[gcc_install]]"
++// CHECK-MULTI64-X86-64: "crti.o" "crtbeginS.o"
++// CHECK-MULTI64-X86-64: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]"
+ // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib64"
+ // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
+ // CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib"
+diff --git a/clang/test/Driver/env.c b/clang/test/Driver/env.c
+index 0371bc91c4a3..ea89f5251217 100644
+--- a/clang/test/Driver/env.c
++++ b/clang/test/Driver/env.c
+@@ -20,7 +20,7 @@
+ //
+ // CHECK-LD-32-NOT: warning:
+ // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+-// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
++// CHECK-LD-32: "crtbeginS.o"
+ // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
+ // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
+ // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
+diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
+index 8926d55a0cf4..40f628ccae45 100644
+--- a/clang/test/Driver/fsanitize.c
++++ b/clang/test/Driver/fsanitize.c
+@@ -330,15 +330,15 @@
+ // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1
+ // OK
+
+-// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE
+-// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE
++// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
++// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
+ // RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
+ // RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
+ // RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIC-NO-PIE
+ // RUN: %clang -target arm-linux-androideabi24 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
+ // RUN: %clang -target aarch64-linux-android -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
+-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE
+-// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE
++// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
++// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
+
+ // CHECK-NO-PIE-NOT: "-pie"
+ // CHECK-NO-PIE: "-mrelocation-model" "static"
+@@ -667,12 +667,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/gcc-toolchain.cpp b/clang/test/Driver/gcc-toolchain.cpp
+index 6c872f4255c3..f5006d1dd9ab 100644
+--- a/clang/test/Driver/gcc-toolchain.cpp
++++ b/clang/test/Driver/gcc-toolchain.cpp
+@@ -26,6 +26,6 @@
+ // the same precise formatting of the path as the '-internal-system' flags
+ // above, so we just blanket wildcard match the 'crtbegin.o'.
+ // CHECK: "{{[^"]*}}ld{{(.exe)?}}"
+-// CHECK: "{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
++// CHECK: "crtbeginS.o"
+ // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
+ // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
+diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c
+index cc11f9fcba9e..1fe8b5db587b 100644
+--- a/clang/test/Driver/hexagon-toolchain-elf.c
++++ b/clang/test/Driver/hexagon-toolchain-elf.c
+@@ -487,7 +487,7 @@
+ // RUN: %s 2>&1 \
+ // RUN: | FileCheck -check-prefix=CHECK042 %s
+ // CHECK042: "-cc1"
+-// CHECK042: "-mrelocation-model" "static"
++// CHECK042: "-mrelocation-model" "pic"
+ // CHECK042: "-mllvm" "-hexagon-small-data-threshold=8"
+ // CHECK042-NEXT: llvm-mc
+ // CHECK042: "-gpsize=8"
+diff --git a/clang/test/Driver/hip-fpie-option.hip b/clang/test/Driver/hip-fpie-option.hip
+index 2e296a099dea..86915f1c8c25 100644
+--- a/clang/test/Driver/hip-fpie-option.hip
++++ b/clang/test/Driver/hip-fpie-option.hip
+@@ -5,11 +5,11 @@
+
+ // RUN: %clang -### -target x86_64-unknown-linux-gnu \
+ // RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \
+-// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-STATIC %s
++// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
+
+ // RUN: %clang -### -target x86_64-unknown-linux-gnu \
+ // RUN: -fgpu-rdc --offload-arch=gfx906 %s -nogpulib -nogpuinc \
+-// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-STATIC %s
++// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
+
+ // RUN: %clang -### -target x86_64-unknown-linux-gnu \
+ // RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \
+diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c
+index 0959bd7ba0a1..4056a672b6f9 100644
+--- a/clang/test/Driver/linux-as.c
++++ b/clang/test/Driver/linux-as.c
+@@ -164,7 +164,7 @@
+ // CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu"
+ //
+ // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
+-// RUN: -no-integrated-as -c %s 2>&1 \
++// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \
+ // RUN: | FileCheck -check-prefix=CHECK-SPARCV9 %s
+ // CHECK-SPARCV9: as
+ // CHECK-SPARCV9: -64
+@@ -173,7 +173,7 @@
+ // CHECK-SPARCV9: -o
+ //
+ // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
+-// RUN: -no-integrated-as -fpic -c %s 2>&1 \
++// RUN: -no-integrated-as -c %s 2>&1 \
+ // RUN: | FileCheck -check-prefix=CHECK-SPARCV9PIC %s
+ // CHECK-SPARCV9PIC: as
+ // CHECK-SPARCV9PIC: -64
+diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
+index 24d3c78643f8..9ea22e6e0f64 100644
+--- a/clang/test/Driver/linux-ld.c
++++ b/clang/test/Driver/linux-ld.c
+@@ -1,3 +1,5 @@
++// XFAIL: linux
++
+ // General tests that ld invocations on Linux targets sane. Note that we use
+ // sysroot to make these tests independent of the host system.
+ //
+diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c
+index a74a19953ca2..0452661ba5a7 100644
+--- a/clang/test/Driver/ppc-abi.c
++++ b/clang/test/Driver/ppc-abi.c
+@@ -1,20 +1,20 @@
+ // Check passing PowerPC ABI options to the backend.
+
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN: | FileCheck -check-prefix=CHECK-ELFv1 %s
++// RUN: | FileCheck -check-prefix=CHECK-ELFv1-PIE %s
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN: -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1 %s
++// RUN: -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1-PIE %s
+ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN: -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-BE %s
++// RUN: -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-BE-PIE %s
+
+ // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN: | FileCheck -check-prefix=CHECK-ELFv2 %s
++// RUN: | FileCheck -check-prefix=CHECK-ELFv2-PIE %s
+ // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+ // RUN: -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1-LE %s
+ // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN: -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2 %s
++// RUN: -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2-PIE %s
+ // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+-// RUN: -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s
++// RUN: -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2-PIE %s
+
+ // RUN: %clang -target powerpc64-unknown-freebsd11 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s
+ // RUN: %clang -target powerpc64-unknown-freebsd12 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s
+@@ -26,10 +26,14 @@
+
+ // CHECK-ELFv1: "-mrelocation-model" "static"
+ // CHECK-ELFv1: "-target-abi" "elfv1"
+-// CHECK-ELFv1-LE: "-mrelocation-model" "static"
++// CHECK-ELFv1-PIE: "-mrelocation-model" "pic" "-pic-level" "2"
++// CHECK-ELFv1-PIE: "-target-abi" "elfv1"
++// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv1-LE: "-target-abi" "elfv1"
+ // CHECK-ELFv2: "-mrelocation-model" "static"
+ // CHECK-ELFv2: "-target-abi" "elfv2"
++// CHECK-ELFv2-PIE: "-mrelocation-model" "pic" "-pic-level" "2"
++// CHECK-ELFv2-PIE: "-target-abi" "elfv2"
+ // CHECK-ELFv2-BE: "-mrelocation-model" "static"
+ // CHECK-ELFv2-BE: "-target-abi" "elfv2"
+ // CHECK-ELFv2-BE-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie"
+diff --git a/clang/test/Driver/riscv32-toolchain.c b/clang/test/Driver/riscv32-toolchain.c
+index a5852f5f3997..233d9ef003cf 100644
+--- a/clang/test/Driver/riscv32-toolchain.c
++++ b/clang/test/Driver/riscv32-toolchain.c
+@@ -84,7 +84,7 @@
+ // C-RV32-LINUX-MULTI-ILP32: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv"
+ // C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32.so.1"
+-// C-RV32-LINUX-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32{{/|\\\\}}crtbegin.o"
++// C-RV32-LINUX-MULTI-ILP32: "crtbeginS.o"
+ // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32"
+ // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32"
+ // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32"
+@@ -99,7 +99,7 @@
+ // C-RV32-LINUX-MULTI-ILP32D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv"
+ // C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32d.so.1"
+-// C-RV32-LINUX-MULTI-ILP32D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d{{/|\\\\}}crtbegin.o"
++// C-RV32-LINUX-MULTI-ILP32D: "crtbeginS.o"
+ // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d"
+ // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d"
+ // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d"
+diff --git a/clang/test/Driver/riscv64-toolchain.c b/clang/test/Driver/riscv64-toolchain.c
+index e727f20bb601..a801e5eee462 100644
+--- a/clang/test/Driver/riscv64-toolchain.c
++++ b/clang/test/Driver/riscv64-toolchain.c
+@@ -84,7 +84,7 @@
+ // C-RV64-LINUX-MULTI-LP64: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv"
+ // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64.so.1"
+-// C-RV64-LINUX-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64{{/|\\\\}}crtbegin.o"
++// C-RV64-LINUX-MULTI-LP64: "crtbeginS.o"
+ // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64"
+ // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64"
+ // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64"
+@@ -99,7 +99,7 @@
+ // C-RV64-LINUX-MULTI-LP64D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv"
+ // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64d.so.1"
+-// C-RV64-LINUX-MULTI-LP64D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d{{/|\\\\}}crtbegin.o"
++// C-RV64-LINUX-MULTI-LP64D: "crtbeginS.o"
+ // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d"
+ // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d"
+ // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d"
+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
Copied: lib32-clang/repos/multilib-staging-x86_64/opencl-respect-calling-convention-for-builtin.patch (from rev 948006, lib32-clang/trunk/opencl-respect-calling-convention-for-builtin.patch)
===================================================================
--- multilib-staging-x86_64/opencl-respect-calling-convention-for-builtin.patch (rev 0)
+++ multilib-staging-x86_64/opencl-respect-calling-convention-for-builtin.patch 2021-05-27 04:32:48 UTC (rev 948007)
@@ -0,0 +1,107 @@
+From e0fe1c58acfa0bde36afde8354cb31fc1e0b75e2 Mon Sep 17 00:00:00 2001
+From: Luke Drummond <luke.drummond at codeplay.com>
+Date: Wed, 10 Mar 2021 18:14:42 +0000
+Subject: [PATCH] [OpenCL] Respect calling convention for builtin
+
+`__translate_sampler_initializer` has a calling convention of
+`spir_func`, but clang generated calls to it using the default CC.
+
+Instruction Combining was lowering these mismatching calling conventions
+to `store i1* undef` which itself was subsequently lowered to a trap
+instruction by simplifyCFG resulting in runtime `SIGILL`
+
+There are arguably two bugs here: but whether there's any wisdom in
+converting an obviously invalid call into a runtime crash over aborting
+with a sensible error message will require further discussion. So for
+now it's enough to set the right calling convention on the runtime
+helper.
+
+Reviewed By: svenh, bader
+
+Differential Revision: https://reviews.llvm.org/D98411
+
+(cherry picked from commit fcfd3fda71905d7c48f75a531c2265ad3b9876ea)
+---
+ clang/lib/CodeGen/CodeGenModule.cpp | 12 +++++++-----
+ clang/test/CodeGenOpenCL/sampler.cl | 12 ++++++------
+ 2 files changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
+index 31afbc6b4262..9c9bd4e374af 100644
+--- a/clang/lib/CodeGen/CodeGenModule.cpp
++++ b/clang/lib/CodeGen/CodeGenModule.cpp
+@@ -6215,15 +6215,17 @@ llvm::SanitizerStatReport &CodeGenModule::getSanStats() {
+
+ return *SanStats;
+ }
++
+ llvm::Value *
+ CodeGenModule::createOpenCLIntToSamplerConversion(const Expr *E,
+ CodeGenFunction &CGF) {
+ llvm::Constant *C = ConstantEmitter(CGF).emitAbstract(E, E->getType());
+- auto SamplerT = getOpenCLRuntime().getSamplerType(E->getType().getTypePtr());
+- auto FTy = llvm::FunctionType::get(SamplerT, {C->getType()}, false);
+- return CGF.Builder.CreateCall(CreateRuntimeFunction(FTy,
+- "__translate_sampler_initializer"),
+- {C});
++ auto *SamplerT = getOpenCLRuntime().getSamplerType(E->getType().getTypePtr());
++ auto *FTy = llvm::FunctionType::get(SamplerT, {C->getType()}, false);
++ auto *Call = CGF.Builder.CreateCall(
++ CreateRuntimeFunction(FTy, "__translate_sampler_initializer"), {C});
++ Call->setCallingConv(Call->getCalledFunction()->getCallingConv());
++ return Call;
+ }
+
+ CharUnits CodeGenModule::getNaturalPointeeTypeAlignment(
+diff --git a/clang/test/CodeGenOpenCL/sampler.cl b/clang/test/CodeGenOpenCL/sampler.cl
+index e6bda49f51c8..5ad8d0dbbf37 100644
+--- a/clang/test/CodeGenOpenCL/sampler.cl
++++ b/clang/test/CodeGenOpenCL/sampler.cl
+@@ -39,7 +39,7 @@ kernel void foo(sampler_t smp_par) {
+ // Case 2b
+ sampler_t smp = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_NEAREST;
+ // CHECK: [[smp_ptr:%[A-Za-z0-9_\.]+]] = alloca %opencl.sampler_t addrspace(2)*
+- // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 19)
++ // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 19)
+ // CHECK: store %opencl.sampler_t addrspace(2)* [[SAMP]], %opencl.sampler_t addrspace(2)** [[smp_ptr]]
+
+ // Case 1b
+@@ -56,12 +56,12 @@ kernel void foo(sampler_t smp_par) {
+
+ // Case 1a/2a
+ fnc4smp(glb_smp);
+- // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35)
++ // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35)
+ // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]])
+
+ // Case 1a/2c
+ fnc4smp(glb_smp_const);
+- // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35)
++ // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35)
+ // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]])
+
+ // Case 1c
+@@ -70,12 +70,12 @@ kernel void foo(sampler_t smp_par) {
+ // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]])
+
+ fnc4smp(5);
+- // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 5)
++ // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 5)
+ // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]])
+
+ const sampler_t const_smp = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR;
+ fnc4smp(const_smp);
+- // CHECK: [[CONST_SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35)
++ // CHECK: [[CONST_SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35)
+ // CHECK: store %opencl.sampler_t addrspace(2)* [[CONST_SAMP]], %opencl.sampler_t addrspace(2)** [[CONST_SMP_PTR:%[a-zA-Z0-9]+]]
+ fnc4smp(const_smp);
+ // CHECK: [[SAMP:%[0-9]+]] = load %opencl.sampler_t addrspace(2)*, %opencl.sampler_t addrspace(2)** [[CONST_SMP_PTR]]
+@@ -83,7 +83,7 @@ kernel void foo(sampler_t smp_par) {
+
+ constant sampler_t constant_smp = CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR;
+ fnc4smp(constant_smp);
+- // CHECK: [[SAMP:%[0-9]+]] = call %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35)
++ // CHECK: [[SAMP:%[0-9]+]] = call spir_func %opencl.sampler_t addrspace(2)* @__translate_sampler_initializer(i32 35)
+ // CHECK: call spir_func void [[FUNCNAME]](%opencl.sampler_t addrspace(2)* [[SAMP]])
+
+ // TODO: enable sampler initialization with non-constant integer.
More information about the arch-commits
mailing list