r298765 - Add the _CALL_LINUX preprocessor define for ppc linux platforms.

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 25 12:38:49 PDT 2017


Reading comprehension is hard. :)

Thanks for the catch.

echristo at athyra ~/s/l/t/clang> git svn dcommit
Committing to https://llvm.org/svn/llvm-project/cfe/trunk ...
M lib/Basic/Targets.cpp
M test/Preprocessor/init.c
Committed r298778

-eric

On Sat, Mar 25, 2017 at 12:44 AM David Majnemer <david.majnemer at gmail.com>
wrote:

> Shouldn't this only be defined on 64-bit PPC platforms? I think that's
> what GCC does:
> https://github.com/gcc-mirror/gcc/blob/700a97608cadfe8adcd1a98e6388a5cbee9d76f6/gcc/config/rs6000/linux64.h#L372
>
> On Fri, Mar 24, 2017 at 8:33 PM, Eric Christopher via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
> Author: echristo
> Date: Fri Mar 24 22:33:59 2017
> New Revision: 298765
>
> URL: http://llvm.org/viewvc/llvm-project?rev=298765&view=rev
> Log:
> Add the _CALL_LINUX preprocessor define for ppc linux platforms.
>
> 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.
>
> Modified:
>     cfe/trunk/lib/Basic/Targets.cpp
>     cfe/trunk/test/Preprocessor/init.c
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=298765&r1=298764&r2=298765&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar 24 22:33:59 2017
> @@ -1237,6 +1237,12 @@ void PPCTargetInfo::getTargetDefines(con
>    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__", "");
>
> Modified: cfe/trunk/test/Preprocessor/init.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=298765&r1=298764&r2=298765&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Preprocessor/init.c (original)
> +++ cfe/trunk/test/Preprocessor/init.c Fri Mar 24 22:33:59 2017
> @@ -6144,6 +6144,7 @@
>  // 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
> @@ -6346,6 +6347,11 @@
>  // 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
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170325/55644e72/attachment.html>


More information about the cfe-commits mailing list