[arch-commits] Commit in clang/repos/testing-x86_64 (7 files)

Evangelos Foutras foutrelis at archlinux.org
Sat Mar 30 11:32:14 UTC 2019


    Date: Saturday, March 30, 2019 @ 11:32:14
  Author: foutrelis
Revision: 349447

archrelease: copy trunk to testing-x86_64

Added:
  clang/repos/testing-x86_64/0001-OpenCL-Change-type-of-block-pointer-for-OpenCL.patch
    (from rev 349446, clang/trunk/0001-OpenCL-Change-type-of-block-pointer-for-OpenCL.patch)
  clang/repos/testing-x86_64/0002-OpenCL-Simplify-LLVM-IR-generated-for-OpenCL-blocks.patch
    (from rev 349446, clang/trunk/0002-OpenCL-Simplify-LLVM-IR-generated-for-OpenCL-blocks.patch)
  clang/repos/testing-x86_64/0003-OpenCL-Fix-assertion-due-to-blocks.patch
    (from rev 349446, clang/trunk/0003-OpenCL-Fix-assertion-due-to-blocks.patch)
  clang/repos/testing-x86_64/PKGBUILD
    (from rev 349446, clang/trunk/PKGBUILD)
  clang/repos/testing-x86_64/enable-SSP-and-PIE-by-default.patch
    (from rev 349446, clang/trunk/enable-SSP-and-PIE-by-default.patch)
Deleted:
  clang/repos/testing-x86_64/PKGBUILD
  clang/repos/testing-x86_64/enable-SSP-and-PIE-by-default.patch

----------------------------------------------------------------+
 0001-OpenCL-Change-type-of-block-pointer-for-OpenCL.patch      |  152 ++
 0002-OpenCL-Simplify-LLVM-IR-generated-for-OpenCL-blocks.patch |  290 +++++
 0003-OpenCL-Fix-assertion-due-to-blocks.patch                  |   57 
 PKGBUILD                                                       |  221 ++-
 enable-SSP-and-PIE-by-default.patch                            |  578 +++++-----
 5 files changed, 904 insertions(+), 394 deletions(-)

Copied: clang/repos/testing-x86_64/0001-OpenCL-Change-type-of-block-pointer-for-OpenCL.patch (from rev 349446, clang/trunk/0001-OpenCL-Change-type-of-block-pointer-for-OpenCL.patch)
===================================================================
--- 0001-OpenCL-Change-type-of-block-pointer-for-OpenCL.patch	                        (rev 0)
+++ 0001-OpenCL-Change-type-of-block-pointer-for-OpenCL.patch	2019-03-30 11:32:14 UTC (rev 349447)
@@ -0,0 +1,152 @@
+From 2f6eec18566fb235097bb2f0b00852e858330dc5 Mon Sep 17 00:00:00 2001
+From: Alexey Bader <alexey.bader at intel.com>
+Date: Tue, 19 Feb 2019 15:19:06 +0000
+Subject: [PATCH 1/3] [OpenCL] Change type of block pointer for OpenCL
+
+Summary:
+
+For some reason OpenCL blocks in LLVM IR are represented as function pointers.
+These pointers do not point to any real function and never get called. Actually
+they point to some structure, which in turn contains pointer to the real block
+invoke function.
+This patch changes represntation of OpenCL blocks in LLVM IR from function
+pointers to pointers to `%struct.__block_literal_generic`.
+Such representation allows to avoid unnecessary bitcasts and simplifies
+further processing (e.g. translation to SPIR-V ) of the module for targets
+which do not support function pointers.
+
+Patch by: Alexey Sotkin.
+
+Reviewers: Anastasia, yaxunl, svenvh
+
+Reviewed By: Anastasia
+
+Subscribers: alexbatashev, cfe-commits
+
+Tags: #clang
+
+Differential Revision: https://reviews.llvm.org/D58277
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354337 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/CodeGen/CodeGenTypes.cpp                   |  4 +++-
+ test/CodeGenOpenCL/blocks.cl                   | 18 ++++++++----------
+ test/CodeGenOpenCL/cl20-device-side-enqueue.cl | 18 +++++++++---------
+ 3 files changed, 20 insertions(+), 20 deletions(-)
+
+diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
+index 2acf1ac161..93b3ebf5c2 100644
+--- a/lib/CodeGen/CodeGenTypes.cpp
++++ b/lib/CodeGen/CodeGenTypes.cpp
+@@ -637,7 +637,9 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) {
+ 
+   case Type::BlockPointer: {
+     const QualType FTy = cast<BlockPointerType>(Ty)->getPointeeType();
+-    llvm::Type *PointeeType = ConvertTypeForMem(FTy);
++    llvm::Type *PointeeType = CGM.getLangOpts().OpenCL
++                                  ? CGM.getGenericBlockLiteralType()
++                                  : ConvertTypeForMem(FTy);
+     unsigned AS = Context.getTargetAddressSpace(FTy);
+     ResultType = llvm::PointerType::get(PointeeType, AS);
+     break;
+diff --git a/test/CodeGenOpenCL/blocks.cl b/test/CodeGenOpenCL/blocks.cl
+index 675240c6f0..19aacc3f0d 100644
+--- a/test/CodeGenOpenCL/blocks.cl
++++ b/test/CodeGenOpenCL/blocks.cl
+@@ -35,11 +35,10 @@ void foo(){
+   // SPIR: %[[block_captured:.*]] = getelementptr inbounds <{ i32, i32, i8 addrspace(4)*, i32 }>, <{ i32, i32, i8 addrspace(4)*, i32 }>* %[[block]], i32 0, i32 3
+   // SPIR: %[[i_value:.*]] = load i32, i32* %i
+   // SPIR: store i32 %[[i_value]], i32* %[[block_captured]],
+-  // SPIR: %[[blk_ptr:.*]] = bitcast <{ i32, i32, i8 addrspace(4)*, i32 }>* %[[block]] to i32 ()*
+-  // SPIR: %[[blk_gen_ptr:.*]] = addrspacecast i32 ()* %[[blk_ptr]] to i32 () addrspace(4)*
+-  // SPIR: store i32 () addrspace(4)* %[[blk_gen_ptr]], i32 () addrspace(4)** %[[block_B:.*]],
+-  // SPIR: %[[blk_gen_ptr:.*]] = load i32 () addrspace(4)*, i32 () addrspace(4)** %[[block_B]]
+-  // SPIR: %[[block_literal:.*]] = bitcast i32 () addrspace(4)* %[[blk_gen_ptr]] to %struct.__opencl_block_literal_generic addrspace(4)*
++  // SPIR: %[[blk_ptr:.*]] = bitcast <{ i32, i32, i8 addrspace(4)*, i32 }>* %[[block]] to %struct.__opencl_block_literal_generic*
++  // SPIR: %[[blk_gen_ptr:.*]] = addrspacecast %struct.__opencl_block_literal_generic* %[[blk_ptr]] to %struct.__opencl_block_literal_generic addrspace(4)*
++  // SPIR: store %struct.__opencl_block_literal_generic addrspace(4)* %[[blk_gen_ptr]], %struct.__opencl_block_literal_generic addrspace(4)** %[[block_B:.*]],
++  // SPIR: %[[block_literal:.*]] = load %struct.__opencl_block_literal_generic addrspace(4)*, %struct.__opencl_block_literal_generic addrspace(4)** %[[block_B]]
+   // SPIR: %[[invoke_addr:.*]] = getelementptr inbounds %struct.__opencl_block_literal_generic, %struct.__opencl_block_literal_generic addrspace(4)* %[[block_literal]], i32 0, i32 2
+   // SPIR: %[[blk_gen_ptr:.*]] = bitcast %struct.__opencl_block_literal_generic addrspace(4)* %[[block_literal]] to i8 addrspace(4)*
+   // SPIR: %[[invoke_func_ptr:.*]] = load i8 addrspace(4)*, i8 addrspace(4)* addrspace(4)* %[[invoke_addr]]
+@@ -50,11 +49,10 @@ void foo(){
+   // AMDGCN: %[[block_captured:.*]] = getelementptr inbounds <{ i32, i32, i8*, i32 }>, <{ i32, i32, i8*, i32 }> addrspace(5)* %[[block]], i32 0, i32 3
+   // AMDGCN: %[[i_value:.*]] = load i32, i32 addrspace(5)* %i
+   // AMDGCN: store i32 %[[i_value]], i32 addrspace(5)* %[[block_captured]],
+-  // AMDGCN: %[[blk_ptr:.*]] = bitcast <{ i32, i32, i8*, i32 }> addrspace(5)* %[[block]] to i32 () addrspace(5)*
+-  // AMDGCN: %[[blk_gen_ptr:.*]] = addrspacecast i32 () addrspace(5)* %[[blk_ptr]] to i32 ()*
+-  // AMDGCN: store i32 ()* %[[blk_gen_ptr]], i32 ()* addrspace(5)* %[[block_B:.*]],
+-  // AMDGCN: %[[blk_gen_ptr:.*]] = load i32 ()*, i32 ()* addrspace(5)* %[[block_B]]
+-  // AMDGCN: %[[block_literal:.*]] = bitcast i32 ()* %[[blk_gen_ptr]] to %struct.__opencl_block_literal_generic*
++  // AMDGCN: %[[blk_ptr:.*]] = bitcast <{ i32, i32, i8*, i32 }> addrspace(5)* %[[block]] to %struct.__opencl_block_literal_generic addrspace(5)*
++  // AMDGCN: %[[blk_gen_ptr:.*]] = addrspacecast %struct.__opencl_block_literal_generic addrspace(5)* %[[blk_ptr]] to %struct.__opencl_block_literal_generic*
++  // AMDGCN: store %struct.__opencl_block_literal_generic* %[[blk_gen_ptr]], %struct.__opencl_block_literal_generic* addrspace(5)* %[[block_B:.*]],
++  // AMDGCN: %[[block_literal:.*]] = load %struct.__opencl_block_literal_generic*, %struct.__opencl_block_literal_generic* addrspace(5)* %[[block_B]]
+   // AMDGCN: %[[invoke_addr:.*]] = getelementptr inbounds %struct.__opencl_block_literal_generic, %struct.__opencl_block_literal_generic* %[[block_literal]], i32 0, i32 2
+   // AMDGCN: %[[blk_gen_ptr:.*]] = bitcast %struct.__opencl_block_literal_generic* %[[block_literal]] to i8*
+   // AMDGCN: %[[invoke_func_ptr:.*]] = load i8*, i8** %[[invoke_addr]]
+diff --git a/test/CodeGenOpenCL/cl20-device-side-enqueue.cl b/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
+index 473219478a..84450162da 100644
+--- a/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
++++ b/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
+@@ -11,7 +11,7 @@ typedef struct {int a;} ndrange_t;
+ 
+ // For a block global variable, first emit the block literal as a global variable, then emit the block variable itself.
+ // COMMON: [[BL_GLOBAL:@__block_literal_global[^ ]*]] = internal addrspace(1) constant { i32, i32, i8 addrspace(4)* } { i32 {{[0-9]+}}, i32 {{[0-9]+}}, i8 addrspace(4)* addrspacecast (i8* bitcast (void (i8 addrspace(4)*, i8 addrspace(3)*)* [[INV_G:@[^ ]+]] to i8*) to i8 addrspace(4)*) }
+-// COMMON: @block_G =  addrspace(1) constant void (i8 addrspace(3)*) addrspace(4)* addrspacecast (void (i8 addrspace(3)*) addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BL_GLOBAL]] to void (i8 addrspace(3)*) addrspace(1)*) to void (i8 addrspace(3)*) addrspace(4)*)
++// COMMON: @block_G = addrspace(1) constant %struct.__opencl_block_literal_generic addrspace(4)* addrspacecast (%struct.__opencl_block_literal_generic addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BL_GLOBAL]] to %struct.__opencl_block_literal_generic addrspace(1)*) to %struct.__opencl_block_literal_generic addrspace(4)*)
+ 
+ // For anonymous blocks without captures, emit block literals as global variable.
+ // COMMON: [[BLG1:@__block_literal_global[^ ]*]] = internal addrspace(1) constant { i32, i32, i8 addrspace(4)* } { i32 {{[0-9]+}}, i32 {{[0-9]+}}, i8 addrspace(4)* addrspacecast (i8* bitcast (void (i8 addrspace(4)*, i8 addrspace(3)*)* {{@[^ ]+}} to i8*) to i8 addrspace(4)*) }
+@@ -77,9 +77,9 @@ kernel void device_side_enqueue(global int *a, global int *b, int i) {
+   // COMMON: [[DEF_Q:%[0-9]+]] = load %opencl.queue_t{{.*}}*, %opencl.queue_t{{.*}}** %default_queue
+   // COMMON: [[FLAGS:%[0-9]+]] = load i32, i32* %flags
+   // COMMON: store i8 addrspace(4)* addrspacecast (i8* bitcast (void (i8 addrspace(4)*)* [[INVL1:@__device_side_enqueue_block_invoke[^ ]*]] to i8*) to i8 addrspace(4)*), i8 addrspace(4)** %block.invoke
+-  // B32: [[BL:%[0-9]+]] = bitcast <{ i32, i32, i8 addrspace(4)*, i32 addrspace(1)*, i32, i32 addrspace(1)* }>* %block to void ()*
+-  // B64: [[BL:%[0-9]+]] = bitcast <{ i32, i32, i8 addrspace(4)*, i32 addrspace(1)*, i32 addrspace(1)*, i32 }>* %block to void ()*
+-  // COMMON: [[BL_I8:%[0-9]+]] = addrspacecast void ()* [[BL]] to i8 addrspace(4)*
++  // B32: [[BL:%[0-9]+]] = bitcast <{ i32, i32, i8 addrspace(4)*, i32 addrspace(1)*, i32, i32 addrspace(1)* }>* %block to %struct.__opencl_block_literal_generic*
++  // B64: [[BL:%[0-9]+]] = bitcast <{ i32, i32, i8 addrspace(4)*, i32 addrspace(1)*, i32 addrspace(1)*, i32 }>* %block to %struct.__opencl_block_literal_generic*
++  // COMMON: [[BL_I8:%[0-9]+]] = addrspacecast %struct.__opencl_block_literal_generic* [[BL]] to i8 addrspace(4)*
+   // COMMON-LABEL: call i32 @__enqueue_kernel_basic(
+   // COMMON-SAME: %opencl.queue_t{{.*}}* [[DEF_Q]], i32 [[FLAGS]], %struct.ndrange_t* byval [[NDR]]{{([0-9]+)?}},
+   // COMMON-SAME: i8 addrspace(4)* addrspacecast (i8* bitcast ({{.*}} [[INVLK1:[^ ]+_kernel]] to i8*) to i8 addrspace(4)*),
+@@ -95,8 +95,8 @@ kernel void device_side_enqueue(global int *a, global int *b, int i) {
+   // COMMON: [[WAIT_EVNT:%[0-9]+]] = addrspacecast %opencl.clk_event_t{{.*}}** %event_wait_list to %opencl.clk_event_t{{.*}}* addrspace(4)*
+   // COMMON: [[EVNT:%[0-9]+]] = addrspacecast %opencl.clk_event_t{{.*}}** %clk_event to %opencl.clk_event_t{{.*}}* addrspace(4)*
+   // COMMON: store i8 addrspace(4)* addrspacecast (i8* bitcast (void (i8 addrspace(4)*)* [[INVL2:@__device_side_enqueue_block_invoke[^ ]*]] to i8*) to i8 addrspace(4)*), i8 addrspace(4)** %block.invoke
+-  // COMMON: [[BL:%[0-9]+]] = bitcast <{ i32, i32, i8 addrspace(4)*, i32{{.*}}, i32{{.*}}, i32{{.*}} }>* %block3 to void ()*
+-  // COMMON: [[BL_I8:%[0-9]+]] = addrspacecast void ()* [[BL]] to i8 addrspace(4)*
++  // COMMON: [[BL:%[0-9]+]] = bitcast <{ i32, i32, i8 addrspace(4)*, i32{{.*}}, i32{{.*}}, i32{{.*}} }>* %block3 to %struct.__opencl_block_literal_generic*
++  // COMMON: [[BL_I8:%[0-9]+]] = addrspacecast %struct.__opencl_block_literal_generic* [[BL]] to i8 addrspace(4)*
+   // COMMON-LABEL: call i32 @__enqueue_kernel_basic_events
+   // COMMON-SAME: (%opencl.queue_t{{.*}}* [[DEF_Q]], i32 [[FLAGS]],  %struct.ndrange_t* {{.*}}, i32 2, %opencl.clk_event_t{{.*}}* addrspace(4)* [[WAIT_EVNT]], %opencl.clk_event_t{{.*}}* addrspace(4)* [[EVNT]],
+   // COMMON-SAME: i8 addrspace(4)* addrspacecast (i8* bitcast ({{.*}} [[INVLK2:[^ ]+_kernel]] to i8*) to i8 addrspace(4)*),
+@@ -300,13 +300,13 @@ kernel void device_side_enqueue(global int *a, global int *b, int i) {
+   // Emits global block literal [[BLG8]] and invoke function [[INVG8]].
+   // The full type of these expressions are long (and repeated elsewhere), so we
+   // capture it as part of the regex for convenience and clarity.
+-  // COMMON: store void () addrspace(4)* addrspacecast (void () addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG8]] to void () addrspace(1)*) to void () addrspace(4)*), void () addrspace(4)** %block_A
++  // COMMON: store %struct.__opencl_block_literal_generic addrspace(4)* addrspacecast (%struct.__opencl_block_literal_generic addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG8]] to %struct.__opencl_block_literal_generic addrspace(1)*) to %struct.__opencl_block_literal_generic addrspace(4)*), %struct.__opencl_block_literal_generic addrspace(4)** %block_A
+   void (^const block_A)(void) = ^{
+     return;
+   };
+ 
+   // Emits global block literal [[BLG9]] and invoke function [[INVG9]].
+-  // COMMON: store void (i8 addrspace(3)*) addrspace(4)* addrspacecast (void (i8 addrspace(3)*) addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG9]] to void (i8 addrspace(3)*) addrspace(1)*) to void (i8 addrspace(3)*) addrspace(4)*), void (i8 addrspace(3)*) addrspace(4)** %block_B
++  // COMMON: store %struct.__opencl_block_literal_generic addrspace(4)* addrspacecast (%struct.__opencl_block_literal_generic addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG9]] to %struct.__opencl_block_literal_generic addrspace(1)*) to %struct.__opencl_block_literal_generic addrspace(4)*), %struct.__opencl_block_literal_generic addrspace(4)** %block_B
+   void (^const block_B)(local void *) = ^(local void *a) {
+     return;
+   };
+@@ -346,7 +346,7 @@ kernel void device_side_enqueue(global int *a, global int *b, int i) {
+   // COMMON: store i8 addrspace(4)* addrspacecast (i8* bitcast (void (i8 addrspace(4)*)* [[INVL3:@__device_side_enqueue_block_invoke[^ ]*]] to i8*) to i8 addrspace(4)*), i8 addrspace(4)** %block.invoke
+   // COMMON: [[DEF_Q:%[0-9]+]] = load %opencl.queue_t{{.*}}*, %opencl.queue_t{{.*}}** %default_queue
+   // COMMON: [[FLAGS:%[0-9]+]] = load i32, i32* %flags
+-  // COMMON: [[BL_I8:%[0-9]+]] = addrspacecast void ()* {{.*}} to i8 addrspace(4)*
++  // COMMON: [[BL_I8:%[0-9]+]] = addrspacecast %struct.__opencl_block_literal_generic* {{.*}} to i8 addrspace(4)*
+   // COMMON-LABEL: call i32 @__enqueue_kernel_basic(
+   // COMMON-SAME: %opencl.queue_t{{.*}}* [[DEF_Q]], i32 [[FLAGS]], %struct.ndrange_t* byval [[NDR]]{{([0-9]+)?}},
+   // COMMON-SAME: i8 addrspace(4)* addrspacecast (i8* bitcast ({{.*}} [[INVLK3:[^ ]+_kernel]] to i8*) to i8 addrspace(4)*),
+-- 
+2.21.0
+

Copied: clang/repos/testing-x86_64/0002-OpenCL-Simplify-LLVM-IR-generated-for-OpenCL-blocks.patch (from rev 349446, clang/trunk/0002-OpenCL-Simplify-LLVM-IR-generated-for-OpenCL-blocks.patch)
===================================================================
--- 0002-OpenCL-Simplify-LLVM-IR-generated-for-OpenCL-blocks.patch	                        (rev 0)
+++ 0002-OpenCL-Simplify-LLVM-IR-generated-for-OpenCL-blocks.patch	2019-03-30 11:32:14 UTC (rev 349447)
@@ -0,0 +1,290 @@
+From 46c42e19eb6ad426c07f4e33408c7288ddd5d053 Mon Sep 17 00:00:00 2001
+From: Andrew Savonichev <andrew.savonichev at intel.com>
+Date: Thu, 21 Feb 2019 11:02:10 +0000
+Subject: [PATCH 2/3] [OpenCL] Simplify LLVM IR generated for OpenCL blocks
+
+Summary:
+Emit direct call of block invoke functions when possible, i.e. in case the
+block is not passed as a function argument.
+Also doing some refactoring of `CodeGenFunction::EmitBlockCallExpr()`
+
+Reviewers: Anastasia, yaxunl, svenvh
+
+Reviewed By: Anastasia
+
+Subscribers: cfe-commits
+
+Tags: #clang
+
+Differential Revision: https://reviews.llvm.org/D58388
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354568 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/CodeGen/CGBlocks.cpp                      | 77 +++++++++----------
+ lib/CodeGen/CGOpenCLRuntime.cpp               | 30 ++++++--
+ lib/CodeGen/CGOpenCLRuntime.h                 |  4 +
+ test/CodeGenOpenCL/blocks.cl                  | 10 +--
+ .../CodeGenOpenCL/cl20-device-side-enqueue.cl | 34 ++++++--
+ 5 files changed, 91 insertions(+), 64 deletions(-)
+
+diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
+index fa3c3ee861..10a0238d91 100644
+--- a/lib/CodeGen/CGBlocks.cpp
++++ b/lib/CodeGen/CGBlocks.cpp
+@@ -1261,52 +1261,49 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr *E,
+                                           ReturnValueSlot ReturnValue) {
+   const BlockPointerType *BPT =
+     E->getCallee()->getType()->getAs<BlockPointerType>();
+-
+   llvm::Value *BlockPtr = EmitScalarExpr(E->getCallee());
+-
+-  // Get a pointer to the generic block literal.
+-  // For OpenCL we generate generic AS void ptr to be able to reuse the same
+-  // block definition for blocks with captures generated as private AS local
+-  // variables and without captures generated as global AS program scope
+-  // variables.
+-  unsigned AddrSpace = 0;
+-  if (getLangOpts().OpenCL)
+-    AddrSpace = getContext().getTargetAddressSpace(LangAS::opencl_generic);
+-
+-  llvm::Type *BlockLiteralTy =
+-      llvm::PointerType::get(CGM.getGenericBlockLiteralType(), AddrSpace);
+-
+-  // Bitcast the callee to a block literal.
+-  BlockPtr =
+-      Builder.CreatePointerCast(BlockPtr, BlockLiteralTy, "block.literal");
+-
+-  // Get the function pointer from the literal.
+-  llvm::Value *FuncPtr =
+-      Builder.CreateStructGEP(CGM.getGenericBlockLiteralType(), BlockPtr,
+-                              CGM.getLangOpts().OpenCL ? 2 : 3);
+-
+-  // Add the block literal.
++  llvm::Type *GenBlockTy = CGM.getGenericBlockLiteralType();
++  llvm::Value *Func = nullptr;
++  QualType FnType = BPT->getPointeeType();
++  ASTContext &Ctx = getContext();
+   CallArgList Args;
+ 
+-  QualType VoidPtrQualTy = getContext().VoidPtrTy;
+-  llvm::Type *GenericVoidPtrTy = VoidPtrTy;
+   if (getLangOpts().OpenCL) {
+-    GenericVoidPtrTy = CGM.getOpenCLRuntime().getGenericVoidPointerType();
+-    VoidPtrQualTy =
+-        getContext().getPointerType(getContext().getAddrSpaceQualType(
+-            getContext().VoidTy, LangAS::opencl_generic));
+-  }
+-
+-  BlockPtr = Builder.CreatePointerCast(BlockPtr, GenericVoidPtrTy);
+-  Args.add(RValue::get(BlockPtr), VoidPtrQualTy);
+-
+-  QualType FnType = BPT->getPointeeType();
++    // For OpenCL, BlockPtr is already casted to generic block literal.
++
++    // First argument of a block call is a generic block literal casted to
++    // generic void pointer, i.e. i8 addrspace(4)*
++    llvm::Value *BlockDescriptor = Builder.CreatePointerCast(
++        BlockPtr, CGM.getOpenCLRuntime().getGenericVoidPointerType());
++    QualType VoidPtrQualTy = Ctx.getPointerType(
++        Ctx.getAddrSpaceQualType(Ctx.VoidTy, LangAS::opencl_generic));
++    Args.add(RValue::get(BlockDescriptor), VoidPtrQualTy);
++    // And the rest of the arguments.
++    EmitCallArgs(Args, FnType->getAs<FunctionProtoType>(), E->arguments());
++
++    // We *can* call the block directly unless it is a function argument.
++    if (!isa<ParmVarDecl>(E->getCalleeDecl()))
++      Func = CGM.getOpenCLRuntime().getInvokeFunction(E->getCallee());
++    else {
++      llvm::Value *FuncPtr = Builder.CreateStructGEP(GenBlockTy, BlockPtr, 2);
++      Func = Builder.CreateAlignedLoad(FuncPtr, getPointerAlign());
++    }
++  } else {
++    // Bitcast the block literal to a generic block literal.
++    BlockPtr = Builder.CreatePointerCast(
++        BlockPtr, llvm::PointerType::get(GenBlockTy, 0), "block.literal");
++    // Get pointer to the block invoke function
++    llvm::Value *FuncPtr = Builder.CreateStructGEP(GenBlockTy, BlockPtr, 3);
+ 
+-  // And the rest of the arguments.
+-  EmitCallArgs(Args, FnType->getAs<FunctionProtoType>(), E->arguments());
++    // First argument is a block literal casted to a void pointer
++    BlockPtr = Builder.CreatePointerCast(BlockPtr, VoidPtrTy);
++    Args.add(RValue::get(BlockPtr), Ctx.VoidPtrTy);
++    // And the rest of the arguments.
++    EmitCallArgs(Args, FnType->getAs<FunctionProtoType>(), E->arguments());
+ 
+-  // Load the function.
+-  llvm::Value *Func = Builder.CreateAlignedLoad(FuncPtr, getPointerAlign());
++    // Load the function.
++    Func = Builder.CreateAlignedLoad(FuncPtr, getPointerAlign());
++  }
+ 
+   const FunctionType *FuncTy = FnType->castAs<FunctionType>();
+   const CGFunctionInfo &FnInfo =
+diff --git a/lib/CodeGen/CGOpenCLRuntime.cpp b/lib/CodeGen/CGOpenCLRuntime.cpp
+index 7f6f595dd5..75003e569f 100644
+--- a/lib/CodeGen/CGOpenCLRuntime.cpp
++++ b/lib/CodeGen/CGOpenCLRuntime.cpp
+@@ -123,6 +123,23 @@ llvm::PointerType *CGOpenCLRuntime::getGenericVoidPointerType() {
+       CGM.getContext().getTargetAddressSpace(LangAS::opencl_generic));
+ }
+ 
++// Get the block literal from an expression derived from the block expression.
++// OpenCL v2.0 s6.12.5:
++// Block variable declarations are implicitly qualified with const. Therefore
++// all block variables must be initialized at declaration time and may not be
++// reassigned.
++static const BlockExpr *getBlockExpr(const Expr *E) {
++  const Expr *Prev = nullptr; // to make sure we do not stuck in infinite loop.
++  while(!isa<BlockExpr>(E) && E != Prev) {
++    Prev = E;
++    E = E->IgnoreCasts();
++    if (auto DR = dyn_cast<DeclRefExpr>(E)) {
++      E = cast<VarDecl>(DR->getDecl())->getInit();
++    }
++  }
++  return cast<BlockExpr>(E);
++}
++
+ /// Record emitted llvm invoke function and llvm block literal for the
+ /// corresponding block expression.
+ void CGOpenCLRuntime::recordBlockInfo(const BlockExpr *E,
+@@ -137,20 +154,17 @@ void CGOpenCLRuntime::recordBlockInfo(const BlockExpr *E,
+   EnqueuedBlockMap[E].Kernel = nullptr;
+ }
+ 
++llvm::Function *CGOpenCLRuntime::getInvokeFunction(const Expr *E) {
++  return EnqueuedBlockMap[getBlockExpr(E)].InvokeFunc;
++}
++
+ CGOpenCLRuntime::EnqueuedBlockInfo
+ CGOpenCLRuntime::emitOpenCLEnqueuedBlock(CodeGenFunction &CGF, const Expr *E) {
+   CGF.EmitScalarExpr(E);
+ 
+   // The block literal may be assigned to a const variable. Chasing down
+   // to get the block literal.
+-  if (auto DR = dyn_cast<DeclRefExpr>(E)) {
+-    E = cast<VarDecl>(DR->getDecl())->getInit();
+-  }
+-  E = E->IgnoreImplicit();
+-  if (auto Cast = dyn_cast<CastExpr>(E)) {
+-    E = Cast->getSubExpr();
+-  }
+-  auto *Block = cast<BlockExpr>(E);
++  const BlockExpr *Block = getBlockExpr(E);
+ 
+   assert(EnqueuedBlockMap.find(Block) != EnqueuedBlockMap.end() &&
+          "Block expression not emitted");
+diff --git a/lib/CodeGen/CGOpenCLRuntime.h b/lib/CodeGen/CGOpenCLRuntime.h
+index 750721f1b8..4effc7eaa8 100644
+--- a/lib/CodeGen/CGOpenCLRuntime.h
++++ b/lib/CodeGen/CGOpenCLRuntime.h
+@@ -92,6 +92,10 @@ public:
+   /// \param Block block literal emitted for the block expression.
+   void recordBlockInfo(const BlockExpr *E, llvm::Function *InvokeF,
+                        llvm::Value *Block);
++
++  /// \return LLVM block invoke function emitted for an expression derived from
++  /// the block expression.
++  llvm::Function *getInvokeFunction(const Expr *E);
+ };
+ 
+ }
+diff --git a/test/CodeGenOpenCL/blocks.cl b/test/CodeGenOpenCL/blocks.cl
+index 19aacc3f0d..ab5a2c643c 100644
+--- a/test/CodeGenOpenCL/blocks.cl
++++ b/test/CodeGenOpenCL/blocks.cl
+@@ -39,11 +39,8 @@ void foo(){
+   // SPIR: %[[blk_gen_ptr:.*]] = addrspacecast %struct.__opencl_block_literal_generic* %[[blk_ptr]] to %struct.__opencl_block_literal_generic addrspace(4)*
+   // SPIR: store %struct.__opencl_block_literal_generic addrspace(4)* %[[blk_gen_ptr]], %struct.__opencl_block_literal_generic addrspace(4)** %[[block_B:.*]],
+   // SPIR: %[[block_literal:.*]] = load %struct.__opencl_block_literal_generic addrspace(4)*, %struct.__opencl_block_literal_generic addrspace(4)** %[[block_B]]
+-  // SPIR: %[[invoke_addr:.*]] = getelementptr inbounds %struct.__opencl_block_literal_generic, %struct.__opencl_block_literal_generic addrspace(4)* %[[block_literal]], i32 0, i32 2
+   // SPIR: %[[blk_gen_ptr:.*]] = bitcast %struct.__opencl_block_literal_generic addrspace(4)* %[[block_literal]] to i8 addrspace(4)*
+-  // SPIR: %[[invoke_func_ptr:.*]] = load i8 addrspace(4)*, i8 addrspace(4)* addrspace(4)* %[[invoke_addr]]
+-  // SPIR: %[[invoke_func:.*]] = addrspacecast i8 addrspace(4)* %[[invoke_func_ptr]] to i32 (i8 addrspace(4)*)*
+-  // SPIR: call {{.*}}i32 %[[invoke_func]](i8 addrspace(4)* %[[blk_gen_ptr]])
++  // SPIR: call {{.*}}i32 @__foo_block_invoke(i8 addrspace(4)* %[[blk_gen_ptr]])
+   // AMDGCN: %[[block_invoke:.*]] = getelementptr inbounds <{ i32, i32, i8*, i32 }>, <{ i32, i32, i8*, i32 }> addrspace(5)* %[[block:.*]], i32 0, i32 2
+   // AMDGCN: store i8* bitcast (i32 (i8*)* @__foo_block_invoke to i8*), i8* addrspace(5)* %[[block_invoke]]
+   // AMDGCN: %[[block_captured:.*]] = getelementptr inbounds <{ i32, i32, i8*, i32 }>, <{ i32, i32, i8*, i32 }> addrspace(5)* %[[block]], i32 0, i32 3
+@@ -53,11 +50,8 @@ void foo(){
+   // AMDGCN: %[[blk_gen_ptr:.*]] = addrspacecast %struct.__opencl_block_literal_generic addrspace(5)* %[[blk_ptr]] to %struct.__opencl_block_literal_generic*
+   // AMDGCN: store %struct.__opencl_block_literal_generic* %[[blk_gen_ptr]], %struct.__opencl_block_literal_generic* addrspace(5)* %[[block_B:.*]],
+   // AMDGCN: %[[block_literal:.*]] = load %struct.__opencl_block_literal_generic*, %struct.__opencl_block_literal_generic* addrspace(5)* %[[block_B]]
+-  // AMDGCN: %[[invoke_addr:.*]] = getelementptr inbounds %struct.__opencl_block_literal_generic, %struct.__opencl_block_literal_generic* %[[block_literal]], i32 0, i32 2
+   // AMDGCN: %[[blk_gen_ptr:.*]] = bitcast %struct.__opencl_block_literal_generic* %[[block_literal]] to i8*
+-  // AMDGCN: %[[invoke_func_ptr:.*]] = load i8*, i8** %[[invoke_addr]]
+-  // AMDGCN: %[[invoke_func:.*]] = bitcast i8* %[[invoke_func_ptr]] to i32 (i8*)*
+-  // AMDGCN: call {{.*}}i32 %[[invoke_func]](i8* %[[blk_gen_ptr]])
++  // AMDGCN: call {{.*}}i32 @__foo_block_invoke(i8* %[[blk_gen_ptr]])
+ 
+   int (^ block_B)(void) = ^{
+     return i;
+diff --git a/test/CodeGenOpenCL/cl20-device-side-enqueue.cl b/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
+index 84450162da..1566912ded 100644
+--- a/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
++++ b/test/CodeGenOpenCL/cl20-device-side-enqueue.cl
+@@ -312,9 +312,7 @@ kernel void device_side_enqueue(global int *a, global int *b, int i) {
+   };
+ 
+   // Uses global block literal [[BLG8]] and invoke function [[INVG8]].
+-  // COMMON: [[r1:%.*]] = load i8 addrspace(4)*, i8 addrspace(4)* addrspace(4)* getelementptr inbounds (%struct.__opencl_block_literal_generic, %struct.__opencl_block_literal_generic addrspace(4)* addrspacecast (%struct.__opencl_block_literal_generic addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG8]] to %struct.__opencl_block_literal_generic addrspace(1)*) to %struct.__opencl_block_literal_generic addrspace(4)*), i32 0, i32 2)
+-  // COMMON: [[r2:%.*]] = addrspacecast i8 addrspace(4)* [[r1]] to void (i8 addrspace(4)*)*
+-  // COMMON: call spir_func void [[r2]](i8 addrspace(4)* addrspacecast (i8 addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG8]] to i8 addrspace(1)*) to i8 addrspace(4)*))
++  // COMMON: call spir_func void @__device_side_enqueue_block_invoke_11(i8 addrspace(4)* addrspacecast (i8 addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG8]] to i8 addrspace(1)*) to i8 addrspace(4)*))
+   block_A();
+ 
+   // Emits global block literal [[BLG8]] and block kernel [[INVGK8]]. [[INVGK8]] calls [[INVG8]].
+@@ -333,15 +331,35 @@ kernel void device_side_enqueue(global int *a, global int *b, int i) {
+   unsigned size = get_kernel_work_group_size(block_A);
+ 
+   // Uses global block literal [[BLG8]] and invoke function [[INVG8]]. Make sure no redundant block literal and invoke functions are emitted.
+-  // COMMON: [[r1:%.*]] = load i8 addrspace(4)*, i8 addrspace(4)* addrspace(4)* getelementptr inbounds (%struct.__opencl_block_literal_generic, %struct.__opencl_block_literal_generic addrspace(4)* addrspacecast (%struct.__opencl_block_literal_generic addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG8]] to %struct.__opencl_block_literal_generic addrspace(1)*) to %struct.__opencl_block_literal_generic addrspace(4)*), i32 0, i32 2)
+-  // COMMON: [[r2:%.*]] = addrspacecast i8 addrspace(4)* [[r1]] to void (i8 addrspace(4)*)*
+-  // COMMON: call spir_func void [[r2]](i8 addrspace(4)* addrspacecast (i8 addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG8]] to i8 addrspace(1)*) to i8 addrspace(4)*))
++  // COMMON: call spir_func void @__device_side_enqueue_block_invoke_11(i8 addrspace(4)* addrspacecast (i8 addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BLG8]] to i8 addrspace(1)*) to i8 addrspace(4)*))
+   block_A();
+ 
++  // Make sure that block invoke function is resolved correctly after sequence of assignements.
++  // COMMON: store %struct.__opencl_block_literal_generic addrspace(4)*
++  // COMMON-SAME: addrspacecast (%struct.__opencl_block_literal_generic addrspace(1)*
++  // COMMON-SAME: bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BL_GLOBAL]] to %struct.__opencl_block_literal_generic addrspace(1)*)
++  // COMMON-SAME: to %struct.__opencl_block_literal_generic addrspace(4)*),
++  // COMMON-SAME: %struct.__opencl_block_literal_generic addrspace(4)** %b1,
++  bl_t b1 = block_G;
++  // COMMON: store %struct.__opencl_block_literal_generic addrspace(4)*
++  // COMMON-SAME: addrspacecast (%struct.__opencl_block_literal_generic addrspace(1)*
++  // COMMON-SAME: bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BL_GLOBAL]] to %struct.__opencl_block_literal_generic addrspace(1)*)
++  // COMMON-SAME: to %struct.__opencl_block_literal_generic addrspace(4)*),
++  // COMMON-SAME: %struct.__opencl_block_literal_generic addrspace(4)** %b2,
++  bl_t b2 = b1;
++  // COMMON: call spir_func void @block_G_block_invoke(i8 addrspace(4)* addrspacecast (i8 addrspace(1)*
++  // COMMON-SAME: bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BL_GLOBAL]] to i8 addrspace(1)*)
++  // COOMON-SAME: to i8 addrspace(4)*), i8 addrspace(3)* null)
++  b2(0);
++  // Uses global block literal [[BL_GLOBAL]] and block kernel [[INV_G_K]]. [[INV_G_K]] calls [[INV_G]].
++  // COMMON: call i32 @__get_kernel_preferred_work_group_size_multiple_impl(
++  // COMMON-SAME: i8 addrspace(4)* addrspacecast (i8* bitcast ({{.*}} [[INV_G_K:[^ ]+_kernel]] to i8*) to i8 addrspace(4)*),
++  // COMMON-SAME: i8 addrspace(4)* addrspacecast (i8 addrspace(1)* bitcast ({ i32, i32, i8 addrspace(4)* } addrspace(1)* [[BL_GLOBAL]] to i8 addrspace(1)*) to i8 addrspace(4)*))
++  size = get_kernel_preferred_work_group_size_multiple(b2);
++
+   void (^block_C)(void) = ^{
+     callee(i, a);
+   };
+-
+   // Emits block literal on stack and block kernel [[INVLK3]].
+   // COMMON: store i8 addrspace(4)* addrspacecast (i8* bitcast (void (i8 addrspace(4)*)* [[INVL3:@__device_side_enqueue_block_invoke[^ ]*]] to i8*) to i8 addrspace(4)*), i8 addrspace(4)** %block.invoke
+   // COMMON: [[DEF_Q:%[0-9]+]] = load %opencl.queue_t{{.*}}*, %opencl.queue_t{{.*}}** %default_queue
+@@ -404,8 +422,8 @@ kernel void device_side_enqueue(global int *a, global int *b, int i) {
+ // COMMON: define internal spir_func void [[INVG8]](i8 addrspace(4)*{{.*}})
+ // COMMON: define internal spir_func void [[INVG9]](i8 addrspace(4)*{{.*}}, i8 addrspace(3)* %{{.*}})
+ // COMMON: define internal spir_kernel void [[INVGK8]](i8 addrspace(4)*{{.*}})
++// COMMON: define internal spir_kernel void [[INV_G_K]](i8 addrspace(4)*{{.*}}, i8 addrspace(3)*{{.*}})
+ // COMMON: define internal spir_kernel void [[INVLK3]](i8 addrspace(4)*{{.*}})
+ // COMMON: define internal spir_kernel void [[INVGK9]](i8 addrspace(4)*{{.*}}, i8 addrspace(3)*{{.*}})
+-// COMMON: define internal spir_kernel void [[INV_G_K]](i8 addrspace(4)*{{.*}}, i8 addrspace(3)*{{.*}})
+ // COMMON: define internal spir_kernel void [[INVGK10]](i8 addrspace(4)*{{.*}})
+ // COMMON: define internal spir_kernel void [[INVGK11]](i8 addrspace(4)*{{.*}})
+-- 
+2.21.0
+

Copied: clang/repos/testing-x86_64/0003-OpenCL-Fix-assertion-due-to-blocks.patch (from rev 349446, clang/trunk/0003-OpenCL-Fix-assertion-due-to-blocks.patch)
===================================================================
--- 0003-OpenCL-Fix-assertion-due-to-blocks.patch	                        (rev 0)
+++ 0003-OpenCL-Fix-assertion-due-to-blocks.patch	2019-03-30 11:32:14 UTC (rev 349447)
@@ -0,0 +1,57 @@
+From 94a65066cccbe50358dca0a9da7712cf5294912a Mon Sep 17 00:00:00 2001
+From: Yaxun Liu <Yaxun.Liu at amd.com>
+Date: Tue, 26 Feb 2019 16:20:41 +0000
+Subject: [PATCH 3/3] [OpenCL] Fix assertion due to blocks
+
+A recent change caused assertion in CodeGenFunction::EmitBlockCallExpr when a block is called.
+
+There is code
+
+  Func = CGM.getOpenCLRuntime().getInvokeFunction(E->getCallee());
+getCalleeDecl calls Expr::getReferencedDeclOfCallee, which does not handle
+BlockExpr and returns nullptr, which causes isa to assert.
+
+This patch fixes that.
+
+Differential Revision: https://reviews.llvm.org/D58658
+
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354893 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/AST/Expr.cpp             | 2 ++
+ test/CodeGenOpenCL/blocks.cl | 6 ++++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
+index 7cdd3b2c2a..50a65e02bf 100644
+--- a/lib/AST/Expr.cpp
++++ b/lib/AST/Expr.cpp
+@@ -1359,6 +1359,8 @@ Decl *Expr::getReferencedDeclOfCallee() {
+     return DRE->getDecl();
+   if (MemberExpr *ME = dyn_cast<MemberExpr>(CEE))
+     return ME->getMemberDecl();
++  if (auto *BE = dyn_cast<BlockExpr>(CEE))
++    return BE->getBlockDecl();
+ 
+   return nullptr;
+ }
+diff --git a/test/CodeGenOpenCL/blocks.cl b/test/CodeGenOpenCL/blocks.cl
+index ab5a2c643c..c3e26855df 100644
+--- a/test/CodeGenOpenCL/blocks.cl
++++ b/test/CodeGenOpenCL/blocks.cl
+@@ -90,6 +90,12 @@ int get42() {
+   return blockArgFunc(^{return 42;});
+ }
+ 
++// COMMON-LABEL: define {{.*}}@call_block
++// call {{.*}}@__call_block_block_invoke
++int call_block() {
++  return ^int(int num) { return num; } (11);
++}
++
+ // CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__size"
+ // CHECK-DEBUG: !DIDerivedType(tag: DW_TAG_member, name: "__align"
+ 
+-- 
+2.21.0
+

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2019-03-30 11:26:27 UTC (rev 349446)
+++ PKGBUILD	2019-03-30 11:32:14 UTC (rev 349447)
@@ -1,105 +0,0 @@
-# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
-# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
-
-pkgname=clang
-pkgver=8.0.0
-pkgrel=1
-pkgdesc="C language family frontend for LLVM"
-arch=('x86_64')
-url="https://clang.llvm.org/"
-license=('custom:University of Illinois/NCSA Open Source License')
-depends=('llvm-libs' 'gcc' 'compiler-rt')
-makedepends=('llvm' 'cmake' 'ninja' 'python-sphinx' 'python2')
-optdepends=('openmp: OpenMP support in clang with -fopenmp'
-            'python: for scan-view and git-clang-format')
-provides=("clang-analyzer=$pkgver" "clang-tools-extra=$pkgver")
-conflicts=('clang-analyzer' 'clang-tools-extra')
-replaces=('clang-analyzer' 'clang-tools-extra')
-source=(https://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz{,.sig}
-        https://releases.llvm.org/$pkgver/clang-tools-extra-$pkgver.src.tar.xz{,.sig}
-        https://releases.llvm.org/$pkgver/llvm-$pkgver.src.tar.xz{,.sig}
-        enable-SSP-and-PIE-by-default.patch)
-sha256sums=('084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b'
-            'SKIP'
-            '4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b'
-            'SKIP'
-            '8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c'
-            'SKIP'
-            '58f86da25eb230ed6d423b5b61870cbf3bef88f38103ca676a2c7f34b2372171')
-validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans at chromium.org>
-validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar at redhat.com>
-
-prepare() {
-  cd "$srcdir/cfe-$pkgver.src"
-  mkdir build
-  mv "$srcdir/clang-tools-extra-$pkgver.src" tools/extra
-  patch -Np1 -i ../enable-SSP-and-PIE-by-default.patch
-}
-
-build() {
-  cd "$srcdir/cfe-$pkgver.src/build"
-
-  cmake .. -G Ninja \
-    -DCMAKE_BUILD_TYPE=Release \
-    -DCMAKE_INSTALL_PREFIX=/usr \
-    -DPYTHON_EXECUTABLE=/usr/bin/python \
-    -DBUILD_SHARED_LIBS=ON \
-    -DLLVM_LINK_LLVM_DYLIB=ON \
-    -DLLVM_ENABLE_RTTI=ON \
-    -DLLVM_BUILD_TESTS=ON \
-    -DLLVM_INCLUDE_DOCS=ON \
-    -DLLVM_BUILD_DOCS=ON \
-    -DLLVM_ENABLE_SPHINX=ON \
-    -DSPHINX_WARNINGS_AS_ERRORS=OFF \
-    -DLLVM_EXTERNAL_LIT=/usr/bin/lit \
-    -DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
-  ninja
-}
-
-check() {
-  cd "$srcdir/cfe-$pkgver.src/build"
-  ninja check-clang{,-tools}
-}
-
-_python2_optimize() {
-  python2 -m compileall "$@"
-  python2 -O -m compileall "$@"
-}
-
-_python3_optimize() {
-  python3 -m compileall "$@"
-  python3 -O -m compileall "$@"
-  python3 -OO -m compileall "$@"
-}
-
-package() {
-  cd "$srcdir/cfe-$pkgver.src/build"
-
-  DESTDIR="$pkgdir" ninja install
-  install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
-
-  # Remove documentation sources
-  rm -r "$pkgdir"/usr/share/doc/clang{,-tools}/html/{_sources,.buildinfo}
-
-  # Move analyzer scripts out of /usr/libexec
-  mv "$pkgdir"/usr/libexec/{ccc,c++}-analyzer "$pkgdir/usr/lib/clang/"
-  rmdir "$pkgdir/usr/libexec"
-  sed -i 's|libexec|lib/clang|' "$pkgdir/usr/bin/scan-build"
-
-  # Install Python bindings
-  for _py in 2.7 3.7; do
-    install -d "$pkgdir/usr/lib/python$_py/site-packages"
-    cp -a ../bindings/python/clang "$pkgdir/usr/lib/python$_py/site-packages/"
-    _python${_py%%.*}_optimize "$pkgdir/usr/lib/python$_py"
-  done
-
-  # Fix shebang in Python 2 script
-  sed -i '1s|/usr/bin/env python$|&2|' \
-    "$pkgdir"/usr/share/$pkgname/run-find-all-symbols.py
-
-  # Compile Python scripts
-  _python2_optimize "$pkgdir/usr/share/clang"
-  _python3_optimize "$pkgdir/usr/share" -x 'clang-include-fixer|run-find-all-symbols'
-}
-
-# vim:set ts=2 sw=2 et:

Copied: clang/repos/testing-x86_64/PKGBUILD (from rev 349446, clang/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2019-03-30 11:32:14 UTC (rev 349447)
@@ -0,0 +1,116 @@
+# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
+# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
+
+pkgname=clang
+pkgver=8.0.0
+pkgrel=2
+pkgdesc="C language family frontend for LLVM"
+arch=('x86_64')
+url="https://clang.llvm.org/"
+license=('custom:University of Illinois/NCSA Open Source License')
+depends=('llvm-libs' 'gcc' 'compiler-rt')
+makedepends=('llvm' 'cmake' 'ninja' 'python-sphinx' 'python2')
+optdepends=('openmp: OpenMP support in clang with -fopenmp'
+            'python: for scan-view and git-clang-format')
+provides=("clang-analyzer=$pkgver" "clang-tools-extra=$pkgver")
+conflicts=('clang-analyzer' 'clang-tools-extra')
+replaces=('clang-analyzer' 'clang-tools-extra')
+source=(https://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz{,.sig}
+        https://releases.llvm.org/$pkgver/clang-tools-extra-$pkgver.src.tar.xz{,.sig}
+        https://releases.llvm.org/$pkgver/llvm-$pkgver.src.tar.xz{,.sig}
+        0001-OpenCL-Change-type-of-block-pointer-for-OpenCL.patch
+        0002-OpenCL-Simplify-LLVM-IR-generated-for-OpenCL-blocks.patch
+        0003-OpenCL-Fix-assertion-due-to-blocks.patch
+        enable-SSP-and-PIE-by-default.patch)
+sha256sums=('084c115aab0084e63b23eee8c233abb6739c399e29966eaeccfc6e088e0b736b'
+            'SKIP'
+            '4f00122be408a7482f2004bcf215720d2b88cf8dc78b824abb225da8ad359d4b'
+            'SKIP'
+            '8872be1b12c61450cacc82b3d153eab02be2546ef34fa3580ed14137bb26224c'
+            'SKIP'
+            'fbb6d3c8135942e458bcad8882605a623bcd09bdec488eb0800e3afee0061e3a'
+            '91c49139e02c6d29f6201aa394868939b991b39b84215c082392ea96fbd8c334'
+            '191434810b5298331908ea1e193203e8441693da900238344e946ee6a79dad31'
+            '58f86da25eb230ed6d423b5b61870cbf3bef88f38103ca676a2c7f34b2372171')
+validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans at chromium.org>
+validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar at redhat.com>
+
+prepare() {
+  cd "$srcdir/cfe-$pkgver.src"
+  mkdir build
+  mv "$srcdir/clang-tools-extra-$pkgver.src" tools/extra
+  patch -Np1 -i ../enable-SSP-and-PIE-by-default.patch
+
+  # Backported patches for intel-opencl-clang and intel-compute-runtime
+  patch -Np1 -i ../0001-OpenCL-Change-type-of-block-pointer-for-OpenCL.patch
+  patch -Np1 -i ../0002-OpenCL-Simplify-LLVM-IR-generated-for-OpenCL-blocks.patch
+  patch -Np1 -i ../0003-OpenCL-Fix-assertion-due-to-blocks.patch
+}
+
+build() {
+  cd "$srcdir/cfe-$pkgver.src/build"
+
+  cmake .. -G Ninja \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DCMAKE_INSTALL_PREFIX=/usr \
+    -DPYTHON_EXECUTABLE=/usr/bin/python \
+    -DBUILD_SHARED_LIBS=ON \
+    -DLLVM_LINK_LLVM_DYLIB=ON \
+    -DLLVM_ENABLE_RTTI=ON \
+    -DLLVM_BUILD_TESTS=ON \
+    -DLLVM_INCLUDE_DOCS=ON \
+    -DLLVM_BUILD_DOCS=ON \
+    -DLLVM_ENABLE_SPHINX=ON \
+    -DSPHINX_WARNINGS_AS_ERRORS=OFF \
+    -DLLVM_EXTERNAL_LIT=/usr/bin/lit \
+    -DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
+  ninja
+}
+
+check() {
+  cd "$srcdir/cfe-$pkgver.src/build"
+  ninja check-clang{,-tools}
+}
+
+_python2_optimize() {
+  python2 -m compileall "$@"
+  python2 -O -m compileall "$@"
+}
+
+_python3_optimize() {
+  python3 -m compileall "$@"
+  python3 -O -m compileall "$@"
+  python3 -OO -m compileall "$@"
+}
+
+package() {
+  cd "$srcdir/cfe-$pkgver.src/build"
+
+  DESTDIR="$pkgdir" ninja install
+  install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+  # Remove documentation sources
+  rm -r "$pkgdir"/usr/share/doc/clang{,-tools}/html/{_sources,.buildinfo}
+
+  # Move analyzer scripts out of /usr/libexec
+  mv "$pkgdir"/usr/libexec/{ccc,c++}-analyzer "$pkgdir/usr/lib/clang/"
+  rmdir "$pkgdir/usr/libexec"
+  sed -i 's|libexec|lib/clang|' "$pkgdir/usr/bin/scan-build"
+
+  # Install Python bindings
+  for _py in 2.7 3.7; do
+    install -d "$pkgdir/usr/lib/python$_py/site-packages"
+    cp -a ../bindings/python/clang "$pkgdir/usr/lib/python$_py/site-packages/"
+    _python${_py%%.*}_optimize "$pkgdir/usr/lib/python$_py"
+  done
+
+  # Fix shebang in Python 2 script
+  sed -i '1s|/usr/bin/env python$|&2|' \
+    "$pkgdir"/usr/share/$pkgname/run-find-all-symbols.py
+
+  # Compile Python scripts
+  _python2_optimize "$pkgdir/usr/share/clang"
+  _python3_optimize "$pkgdir/usr/share" -x 'clang-include-fixer|run-find-all-symbols'
+}
+
+# vim:set ts=2 sw=2 et:

Deleted: enable-SSP-and-PIE-by-default.patch
===================================================================
--- enable-SSP-and-PIE-by-default.patch	2019-03-30 11:26:27 UTC (rev 349446)
+++ enable-SSP-and-PIE-by-default.patch	2019-03-30 11:32:14 UTC (rev 349447)
@@ -1,289 +0,0 @@
-From a076711d030ca5777465dab9f11c0639478a5cc8 Mon Sep 17 00:00:00 2001
-From: Evangelos Foutras <evangelos at foutrelis.com>
-Date: Tue, 26 Mar 2019 01:35:50 +0200
-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)
----
- lib/Driver/ToolChains/Linux.cpp     | 14 ++++++++++++--
- lib/Driver/ToolChains/Linux.h       |  1 +
- test/Driver/cross-linux.c           | 16 ++++++++--------
- test/Driver/env.c                   |  2 +-
- test/Driver/fsanitize.c             | 14 +++++++-------
- test/Driver/gcc-toolchain.cpp       |  2 +-
- test/Driver/hexagon-toolchain-elf.c |  2 +-
- test/Driver/linux-as.c              |  4 ++--
- test/Driver/linux-ld.c              |  2 ++
- test/Driver/ppc-abi.c               |  4 ++--
- test/Driver/riscv32-toolchain.c     |  4 ++--
- test/Driver/stack-protector.c       |  4 ++--
- 12 files changed, 41 insertions(+), 28 deletions(-)
-
-diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index 65ab9b2daf..5b757b8028 100644
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -968,8 +968,18 @@ 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;
-+}
-+
-+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
-+  return 2;
- }
- 
- bool Linux::IsMathErrnoDefault() const {
-diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h
-index 4a662cb4b4..4f369c6090 100644
---- a/lib/Driver/ToolChains/Linux.h
-+++ b/lib/Driver/ToolChains/Linux.h
-@@ -40,6 +40,7 @@ public:
-   CXXStdlibType GetDefaultCXXStdlibType() const override;
-   bool isPIEDefault() const override;
-   bool IsMathErrnoDefault() const override;
-+  unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
-   SanitizerMask getSupportedSanitizers() const override;
-   void addProfileRTLibs(const llvm::opt::ArgList &Args,
-                         llvm::opt::ArgStringList &CmdArgs) const override;
-diff --git a/test/Driver/cross-linux.c b/test/Driver/cross-linux.c
-index a5ea832e77..1949c05a60 100644
---- a/test/Driver/cross-linux.c
-+++ b/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"
-@@ -59,8 +59,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"
-@@ -77,8 +77,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"
-@@ -95,8 +95,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/test/Driver/env.c b/test/Driver/env.c
-index 0371bc91c4..ea89f52512 100644
---- a/test/Driver/env.c
-+++ b/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/test/Driver/fsanitize.c b/test/Driver/fsanitize.c
-index db88872399..76af9bd8fe 100644
---- a/test/Driver/fsanitize.c
-+++ b/test/Driver/fsanitize.c
-@@ -331,15 +331,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"
-@@ -687,12 +687,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/test/Driver/gcc-toolchain.cpp b/test/Driver/gcc-toolchain.cpp
-index ca96757a2b..ae1c25e989 100644
---- a/test/Driver/gcc-toolchain.cpp
-+++ b/test/Driver/gcc-toolchain.cpp
-@@ -24,6 +24,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/test/Driver/hexagon-toolchain-elf.c b/test/Driver/hexagon-toolchain-elf.c
-index a7eeca0fdb..32f648372e 100644
---- a/test/Driver/hexagon-toolchain-elf.c
-+++ b/test/Driver/hexagon-toolchain-elf.c
-@@ -457,7 +457,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/test/Driver/linux-as.c b/test/Driver/linux-as.c
-index a9335ebf71..a72041865b 100644
---- a/test/Driver/linux-as.c
-+++ b/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/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
-index 3ab81be490..fd6b67dd9a 100644
---- a/test/Driver/linux-ld.c
-+++ b/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/test/Driver/ppc-abi.c b/test/Driver/ppc-abi.c
-index a82a01de27..35de94a4ad 100644
---- a/test/Driver/ppc-abi.c
-+++ b/test/Driver/ppc-abi.c
-@@ -26,11 +26,11 @@
- 
- // CHECK-ELFv1: "-mrelocation-model" "pic" "-pic-level" "2"
- // CHECK-ELFv1: "-target-abi" "elfv1"
--// CHECK-ELFv1-LE: "-mrelocation-model" "static"
-+// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2"
- // CHECK-ELFv1-LE: "-target-abi" "elfv1"
- // CHECK-ELFv1-QPX: "-mrelocation-model" "pic" "-pic-level" "2"
- // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
--// CHECK-ELFv2: "-mrelocation-model" "static"
-+// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
- // CHECK-ELFv2: "-target-abi" "elfv2"
- // CHECK-ELFv2-BE: "-mrelocation-model" "pic" "-pic-level" "2"
- // CHECK-ELFv2-BE: "-target-abi" "elfv2"
-diff --git a/test/Driver/riscv32-toolchain.c b/test/Driver/riscv32-toolchain.c
-index 9e8af3a8ff..171392d172 100644
---- a/test/Driver/riscv32-toolchain.c
-+++ b/test/Driver/riscv32-toolchain.c
-@@ -78,7 +78,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"
-@@ -94,7 +94,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/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
-index a3e40b50ee..dfffe0d6cf 100644
---- a/test/Driver/stack-protector.c
-+++ b/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
--- 
-2.21.0
-

Copied: clang/repos/testing-x86_64/enable-SSP-and-PIE-by-default.patch (from rev 349446, clang/trunk/enable-SSP-and-PIE-by-default.patch)
===================================================================
--- enable-SSP-and-PIE-by-default.patch	                        (rev 0)
+++ enable-SSP-and-PIE-by-default.patch	2019-03-30 11:32:14 UTC (rev 349447)
@@ -0,0 +1,289 @@
+From a076711d030ca5777465dab9f11c0639478a5cc8 Mon Sep 17 00:00:00 2001
+From: Evangelos Foutras <evangelos at foutrelis.com>
+Date: Tue, 26 Mar 2019 01:35:50 +0200
+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)
+---
+ lib/Driver/ToolChains/Linux.cpp     | 14 ++++++++++++--
+ lib/Driver/ToolChains/Linux.h       |  1 +
+ test/Driver/cross-linux.c           | 16 ++++++++--------
+ test/Driver/env.c                   |  2 +-
+ test/Driver/fsanitize.c             | 14 +++++++-------
+ test/Driver/gcc-toolchain.cpp       |  2 +-
+ test/Driver/hexagon-toolchain-elf.c |  2 +-
+ test/Driver/linux-as.c              |  4 ++--
+ test/Driver/linux-ld.c              |  2 ++
+ test/Driver/ppc-abi.c               |  4 ++--
+ test/Driver/riscv32-toolchain.c     |  4 ++--
+ test/Driver/stack-protector.c       |  4 ++--
+ 12 files changed, 41 insertions(+), 28 deletions(-)
+
+diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
+index 65ab9b2daf..5b757b8028 100644
+--- a/lib/Driver/ToolChains/Linux.cpp
++++ b/lib/Driver/ToolChains/Linux.cpp
+@@ -968,8 +968,18 @@ 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;
++}
++
++unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
++  return 2;
+ }
+ 
+ bool Linux::IsMathErrnoDefault() const {
+diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h
+index 4a662cb4b4..4f369c6090 100644
+--- a/lib/Driver/ToolChains/Linux.h
++++ b/lib/Driver/ToolChains/Linux.h
+@@ -40,6 +40,7 @@ public:
+   CXXStdlibType GetDefaultCXXStdlibType() const override;
+   bool isPIEDefault() const override;
+   bool IsMathErrnoDefault() const override;
++  unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
+   SanitizerMask getSupportedSanitizers() const override;
+   void addProfileRTLibs(const llvm::opt::ArgList &Args,
+                         llvm::opt::ArgStringList &CmdArgs) const override;
+diff --git a/test/Driver/cross-linux.c b/test/Driver/cross-linux.c
+index a5ea832e77..1949c05a60 100644
+--- a/test/Driver/cross-linux.c
++++ b/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"
+@@ -59,8 +59,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"
+@@ -77,8 +77,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"
+@@ -95,8 +95,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/test/Driver/env.c b/test/Driver/env.c
+index 0371bc91c4..ea89f52512 100644
+--- a/test/Driver/env.c
++++ b/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/test/Driver/fsanitize.c b/test/Driver/fsanitize.c
+index db88872399..76af9bd8fe 100644
+--- a/test/Driver/fsanitize.c
++++ b/test/Driver/fsanitize.c
+@@ -331,15 +331,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"
+@@ -687,12 +687,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/test/Driver/gcc-toolchain.cpp b/test/Driver/gcc-toolchain.cpp
+index ca96757a2b..ae1c25e989 100644
+--- a/test/Driver/gcc-toolchain.cpp
++++ b/test/Driver/gcc-toolchain.cpp
+@@ -24,6 +24,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/test/Driver/hexagon-toolchain-elf.c b/test/Driver/hexagon-toolchain-elf.c
+index a7eeca0fdb..32f648372e 100644
+--- a/test/Driver/hexagon-toolchain-elf.c
++++ b/test/Driver/hexagon-toolchain-elf.c
+@@ -457,7 +457,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/test/Driver/linux-as.c b/test/Driver/linux-as.c
+index a9335ebf71..a72041865b 100644
+--- a/test/Driver/linux-as.c
++++ b/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/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
+index 3ab81be490..fd6b67dd9a 100644
+--- a/test/Driver/linux-ld.c
++++ b/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/test/Driver/ppc-abi.c b/test/Driver/ppc-abi.c
+index a82a01de27..35de94a4ad 100644
+--- a/test/Driver/ppc-abi.c
++++ b/test/Driver/ppc-abi.c
+@@ -26,11 +26,11 @@
+ 
+ // CHECK-ELFv1: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv1: "-target-abi" "elfv1"
+-// CHECK-ELFv1-LE: "-mrelocation-model" "static"
++// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv1-LE: "-target-abi" "elfv1"
+ // CHECK-ELFv1-QPX: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
+-// CHECK-ELFv2: "-mrelocation-model" "static"
++// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv2: "-target-abi" "elfv2"
+ // CHECK-ELFv2-BE: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv2-BE: "-target-abi" "elfv2"
+diff --git a/test/Driver/riscv32-toolchain.c b/test/Driver/riscv32-toolchain.c
+index 9e8af3a8ff..171392d172 100644
+--- a/test/Driver/riscv32-toolchain.c
++++ b/test/Driver/riscv32-toolchain.c
+@@ -78,7 +78,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"
+@@ -94,7 +94,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/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
+index a3e40b50ee..dfffe0d6cf 100644
+--- a/test/Driver/stack-protector.c
++++ b/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
+-- 
+2.21.0
+



More information about the arch-commits mailing list