From 7af5d66ba0cc1748eea30a42f0c479d8c9c4c779 Mon Sep 17 00:00:00 2001 From: Gheorghe-Teodor Bercea Date: Mon, 27 Aug 2018 20:16:20 +0000 Subject: [OpenMP][NVPTX] Use appropriate _CALL_ELF macro when offloading Summary: When offloading to a device and using the powerpc64le version of the auxiliary triple, the _CALL_ELF macro is not set correctly to 2 resulting in the attempt to include a header that does not exist. This patch fixes this problem. Reviewers: Hahnfeld, ABataev, caomhin Reviewed By: Hahnfeld Subscribers: guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D51312 llvm-svn: 340772 --- clang/lib/Frontend/InitPreprocessor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'clang/lib/Frontend/InitPreprocessor.cpp') diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 0519255..01a74d1 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -1106,14 +1106,19 @@ static void InitializePredefinedAuxMacros(const TargetInfo &AuxTI, auto AuxTriple = AuxTI.getTriple(); // Define basic target macros needed by at least bits/wordsize.h and - // bits/mathinline.h + // bits/mathinline.h. + // On PowerPC, explicitely set _CALL_ELF macro needed for gnu/stubs.h. switch (AuxTriple.getArch()) { case llvm::Triple::x86_64: Builder.defineMacro("__x86_64__"); break; case llvm::Triple::ppc64: + Builder.defineMacro("__powerpc64__"); + Builder.defineMacro("_CALL_ELF", "1"); + break; case llvm::Triple::ppc64le: Builder.defineMacro("__powerpc64__"); + Builder.defineMacro("_CALL_ELF", "2"); break; default: break; -- cgit v1.1