From 29f6951f2d639b3caace740dc9a613740ba28170 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Fri, 20 Nov 2015 09:48:08 +1100 Subject: [PATCH] Add PowerPC little endian support and remove TARGET_CPU_* defines The PowerPC version of read_time() is not being selected on little endian because we are only catching the big endian cases: #if (TARGET_CPU_powerpc == 1 || TARGET_CPU_powerpc64 == 1) This is the only place we use TARGET_CPU_*, and it is simpler (and more common) to use standard c pre-processor defines: #if defined(__powerpc__) || defined(__powerpc64__) This works on gcc, llvm/clang and IBM xlc. With this change we can remove TARGET_CPU_* completely. --- runtime/Makefile.am | 6 ------ runtime/Makefile.in | 1 - src/Makefile.am | 6 ------ src/Makefile.in | 1 - src/platform.cpp | 2 +- 5 files changed, 1 insertion(+), 15 deletions(-) diff --git a/runtime/Makefile.am b/runtime/Makefile.am index 52aaf2b1d..d825eb6ac 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am @@ -47,13 +47,7 @@ libcsmith_la_SOURCES = \ GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error) GIT_FLAG = -DGIT_VERSION=\"$(GIT_HASH)\" -## ENE: The idea of stuffing the target CPU name (a string) into a CPP symbol -## is kind of awful. What we should do instead is use the name to modify the -## include path, e.g., -I"$(target_cpu)". But that refactoring is for a later -## day... - libcsmith_a_CPPFLAGS = \ - -DTARGET_CPU_$(target_cpu)=1 \ $(GIT_FLAG) libcsmith_la_CPPFLAGS = \ $(libcsmith_a_CPPFLAGS) diff --git a/runtime/Makefile.in b/runtime/Makefile.in index 4618a4fd7..0a4d721f1 100644 --- a/runtime/Makefile.in +++ b/runtime/Makefile.in @@ -361,7 +361,6 @@ libcsmith_la_SOURCES = \ GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error) GIT_FLAG = -DGIT_VERSION=\"$(GIT_HASH)\" libcsmith_a_CPPFLAGS = \ - -DTARGET_CPU_$(target_cpu)=1 \ $(GIT_FLAG) libcsmith_la_CPPFLAGS = \ diff --git a/src/Makefile.am b/src/Makefile.am index 4824954c4..2dc58b7c1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -200,13 +200,7 @@ EXTRA_DIST = \ GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error) GIT_FLAG = -DGIT_VERSION=\"$(GIT_HASH)\" -## ENE: The idea of stuffing the target CPU name (a string) into a CPP symbol -## is kind of awful. What we should do instead is use the name to modify the -## include path, e.g., -I"$(target_cpu)". But that refactoring is for a later -## day... - csmith_CPPFLAGS = \ - -DTARGET_CPU_$(target_cpu)=1 \ $(GIT_FLAG) \ $(BOOST_CPPFLAGS) diff --git a/src/Makefile.in b/src/Makefile.in index b0385b85a..b1214d387 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -541,7 +541,6 @@ EXTRA_DIST = \ GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error) GIT_FLAG = -DGIT_VERSION=\"$(GIT_HASH)\" csmith_CPPFLAGS = \ - -DTARGET_CPU_$(target_cpu)=1 \ $(GIT_FLAG) \ $(BOOST_CPPFLAGS) diff --git a/src/platform.cpp b/src/platform.cpp index d3f5cefe1..cdc8e1f79 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -44,7 +44,7 @@ #include "platform.h" -#if (TARGET_CPU_powerpc == 1 || TARGET_CPU_powerpc64 == 1) +#if defined(__powerpc__) || defined(__powerpc64__) static inline unsigned long read_time(void) { unsigned long a;