]> granicus.if.org Git - clang/commitdiff
Add the _CALL_LINUX preprocessor define for ppc linux platforms.
authorEric Christopher <echristo@gmail.com>
Sat, 25 Mar 2017 03:33:59 +0000 (03:33 +0000)
committerEric Christopher <echristo@gmail.com>
Sat, 25 Mar 2017 03:33:59 +0000 (03:33 +0000)
This typically is only for a new enough linker (bfd >= 2.16.2 or gold), but
our ppc suppport post-dates this and it should work on all linux platforms. It
is guaranteed to work on all elfv2 platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298765 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/init.c

index 33fdfe7b6f60216ed81cdc566dbc1e5118772d7f..fda3ed45073f991805b4d9fdeed61487b6f76e1e 100644 (file)
@@ -1237,6 +1237,12 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
   if (ABI == "elfv2")
     Builder.defineMacro("_CALL_ELF", "2");
 
+  // This typically is only for a new enough linker (bfd >= 2.16.2 or gold), but
+  // our suppport post-dates this and it should work on all linux platforms. It
+  // is guaranteed to work on all elfv2 platforms.
+  if (getTriple().getOS() == llvm::Triple::Linux)
+    Builder.defineMacro("_CALL_LINUX", "1");
+
   // Subtarget options.
   Builder.defineMacro("__NATURAL_ALIGNMENT__");
   Builder.defineMacro("__REGISTER_PREFIX__", "");
index bd25334a68c2536b189e41978b80b7917e4d9b71..3fc5907e4d31d837a3e3439d51c3524dd9059ac4 100644 (file)
 // PPC64-LINUX:#define _ARCH_PPC 1
 // PPC64-LINUX:#define _ARCH_PPC64 1
 // PPC64-LINUX:#define _BIG_ENDIAN 1
+// PPC64-LINUX:#define _CALL_LINUX 1
 // PPC64-LINUX:#define _LP64 1
 // PPC64-LINUX:#define __BIGGEST_ALIGNMENT__ 16
 // PPC64-LINUX:#define __BIG_ENDIAN__ 1
 // PPC64-ELFv1:#define _CALL_ELF 1
 // PPC64-ELFv2:#define _CALL_ELF 2
 //
+// Most of this is encompassed in other places.
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64le-unknown-linux-gnu -target-abi elfv2 < /dev/null | FileCheck -match-full-lines -check-prefix PPC64LE-LINUX %s
+//
+// PPC64LE-LINUX:#define _CALL_LINUX 1
+//
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-none-none -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC %s
 //
 // PPC:#define _ARCH_PPC 1