Skip to content

Commit

Permalink
Small build system modifications to make ppc64le compileable (JuliaLa…
Browse files Browse the repository at this point in the history
…ng#18258)

* Small build system modifications to make ppc64le compileable

* Make things more explicit for big-endian PPC64
  • Loading branch information
staticfloat authored and ViralBShah committed Aug 30, 2016
1 parent 9ebf5d6 commit fc17a98
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
52 changes: 29 additions & 23 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -600,27 +600,6 @@ $(error Pre-SSE2 CPU targets not supported. To create a generic 32-bit x86 binar
pass 'MARCH=pentium4'.)
endif
ifneq ($(MARCH),)
CC += -march=$(MARCH)
CXX += -march=$(MARCH)
FC += -march=$(MARCH)
JULIA_CPU_TARGET ?= $(MARCH)
ifeq ($(OS),Darwin)
# on Darwin, the standalone `as` program doesn't know
# how to handle AVX instructions, but it does know how
# to dispatch to the clang assembler (if we ask it to)
ifeq ($(USECLANG),1)
CC += -integrated-as
CXX += -integrated-as
else
CC += -Wa,-q
CXX += -Wa,-q
endif
FC += -Wa,-q
AS += -q
endif
endif

JULIA_CPU_TARGET ?= native
# We map amd64 to x86_64 for compatibility with systems that identify 64-bit systems as such
Expand Down Expand Up @@ -651,13 +630,19 @@ else
ISX86:=0
endif
# If we are running on powerpc64 or ppc64, set certain options automatically
ifneq (,$(filter $(ARCH), powerpc64 ppc64le))
# If we are running on powerpc64le or ppc64le, set certain options automatically
ifneq (,$(filter $(ARCH), powerpc64le ppc64le))
JCFLAGS += -fsigned-char
override LLVM_VER:=3.8.1
override OPENBLAS_DYNAMIC_ARCH:=0
override OPENBLAS_TARGET_ARCH:=POWER8
# GCC doesn't do -march= on ppc64le
override MARCH=
endif

# If we are running on powerpc64 or ppc64, fail out dramatically
ifneq (,$(filter $(ARCH), powerpc64 ppc64))
$(error Big-endian PPC64 is not supported, to ignore this error, set ARCH=ppc64le)
endif

# If we are running on ARM, set certain options automatically
Expand All @@ -669,7 +654,28 @@ override USE_BLAS64:=0
override OPENBLAS_DYNAMIC_ARCH:=0
override OPENBLAS_TARGET_ARCH:=ARMV7
override USE_SYSTEM_LIBM:=1
endif

# Set MARCH-specific flags
ifneq ($(MARCH),)
CC += -march=$(MARCH)
CXX += -march=$(MARCH)
FC += -march=$(MARCH)
JULIA_CPU_TARGET ?= $(MARCH)
ifeq ($(OS),Darwin)
# on Darwin, the standalone `as` program doesn't know
# how to handle AVX instructions, but it does know how
# to dispatch to the clang assembler (if we ask it to)
ifeq ($(USECLANG),1)
CC += -integrated-as
CXX += -integrated-as
else
CC += -Wa,-q
CXX += -Wa,-q
endif
FC += -Wa,-q
AS += -q
endif
endif
# Set some ARCH-specific flags
Expand Down
5 changes: 2 additions & 3 deletions src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,15 @@ jl_get_ptls_states_func jl_get_ptls_states_getter(void)
// The general solution is to add one more indirection in the C entry point
// (see `jl_get_ptls_states_wrapper`).
//
// When `ifunc` is availabe, we can use it to trick the linker to use the
// When `ifunc` is available, we can use it to trick the linker to use the
// real address (`jl_get_ptls_states_static`) directly as the symbol address.
// (see `jl_get_ptls_states_resolve`).
//
// However, since the detection of the static version in `ifunc`
// is not guaranteed to be reliable, we still need to fallback to the wrapper
// version as the symbol address if we didn't find the static version in `ifunc`.
#if defined(__GLIBC__) && (defined(_CPU_X86_64_) || defined(_CPU_X86_) || \
((defined(_CPU_AARCH64_) || defined(_CPU_ARM_) || \
defined(_CPU_PPC64_) || defined(_CPU_PPC_)) && \
((defined(_CPU_AARCH64_) || defined(_CPU_ARM_)) && \
__GNUC__ >= 6))
// Only enable this on architectures that are tested.
// For example, GCC doesn't seem to support the `ifunc` attribute on power yet.
Expand Down

0 comments on commit fc17a98

Please sign in to comment.