OpenJDK7 port to the little endian PowerPC64

Volker Simonis volker.simonis at
Fri Mar 7 09:01:41 PST 2014

Hi Sasha,

sorry for the delay. I finally looked at your change and have a few


I don't quite like the fact that we really have to define a new
BUILDARCH/LIBARCH for little endian which also requires new makefiles like
'ppc64le.make' and 'platform_ppc64le'.

The latter is equal to 'platform_ppc64', so there's no problem if we have
just 'ppc64' as BUILDARCH.

For 'ppc64le.make' I think we could easily handle the differences right in

So I suggest you define "PPC64_ENDIANNESS" as "little" or "big" in
make/defs.make, depending on the actual "ARCH" value. Later on, you can use
"PPC64_ENDIANNESS" in 'ppc64.make' for the settings which are different for
little and big endian builds. You may have noticed that in the jdk9 forest,
'ppc64.make' is considerably smaller. So with your changes included it may
look as simple as:

# make c code know it is on a 64 bit platform.
CFLAGS += -D_LP64=1

ifeq ($(PPC64_ENDIANNESS), little)
  #PPC64 LE uses ELFv2 ABI

ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4
\) \& \( $(CC_VER_MINOR) \>= 7 \) \))" "0"
  # fixes `relocation truncated to fit' error for older versions of gcc
(i.e. 4.1.2)
  CFLAGS += -mminimal-toc

# use ppc64 instructions, but schedule for power5
CFLAGS += -mcpu=powerpc64 -mtune=power5 -minsert-sched-nops=regroup_exact
-mno-multiple -mno-string

Regarding '-mminimal-toc' - this option is needed for older versions of
GCC, otherwise you'll get "relocation truncated to fit" errors during
linking. I've checked that the option is not required any more with GCC
4.7. It may be that it already works with GCC before 4.7 but I didn't test,
so to be on the safe side, I'll suggest to enable the option for all GCC
versions smaller than 4.7.

I also checked that the two LFLAGS_VM settings aren't needed any more, so
you can remove the lines:

-# let linker find external 64 bit libs.
-LFLAGS_VM += -L/lib64
-# specify lib format.
-LFLAGS_VM +=  -Wl,-melf64ppc

from ppc64.make.

Regarding "-mtune=power7" I'm not sure. Are you absolutely sure that all
ppc64le distros will only ever run on Power7 and above? If yes, you could
put the "-mtune=power7" flag into the PPC64_ENDIANNESS=little section and
move the "-mtune=power5" flag into the else branch.

If done this way, you will also not need the changes in
"make/linux/makefiles/gcc.make" and "make/linux/makefiles/defs.make".


I don't think we need a special new file (bytes_linux_ppc.inline.hpp) here.
I think better include "byteswap.h" at the top of "bytes_ppc.hpp" and just
call the bswap_XX functions directly instead of using the 'swap_XX'

 150   static inline u2   get_Java_u2(address p) { return
bswap_16(get_native_u2(p)); }
 151   static inline u4   get_Java_u4(address p) { return
bswap_32(get_native_u4(p)); }
 152   static inline u8   get_Java_u8(address p) { return
bswap_64(get_native_u8(p)); }
 154   static inline void put_Java_u2(address p, u2 x)     {
put_native_u2(p, bswap_16(x)); }
 155   static inline void put_Java_u4(address p, u4 x)     {
put_native_u4(p, bswap_32(x)); }
 156   static inline void put_Java_u8(address p, u8 x)     {
put_native_u8(p, bswap_64(x)); }

Once you send the new webrev, I'll test that it still works with our big
endian build and we can than push it to jdk9. Once it is in there, we can
easily integrate the changes intou our own

Thank you and best regards,

On Fri, Mar 7, 2014 at 4:24 AM, Alexander Smundak <asmundak at>wrote:

> On Thu, Mar 6, 2014 at 5:20 AM, Lindenmaier, Goetz
> <goetz.lindenmaier at> wrote:
> > defines the wrong macro.
> Done.
> > Also you need to add a copyright header.
> Done.
> > You need to protect #include "bytes_linux_ppc.inline.hpp"
> > in bytes_ppc.hpp by #ifdef TARGET_OS_ARCH_linux_ppc, else it breaks the
> > aix build.
> Done
> > The comment above  get_Java_u2 is misleading, I guess ;)
> Done.
> > os_linux.cpp does not build on non-ppc platforms because
> > is not defined.
> Done.
> I have discovered that a one-line change to the libproc.h is needed,
> and the compiler settings for the little-endian PPC64 in ppc64le.make
> can be adjusted:
> it can be tuned for Power7, and there is no need for -mminimal-toc.
> > Can you please send a RFR to the hotspot-dev list as you did for the
> other
> > change?
> Will send it the moment my colleague with account at cr.openjdk posts
> the webrev.
> Thank you for the comments.
> I have two additional patches ready for review, one for the jdk/ subrepo
> and another for the top-level. What's the procedure there? Can I
> reuse the same bug 8036767 for this? Where should I post RFRs?
> Sasha
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the ppc-aix-port-dev mailing list