6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
(for Serguei) Allow for Linux builds with Sun Studio Linux compilers Reviewed-by: sspitsyn, ohair
This commit is contained in:
parent
454bce8993
commit
2927815658
hotspot
agent/src/os/linux
build/linux
src
cpu/x86/vm
os/linux/vm
os_cpu/linux_x86/vm
share/vm/utilities
@ -518,10 +518,10 @@ static bool core_get_lwp_regs(struct ps_prochandle* ph, lwpid_t lwp_id,
|
||||
}
|
||||
|
||||
static ps_prochandle_ops core_ops = {
|
||||
release: core_release,
|
||||
p_pread: core_read_data,
|
||||
p_pwrite: core_write_data,
|
||||
get_lwp_regs: core_get_lwp_regs
|
||||
.release= core_release,
|
||||
.p_pread= core_read_data,
|
||||
.p_pwrite= core_write_data,
|
||||
.get_lwp_regs= core_get_lwp_regs
|
||||
};
|
||||
|
||||
// read regs and create thread from NT_PRSTATUS entries from core file
|
||||
|
@ -291,10 +291,10 @@ static void process_cleanup(struct ps_prochandle* ph) {
|
||||
}
|
||||
|
||||
static ps_prochandle_ops process_ops = {
|
||||
release: process_cleanup,
|
||||
p_pread: process_read_data,
|
||||
p_pwrite: process_write_data,
|
||||
get_lwp_regs: process_get_lwp_regs
|
||||
.release= process_cleanup,
|
||||
.p_pread= process_read_data,
|
||||
.p_pwrite= process_write_data,
|
||||
.get_lwp_regs= process_get_lwp_regs
|
||||
};
|
||||
|
||||
// attach to the process. One and only one exposed stuff
|
||||
|
@ -80,6 +80,11 @@ ifneq ("$(filter $(LP64_ARCH),$(BUILDARCH))","")
|
||||
MFLAGS += " LP64=1 "
|
||||
endif
|
||||
|
||||
# pass USE_SUNCC further, through MFLAGS
|
||||
ifdef USE_SUNCC
|
||||
MFLAGS += " USE_SUNCC=1 "
|
||||
endif
|
||||
|
||||
# The following renders pathnames in generated Makefiles valid on
|
||||
# machines other than the machine containing the build tree.
|
||||
#
|
||||
|
@ -35,6 +35,8 @@ CFLAGS += -DVM_LITTLE_ENDIAN
|
||||
CFLAGS += -D_LP64=1
|
||||
|
||||
# The serviceability agent relies on frame pointer (%rbp) to walk thread stack
|
||||
CFLAGS += -fno-omit-frame-pointer
|
||||
ifndef USE_SUNCC
|
||||
CFLAGS += -fno-omit-frame-pointer
|
||||
endif
|
||||
|
||||
OPT_CFLAGS/compactingPermGenGen.o = -O1
|
||||
|
@ -63,7 +63,11 @@ QUIETLY$(MAKE_VERBOSE) = @
|
||||
# For now, until the compiler is less wobbly:
|
||||
TESTFLAGS = -Xbatch -showversion
|
||||
|
||||
PLATFORM_FILE = $(GAMMADIR)/build/$(OS_FAMILY)/platform_$(BUILDARCH)
|
||||
ifdef USE_SUNCC
|
||||
PLATFORM_FILE = $(GAMMADIR)/build/$(OS_FAMILY)/platform_$(BUILDARCH).suncc
|
||||
else
|
||||
PLATFORM_FILE = $(GAMMADIR)/build/$(OS_FAMILY)/platform_$(BUILDARCH)
|
||||
endif
|
||||
|
||||
ifdef FORCE_TIERED
|
||||
ifeq ($(VARIANT),tiered)
|
||||
|
93
hotspot/build/linux/makefiles/sparcWorks.make
Normal file
93
hotspot/build/linux/makefiles/sparcWorks.make
Normal file
@ -0,0 +1,93 @@
|
||||
#
|
||||
# Copyright 1999-2007 Sun Microsystems, Inc. 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
|
||||
# under the terms of the GNU General Public License version 2 only, as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
# CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
# have any questions.
|
||||
#
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# CC, CPP & AS
|
||||
|
||||
CPP = CC
|
||||
CC = cc
|
||||
AS = $(CC) -c
|
||||
|
||||
ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
|
||||
ARCHFLAG/i486 = -m32
|
||||
ARCHFLAG/amd64 = -m64
|
||||
|
||||
CFLAGS += $(ARCHFLAG)
|
||||
AOUT_FLAGS += $(ARCHFLAG)
|
||||
LFLAGS += $(ARCHFLAG)
|
||||
ASFLAGS += $(ARCHFLAG)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Compiler flags
|
||||
|
||||
# position-independent code
|
||||
PICFLAG = -KPIC
|
||||
|
||||
CFLAGS += $(PICFLAG)
|
||||
# no more exceptions
|
||||
CFLAGS += -features=no%except
|
||||
# Reduce code bloat by reverting back to 5.0 behavior for static initializers
|
||||
CFLAGS += -features=no%split_init
|
||||
# allow zero sized arrays
|
||||
CFLAGS += -features=zla
|
||||
|
||||
# Use C++ Interpreter
|
||||
ifdef CC_INTERP
|
||||
CFLAGS += -DCC_INTERP
|
||||
endif
|
||||
|
||||
# We don't need libCstd.so and librwtools7.so, only libCrun.so
|
||||
CFLAGS += -library=Crun
|
||||
LIBS += -lCrun
|
||||
|
||||
CFLAGS += -mt
|
||||
LFLAGS += -mt
|
||||
|
||||
# Compiler warnings are treated as errors
|
||||
#WARNINGS_ARE_ERRORS = -errwarn=%all
|
||||
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS)
|
||||
# Special cases
|
||||
CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@))
|
||||
|
||||
# The flags to use for an Optimized build
|
||||
OPT_CFLAGS+=-xO4
|
||||
OPT_CFLAGS/NOOPT=-xO0
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Linker flags
|
||||
|
||||
# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
|
||||
MAPFLAG = -Wl,--version-script=FILENAME
|
||||
|
||||
# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj
|
||||
SONAMEFLAG = -h SONAME
|
||||
|
||||
# Build shared library
|
||||
SHARED_FLAG = -G
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Debug flags
|
||||
DEBUG_CFLAGS += -g
|
||||
FASTDEBUG_CFLAGS = -g0
|
||||
|
17
hotspot/build/linux/platform_amd64.suncc
Normal file
17
hotspot/build/linux/platform_amd64.suncc
Normal file
@ -0,0 +1,17 @@
|
||||
os_family = linux
|
||||
|
||||
arch = x86
|
||||
|
||||
arch_model = x86_64
|
||||
|
||||
os_arch = linux_x86
|
||||
|
||||
os_arch_model = linux_x86_64
|
||||
|
||||
lib_arch = amd64
|
||||
|
||||
compiler = sparcWorks
|
||||
|
||||
gnu_dis_arch = amd64
|
||||
|
||||
sysdefs = -DLINUX -DSPARC_WORKS -D_GNU_SOURCE -DAMD64
|
17
hotspot/build/linux/platform_i486.suncc
Normal file
17
hotspot/build/linux/platform_i486.suncc
Normal file
@ -0,0 +1,17 @@
|
||||
os_family = linux
|
||||
|
||||
arch = x86
|
||||
|
||||
arch_model = x86_32
|
||||
|
||||
os_arch = linux_x86
|
||||
|
||||
os_arch_model = linux_x86_32
|
||||
|
||||
lib_arch = i386
|
||||
|
||||
compiler = sparcWorks
|
||||
|
||||
gnu_dis_arch = i386
|
||||
|
||||
sysdefs = -DLINUX -DSPARC_WORKS -D_GNU_SOURCE -DIA32
|
@ -1304,7 +1304,7 @@ void Assembler::movl(Address dst, Register src) {
|
||||
emit_operand(src, dst);
|
||||
}
|
||||
|
||||
void Assembler::mov64(Register dst, int64_t imm64) {
|
||||
void Assembler::mov64(Register dst, intptr_t imm64) {
|
||||
InstructionMark im(this);
|
||||
int encode = prefixq_and_encode(dst->encoding());
|
||||
emit_byte(0xB8 | encode);
|
||||
@ -1331,7 +1331,7 @@ void Assembler::movq(Register dst, Address src) {
|
||||
emit_operand(dst, src);
|
||||
}
|
||||
|
||||
void Assembler::mov64(Address dst, int64_t imm32) {
|
||||
void Assembler::mov64(Address dst, intptr_t imm32) {
|
||||
assert(is_simm32(imm32), "lost bits");
|
||||
InstructionMark im(this);
|
||||
prefixq(dst);
|
||||
|
@ -232,7 +232,7 @@ LinuxAttachOperation* LinuxAttachListener::read_request(int s) {
|
||||
// where <ver> is the protocol version (1), <cmd> is the command
|
||||
// name ("load", "datadump", ...), and <arg> is an argument
|
||||
int expected_str_count = 2 + AttachOperation::arg_count_max;
|
||||
int max_len = (strlen(ver_str) + 1) + (AttachOperation::name_length_max + 1) +
|
||||
const int max_len = (sizeof(ver_str) + 1) + (AttachOperation::name_length_max + 1) +
|
||||
AttachOperation::arg_count_max*(AttachOperation::arg_length_max + 1);
|
||||
|
||||
char buf[max_len];
|
||||
|
@ -60,7 +60,18 @@ inline u4 Bytes::swap_u4(u4 x) {
|
||||
|
||||
#ifdef AMD64
|
||||
inline u8 Bytes::swap_u8(u8 x) {
|
||||
#ifdef SPARC_WORKS
|
||||
// workaround for SunStudio12 CR6615391
|
||||
__asm__ __volatile__ (
|
||||
"bswapq %0"
|
||||
:"=r" (x) // output : register 0 => x
|
||||
:"0" (x) // input : x => register 0
|
||||
:"0" // clobbered register
|
||||
);
|
||||
return x;
|
||||
#else
|
||||
return bswap_64(x);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
// Helper function for swap_u8
|
||||
|
@ -62,8 +62,14 @@
|
||||
#endif // AMD64
|
||||
|
||||
address os::current_stack_pointer() {
|
||||
#ifdef SPARC_WORKS
|
||||
register void *esp;
|
||||
__asm__("mov %%"SPELL_REG_SP", %0":"=r"(esp));
|
||||
return (address) ((char*)esp + sizeof(long)*2);
|
||||
#else
|
||||
register void *esp __asm__ (SPELL_REG_SP);
|
||||
return (address) esp;
|
||||
#endif
|
||||
}
|
||||
|
||||
char* os::non_memory_address_word() {
|
||||
@ -139,7 +145,12 @@ frame os::get_sender_for_C_frame(frame* fr) {
|
||||
}
|
||||
|
||||
intptr_t* _get_previous_fp() {
|
||||
#ifdef SPARC_WORKS
|
||||
register intptr_t **ebp;
|
||||
__asm__("mov %%"SPELL_REG_FP", %0":"=r"(ebp));
|
||||
#else
|
||||
register intptr_t **ebp __asm__ (SPELL_REG_FP);
|
||||
#endif
|
||||
return (intptr_t*) *ebp; // we want what it points to.
|
||||
}
|
||||
|
||||
@ -575,7 +586,9 @@ bool os::Linux::supports_variable_stack_size() { return true; }
|
||||
#else
|
||||
size_t os::Linux::min_stack_allowed = (48 DEBUG_ONLY(+4))*K;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;})
|
||||
#endif
|
||||
|
||||
// Test if pthread library can support variable thread stack size. LinuxThreads
|
||||
// in fixed stack mode allocates 2M fixed slot for each thread. LinuxThreads
|
||||
@ -606,7 +619,11 @@ bool os::Linux::supports_variable_stack_size() {
|
||||
// return true and skip _thread_safety_check(), so we may not be able to
|
||||
// detect stack-heap collisions. But otherwise it's harmless.
|
||||
//
|
||||
#ifdef __GNUC__
|
||||
return (GET_GS() != 0);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif // AMD64
|
||||
|
@ -37,23 +37,45 @@
|
||||
# include <stdlib.h>
|
||||
# include <wchar.h>
|
||||
# include <stdarg.h>
|
||||
#ifdef SOLARIS
|
||||
# include <ieeefp.h>
|
||||
#endif
|
||||
# include <math.h>
|
||||
#ifdef LINUX
|
||||
#ifndef FP_PZERO
|
||||
// Linux doesn't have positive/negative zero
|
||||
#define FP_PZERO FP_ZERO
|
||||
#endif
|
||||
#ifndef fpclass
|
||||
#define fpclass fpclassify
|
||||
#endif
|
||||
#endif
|
||||
# include <time.h>
|
||||
# include <fcntl.h>
|
||||
# include <dlfcn.h>
|
||||
# include <pthread.h>
|
||||
#ifdef SOLARIS
|
||||
# include <thread.h>
|
||||
#endif
|
||||
# include <limits.h>
|
||||
# include <errno.h>
|
||||
#ifdef SOLARIS
|
||||
# include <sys/trap.h>
|
||||
# include <sys/regset.h>
|
||||
# include <sys/procset.h>
|
||||
# include <ucontext.h>
|
||||
# include <setjmp.h>
|
||||
#endif
|
||||
# ifdef SOLARIS_MUTATOR_LIBTHREAD
|
||||
# include <sys/procfs.h>
|
||||
# endif
|
||||
#ifdef LINUX
|
||||
# include <inttypes.h>
|
||||
# include <signal.h>
|
||||
# include <ucontext.h>
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
||||
// 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
|
||||
// When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
|
||||
@ -68,6 +90,11 @@
|
||||
// pointer when it extracts the argument, then we have a problem.
|
||||
//
|
||||
// Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
|
||||
//
|
||||
// Note: this fix doesn't work well on Linux because NULL will be overwritten
|
||||
// whenever a system header file is included. Linux handles NULL correctly
|
||||
// through a special type '__null'.
|
||||
#ifdef SOLARIS
|
||||
#ifdef _LP64
|
||||
#undef NULL
|
||||
#define NULL 0L
|
||||
@ -76,13 +103,25 @@
|
||||
#define NULL 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// NULL vs NULL_WORD:
|
||||
// On Linux NULL is defined as a special type '__null'. Assigning __null to
|
||||
// integer variable will cause gcc warning. Use NULL_WORD in places where a
|
||||
// pointer is stored as integer value.
|
||||
#define NULL_WORD NULL
|
||||
// pointer is stored as integer value. On some platforms, sizeof(intptr_t) >
|
||||
// sizeof(void*), so here we want something which is integer type, but has the
|
||||
// same size as a pointer.
|
||||
#ifdef LINUX
|
||||
#ifdef _LP64
|
||||
#define NULL_WORD 0L
|
||||
#else
|
||||
#define NULL_WORD 0
|
||||
#endif
|
||||
#else
|
||||
#define NULL_WORD NULL
|
||||
#endif
|
||||
|
||||
#ifndef LINUX
|
||||
// Compiler-specific primitive types
|
||||
typedef unsigned short uint16_t;
|
||||
#ifndef _UINT32_T
|
||||
@ -100,6 +139,7 @@ typedef unsigned int uintptr_t;
|
||||
// If this gets an error, figure out a symbol XXX that implies the
|
||||
// prior definition of intptr_t, and add "&& !defined(XXX)" above.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Additional Java basic types
|
||||
|
||||
@ -128,7 +168,7 @@ inline jdouble jdouble_cast(jlong x) { return *(jdouble*)&x; }
|
||||
const jlong min_jlong = CONST64(0x8000000000000000);
|
||||
const jlong max_jlong = CONST64(0x7fffffffffffffff);
|
||||
|
||||
|
||||
#ifdef SOLARIS
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// ANSI C++ fixes
|
||||
// NOTE:In the ANSI committee's continuing attempt to make each version
|
||||
@ -162,7 +202,7 @@ extern "C" {
|
||||
typedef int (*int_fnP_cond_tP_i_vP)(cond_t *cv, int scope, void *arg);
|
||||
typedef int (*int_fnP_cond_tP)(cond_t *cv);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Debugging
|
||||
@ -173,7 +213,7 @@ extern "C" void breakpoint();
|
||||
#define BREAKPOINT ::breakpoint()
|
||||
|
||||
// checking for nanness
|
||||
|
||||
#ifdef SOLARIS
|
||||
#ifdef SPARC
|
||||
inline int g_isnan(float f) { return isnanf(f); }
|
||||
#else
|
||||
@ -182,6 +222,12 @@ inline int g_isnan(float f) { return isnand(f); }
|
||||
#endif
|
||||
|
||||
inline int g_isnan(double f) { return isnand(f); }
|
||||
#elif LINUX
|
||||
inline int g_isnan(float f) { return isnanf(f); }
|
||||
inline int g_isnan(double f) { return isnan(f); }
|
||||
#else
|
||||
#error "missing platform-specific definition here"
|
||||
#endif
|
||||
|
||||
// Checking for finiteness
|
||||
|
||||
@ -195,9 +241,11 @@ inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
|
||||
|
||||
|
||||
// Misc
|
||||
// NOTE: This one leads to an infinite recursion on Linux
|
||||
#ifndef LINUX
|
||||
int local_vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr);
|
||||
#define vsnprintf local_vsnprintf
|
||||
|
||||
#endif
|
||||
|
||||
// Portability macros
|
||||
#define PRAGMA_INTERFACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user