Source: llvm-toolchain-17
Version: 1:17.0.6-12

Dear Maintainer,

glibc 2.38 introduced a header on arm64 defining a few new types. This
is causing build errors in a handful of packages, see #1070668. One of
the reasons is that Clang does not accept the new types in the context
of the HIP language, and this causes rocm-hipamd to fail to build from
source, see #1070446.

We have fixed the issue in LLVM upstream:
https://github.com/llvm/llvm-project/pull/99446

Please consider adding the patch to llvm-toolchain-17. The version
attached to this email should be ready for quilt import.

Thanks!
  Emanuele
From: Emanuele Rocca <[email protected]>
Date: Fri, 19 Jul 2024 09:25:38 +0200
Subject: [PATCH] [Clang] make SVE types known to device targets too (#99446)

For the purpose of preprocessing and declarations in header files,
ensure clang accepts SVE types for both device and host targets.

Co-authored-by: Sander De Smalen <[email protected]>
---
 clang/lib/AST/ASTContext.cpp       | 3 ++-
 clang/lib/Sema/Sema.cpp            | 4 +++-
 clang/test/PCH/aarch64-sve-types.c | 2 ++
 3 files changed, 7 insertions(+), 2 deletions(-)

Index: llvm-toolchain-17-17.0.6/clang/lib/AST/ASTContext.cpp
===================================================================
--- llvm-toolchain-17-17.0.6.orig/clang/lib/AST/ASTContext.cpp
+++ llvm-toolchain-17-17.0.6/clang/lib/AST/ASTContext.cpp
@@ -1396,7 +1396,8 @@ void ASTContext::InitBuiltinTypes(const
 #include "clang/Basic/OpenCLExtensionTypes.def"
   }
 
-  if (Target.hasAArch64SVETypes()) {
+  if (Target.hasAArch64SVETypes() ||
+      (AuxTarget && AuxTarget->hasAArch64SVETypes())) {
 #define SVE_TYPE(Name, Id, SingletonId) \
     InitBuiltinType(SingletonId, BuiltinType::Id);
 #include "clang/Basic/AArch64SVEACLETypes.def"
Index: llvm-toolchain-17-17.0.6/clang/lib/Sema/Sema.cpp
===================================================================
--- llvm-toolchain-17-17.0.6.orig/clang/lib/Sema/Sema.cpp
+++ llvm-toolchain-17-17.0.6/clang/lib/Sema/Sema.cpp
@@ -423,7 +423,9 @@ void Sema::Initialize() {
 #include "clang/Basic/OpenCLExtensionTypes.def"
   }
 
-  if (Context.getTargetInfo().hasAArch64SVETypes()) {
+  if (Context.getTargetInfo().hasAArch64SVETypes() ||
+      (Context.getAuxTargetInfo() &&
+       Context.getAuxTargetInfo()->hasAArch64SVETypes())) {
 #define SVE_TYPE(Name, Id, SingletonId) \
     addImplicitTypedef(Name, Context.SingletonId);
 #include "clang/Basic/AArch64SVEACLETypes.def"
Index: llvm-toolchain-17-17.0.6/clang/test/PCH/aarch64-sve-types.c
===================================================================
--- llvm-toolchain-17-17.0.6.orig/clang/test/PCH/aarch64-sve-types.c
+++ llvm-toolchain-17-17.0.6/clang/test/PCH/aarch64-sve-types.c
@@ -1,6 +1,8 @@
 // RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-pch -o %t %s
 // RUN: %clang_cc1 -triple aarch64-linux-gnu -include-pch %t \
 // RUN:   -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple aarch64-linux-gnu \
+// RUN:   -x hip-cpp-output -emit-pch -o %t %s
 
 // expected-no-diagnostics
 

Reply via email to