8019926: PPC64 (part 106): Make hsdis build and work on Linux/PPC64
Summary: Make hsdis work on Linux/PPC64 and AIX/PPC64
Reviewed-by: kvn
--- a/hotspot/src/share/tools/hsdis/Makefile Fri Jul 19 13:32:53 2013 -0700
+++ b/hotspot/src/share/tools/hsdis/Makefile Fri Jul 26 10:12:15 2013 +0200
@@ -27,6 +27,7 @@
# Default arch; it is changed below as needed.
ARCH = i386
OS = $(shell uname)
+AR = ar
## OS = SunOS ##
ifeq ($(OS),SunOS)
@@ -73,6 +74,7 @@
ifdef LP64
CFLAGS/sparcv9 += -m64
CFLAGS/amd64 += -m64
+CFLAGS/ppc64 += -m64
else
ARCH=$(ARCH1:amd64=i386)
CFLAGS/i386 += -m32
@@ -88,8 +90,20 @@
DLDFLAGS += -shared
LDFLAGS += -ldl
OUTFLAGS += -o $@
-## OS = Windows ##
-else # !SunOS, !Linux => Darwin or Windows
+else
+## OS = AIX ##
+ifeq ($(OS),AIX)
+OS = aix
+ARCH = ppc64
+CC = xlc_r
+CFLAGS += -DAIX -g -qpic=large -q64
+CFLAGS/ppc64 += -q64
+AR = ar -X64
+DLDFLAGS += -qmkshrobj -lz
+OUTFLAGS += -o $@
+LIB_EXT = .so
+else
+## OS = Darwin ##
ifeq ($(OS),Darwin)
CPU = $(shell uname -m)
ARCH1=$(CPU:x86_64=amd64)
@@ -113,7 +127,8 @@
DLDFLAGS += -lz
LDFLAGS += -ldl
OUTFLAGS += -o $@
-else #Windows
+else
+## OS = Windows ##
OS = windows
CC = gcc
CFLAGS += /nologo /MD /W3 /WX /O2 /Fo$(@:.dll=.obj) /Gi-
@@ -123,6 +138,7 @@
OUTFLAGS += /link /out:$@
LIB_EXT = .dll
endif # Darwin
+endif # AIX
endif # Linux
endif # SunOS
@@ -176,7 +192,7 @@
if [ ! -f $@ ]; then cd $(TARGET_DIR); make all-opcodes; fi
$(TARGET_DIR)/Makefile:
- (cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
+ (cd $(TARGET_DIR); CC=$(CC) CFLAGS="$(CFLAGS)" AR="$(AR)" $(BINUTILSDIR)/configure --disable-nls $(CONFIGURE_ARGS))
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
--- a/hotspot/src/share/tools/hsdis/README Fri Jul 19 13:32:53 2013 -0700
+++ b/hotspot/src/share/tools/hsdis/README Fri Jul 26 10:12:15 2013 +0200
@@ -1,4 +1,4 @@
-Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,17 @@
disassembler library only. If you build demo it will build a demo
program that attempts to exercise the library.
+With recent version of binutils (i.e. binutils-2.23.2) you may get the
+following build error:
+
+WARNING: `makeinfo' is missing on your system. You should only need it if
+ you modified a `.texi' or `.texinfo' file, or any other file
+ ...
+
+This is because of "Bug 15345 - binutils-2.23.2 tarball doesn't build
+without makeinfo" [2]. The easiest way to work around this problem is
+by doing a "touch $BINUTILS/bfd/doc/bfd.info".
+
Windows
In theory this should be buildable on Windows but getting a working
@@ -101,3 +112,13 @@
If the product mode of the JVM does not accept -XX:+PrintAssembly,
you do not have a version new enough to use the hsdis plugin.
+
+* Wiki
+
+More information can be found in the OpenJDK HotSpot Wiki [1].
+
+
+Resources:
+
+[1] https://wiki.openjdk.java.net/display/HotSpot/PrintAssembly
+[2] http://sourceware.org/bugzilla/show_bug.cgi?id=15345
--- a/hotspot/src/share/tools/hsdis/hsdis.c Fri Jul 19 13:32:53 2013 -0700
+++ b/hotspot/src/share/tools/hsdis/hsdis.c Fri Jul 26 10:12:15 2013 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -307,7 +307,8 @@
app_data->printf_stream,
app_data->printf_callback,
native_bfd,
- app_data->insn_options);
+ /* On PowerPC we get warnings, if we pass empty options */
+ (caller_options == NULL) ? NULL : app_data->insn_options);
/* Finish linking together the various callback blocks. */
app_data->dinfo.application_data = (void*) app_data;
@@ -459,6 +460,9 @@
#ifdef LIBARCH_sparcv9
res = "sparc:v9b";
#endif
+#ifdef LIBARCH_ppc64
+ res = "powerpc:common64";
+#endif
if (res == NULL)
res = "architecture not set in Makefile!";
return res;