1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-05 06:27:37 +00:00

- Honor CC, CXX, and CPP. [1]

- Fix build with clang.

PR:	ports/151042 [1]
This commit is contained in:
Jung-uk Kim 2012-09-18 20:53:20 +00:00
parent 8971137cc7
commit 17f28ea268
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=304460
2 changed files with 124 additions and 37 deletions

View File

@ -137,11 +137,18 @@ MAKE_ENV= LANG=C LC_ALL=C \
MILESTONE=fcs \
JDK_UPDATE_VERSION=${UPDATE_VERSION}
# HotSpot wants CCC instead of CXX.
MAKE_ENV+= CCC="${CXX}"
# XXX Turn off -Werror from HotSpot.
MAKE_ENV+= WARNINGS_ARE_ERRORS="${WARNINGS_ARE_ERRORS}"
.if ${PORT_OPTIONS:MDEBUG}
ALL_TARGET= debug_build
OPENJDK_OSARCH= bsd-${ARCH:S/i386/i586/}-debug
.else
OPENJDK_OSARCH= bsd-${ARCH:S/i386/i586/}
WARNINGS_ARE_ERRORS?= -w
.endif
# disable FASTDEBUG_BUILD by default to improve compile time.

View File

@ -201,17 +201,17 @@
ifeq ($(VARIANT), OPT)
# OPT build MUST have a mapfile?
--- corba/make/common/shared/Compiler-gcc.gmk 2011-07-05 14:29:22.000000000 -0400
+++ corba/make/common/shared/Compiler-gcc.gmk 2011-07-07 19:17:02.000000000 -0400
--- corba/make/common/shared/Compiler-gcc.gmk 2012-05-01 17:14:04.000000000 -0400
+++ corba/make/common/shared/Compiler-gcc.gmk 2012-09-11 18:17:45.000000000 -0400
@@ -100,6 +100,24 @@
endif
+ifeq ($(PLATFORM), bsd)
+ # Settings specific to BSD
+ CC = $(COMPILER_PATH)gcc
+ CPP = $(COMPILER_PATH)gcc -E
+ CXX = $(COMPILER_PATH)g++
+ CC ?= $(COMPILER_PATH)gcc
+ CPP ?= $(COMPILER_PATH)gcc -E
+ CXX ?= $(COMPILER_PATH)g++
+ REQUIRED_CC_VER = 3.3
+ REQUIRED_GCC_VER = 3.3.*
+
@ -3021,6 +3021,18 @@
OS_VERSION := $(shell uname -r)
EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION))
--- hotspot/make/bsd/makefiles/adlc.make 2012-05-01 17:15:06.000000000 -0400
+++ hotspot/make/bsd/makefiles/adlc.make 2012-09-17 19:50:44.000000000 -0400
@@ -60,7 +60,8 @@
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
# Compiler warnings are treated as errors
-CFLAGS_WARN = -Werror
+WARNINGS_ARE_ERRORS ?= -Werror
+CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)
CFLAGS += $(CFLAGS_WARN)
OBJECTNAMES = \
--- hotspot/make/bsd/makefiles/buildtree.make 2011-07-07 19:16:00.000000000 -0400
+++ hotspot/make/bsd/makefiles/buildtree.make 2011-07-07 19:17:02.000000000 -0400
@@ -303,10 +303,11 @@
@ -3155,8 +3167,8 @@
EXPORT_LIST += $(ADD_SA_BINARIES/$(HS_ARCH))
-
-
--- hotspot/make/bsd/makefiles/gcc.make 2011-07-07 19:16:00.000000000 -0400
+++ hotspot/make/bsd/makefiles/gcc.make 2011-07-07 19:17:02.000000000 -0400
--- hotspot/make/bsd/makefiles/gcc.make 2012-05-01 17:15:06.000000000 -0400
+++ hotspot/make/bsd/makefiles/gcc.make 2012-09-18 11:31:25.000000000 -0400
@@ -22,20 +22,24 @@
#
#
@ -3210,6 +3222,15 @@
endif
CFLAGS += $(ARCHFLAG)
@@ -115,7 +121,7 @@
endif
# Compiler warnings are treated as errors
-WARNINGS_ARE_ERRORS = -Werror
+WARNINGS_ARE_ERRORS ?= -Werror
# Except for a few acceptable ones
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
@@ -130,6 +136,11 @@
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
# Special cases
@ -6013,8 +6034,8 @@
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
--- hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s 2011-07-07 19:15:59.000000000 -0400
+++ hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s 2011-07-11 10:45:37.000000000 -0400
--- hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s 2012-05-01 17:15:08.000000000 -0400
+++ hotspot/src/os_cpu/bsd_x86/vm/bsd_x86_32.s 2012-09-18 13:13:53.000000000 -0400
@@ -21,6 +21,17 @@
# questions.
#
@ -6138,6 +6159,15 @@
pushl %esi
movl 4+12(%esp),%ecx # count
pushl %edi
@@ -241,7 +272,7 @@
jbe 2f # <= 32 dwords
rep; smovl
jmp 4f
- .=.+8
+ .skip 8
2: subl %esi,%edi
.p2align 4,,15
3: movl (%esi),%edx
@@ -269,8 +300,8 @@
# void* to,
# size_t count)
@ -6160,6 +6190,15 @@
pushl %esi
movl 4+12(%esp),%ecx # count
pushl %edi
@@ -378,7 +409,7 @@
rep; smovl
jmp 4f
# copy aligned dwords
- .=.+5
+ .skip 5
2: subl %esi,%edi
.p2align 4,,15
3: movl (%esi),%edx
@@ -433,10 +464,10 @@
# Equivalent to
# arrayof_conjoint_jints
@ -6175,6 +6214,15 @@
pushl %esi
movl 4+12(%esp),%ecx # count
pushl %edi
@@ -454,7 +485,7 @@
popl %edi
popl %esi
ret
- .=.+10
+ .skip 10
2: subl %esi,%edi
jmp 4f
.p2align 4,,15
@@ -498,7 +529,7 @@
#
# count treated as signed
@ -6442,9 +6490,9 @@
// Only used on 64 bit Windows platforms
define_pd_global(bool, UseVectoredExceptions, false);
--- hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2011-07-07 19:15:59.000000000 -0400
+++ hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2011-07-07 19:17:02.000000000 -0400
@@ -78,23 +78,202 @@
--- hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2012-05-01 17:15:08.000000000 -0400
+++ hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2012-09-18 14:48:04.000000000 -0400
@@ -78,25 +78,209 @@
# include <sys/wait.h>
# include <pwd.h>
# include <poll.h>
@ -6652,9 +6700,17 @@
+#endif
+
address os::current_stack_pointer() {
#ifdef SPARC_WORKS
-#ifdef SPARC_WORKS
+#if defined(__clang__)
+ register void *esp;
+ // XXX must be compiled with -O1 or above.
+ __asm__ volatile("mov %%" SPELL_REG_SP ", %0" : "=r"(esp));
+ return (address) esp;
+#elif defined(SPARC_WORKS)
register void *esp;
@@ -119,15 +298,15 @@
__asm__("mov %%"SPELL_REG_SP", %0":"=r"(esp));
return (address) ((char*)esp + sizeof(long)*2);
@@ -119,15 +303,15 @@
}
address os::Bsd::ucontext_get_pc(ucontext_t * uc) {
@ -6673,7 +6729,20 @@
}
// For Forte Analyzer AsyncGetCallTrace profiling support - thread
@@ -279,18 +458,18 @@
@@ -179,7 +363,11 @@
}
intptr_t* _get_previous_fp() {
-#ifdef SPARC_WORKS
+#if defined(__clang__)
+ register intptr_t **ebp;
+ // XXX must be compiled with -O1 or above.
+ __asm__ volatile("mov %%" SPELL_REG_FP ", %0" : "=r"(ebp));
+#elif defined(SPARC_WORKS)
register intptr_t **ebp;
__asm__("mov %%"SPELL_REG_FP", %0":"=r"(ebp));
#else
@@ -279,18 +467,18 @@
pc = (address) os::Bsd::ucontext_get_pc(uc);
if (pc == (address) Fetch32PFI) {
@ -6695,7 +6764,7 @@
address addr = (address) info->si_addr;
// check if fault address is within thread stack
@@ -312,6 +491,7 @@
@@ -312,6 +500,7 @@
// to handle_unexpected_exception way down below.
thread->disable_stack_red_zone();
tty->print_raw_cr("An irrecoverable stack overflow has occurred.");
@ -6703,7 +6772,7 @@
} else {
// Accessing stack address below sp may cause SEGV if current
// thread has MAP_GROWSDOWN stack. This should only happen when
@@ -327,6 +507,7 @@
@@ -327,6 +516,7 @@
} else {
fatal("recursive segv. expanding stack.");
}
@ -6711,7 +6780,7 @@
}
}
}
@@ -335,9 +516,16 @@
@@ -335,9 +525,16 @@
// Java thread running in Java code => find exception handler if any
// a fault inside compiled code, the interpreter, or a stub
@ -6729,7 +6798,7 @@
// BugId 4454115: A read from a MappedByteBuffer can fault
// here if the underlying file has been truncated.
// Do not crash the VM in such a case.
@@ -358,6 +546,28 @@
@@ -358,6 +555,28 @@
pc,
SharedRuntime::
IMPLICIT_DIVIDE_BY_ZERO);
@ -6758,7 +6827,7 @@
#else
if (sig == SIGFPE /* && info->si_code == FPE_INTDIV */) {
// HACK: si_code does not work on bsd 2.2.12-20!!!
@@ -385,7 +595,7 @@
@@ -385,7 +604,7 @@
fatal("please update this code.");
}
#endif // AMD64
@ -6767,7 +6836,7 @@
!MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
// Determination of interpreter/vtable stub/compiled code null exception
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
@@ -409,7 +619,7 @@
@@ -409,7 +628,7 @@
// process of write protecting the memory serialization page.
// It write enables the page immediately after protecting it
// so we can just return to retry the write.
@ -6776,7 +6845,7 @@
os::is_memory_serialize_page(thread, (address) info->si_addr)) {
// Block current thread until the memory serialize page permission restored.
os::block_on_serialize_page_trap();
@@ -430,7 +640,7 @@
@@ -430,7 +649,7 @@
// Furthermore, a false-positive should be harmless.
if (UnguardOnExecutionViolation > 0 &&
(sig == SIGSEGV || sig == SIGBUS) &&
@ -6785,7 +6854,7 @@
int page_size = os::vm_page_size();
address addr = (address) info->si_addr;
address pc = os::Bsd::ucontext_get_pc(uc);
@@ -500,7 +710,7 @@
@@ -500,7 +719,7 @@
// save all thread context in case we need to restore it
if (thread != NULL) thread->set_saved_exception_pc(pc);
@ -6794,7 +6863,7 @@
return true;
}
@@ -530,13 +740,24 @@
@@ -530,13 +749,24 @@
ShouldNotReachHere();
}
@ -6819,7 +6888,7 @@
int os::Bsd::get_fpu_control_word(void) {
#ifdef AMD64
return 0;
@@ -552,11 +773,12 @@
@@ -552,11 +782,12 @@
_FPU_SETCW(fpu_control);
#endif // !AMD64
}
@ -6833,7 +6902,7 @@
return true;
#else
struct utsname uts;
@@ -610,6 +832,9 @@
@@ -610,6 +841,9 @@
#define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;})
#endif
@ -6843,7 +6912,7 @@
// Test if pthread library can support variable thread stack size. BsdThreads
// in fixed stack mode allocates 2M fixed slot for each thread. BsdThreads
// in floating stack mode and NPTL support variable stack size.
@@ -632,7 +857,7 @@
@@ -632,7 +866,7 @@
//
// Note that %gs is a reserved glibc register since early 2001, so
// applications are not allowed to change its value (Ulrich Drepper from
@ -6852,7 +6921,7 @@
// either %fs or TSD). In the worst case scenario, when VM is embedded in
// a native application that plays with %gs, we might see non-zero %gs
// even BsdThreads is running in fixed stack mode. As the result, we'll
@@ -646,6 +871,7 @@
@@ -646,6 +880,7 @@
#endif
}
}
@ -6860,7 +6929,7 @@
#endif // AMD64
// return default stack size for thr_type
@@ -699,6 +925,41 @@
@@ -699,6 +934,41 @@
// pthread_attr_getstack()
static void current_stack_region(address * bottom, size_t * size) {
@ -6902,7 +6971,7 @@
if (os::Bsd::is_initial_thread()) {
// initial thread needs special handling because pthread_getattr_np()
// may return bogus value.
@@ -725,6 +986,7 @@
@@ -725,6 +995,7 @@
pthread_attr_destroy(&attr);
}
@ -6910,7 +6979,7 @@
assert(os::current_stack_pointer() >= *bottom &&
os::current_stack_pointer() < *bottom + *size, "just checking");
}
@@ -753,46 +1015,44 @@
@@ -753,46 +1024,44 @@
ucontext_t *uc = (ucontext_t*)context;
st->print_cr("Registers:");
#ifdef AMD64
@ -6995,7 +7064,7 @@
#endif // AMD64
st->cr();
st->cr();
@@ -825,31 +1085,31 @@
@@ -825,31 +1094,31 @@
// this is only for the "general purpose" registers
#ifdef AMD64
@ -8385,6 +8454,17 @@
#ifdef ASSERT
void GenericGrowableArray::set_nesting() {
if (on_stack()) {
--- hotspot/src/share/vm/utilities/hashtable.hpp 2012-05-01 17:15:14.000000000 -0400
+++ hotspot/src/share/vm/utilities/hashtable.hpp 2012-09-18 12:01:50.000000000 -0400
@@ -283,7 +283,7 @@
}
int index_for(symbolHandle name, Handle loader) {
- return hash_to_index(compute_hash(name, loader));
+ return this->hash_to_index(compute_hash(name, loader));
}
};
--- hotspot/src/share/vm/utilities/histogram.hpp 2011-07-05 14:31:05.000000000 -0400
+++ hotspot/src/share/vm/utilities/histogram.hpp 2011-07-07 19:17:03.000000000 -0400
@@ -37,6 +37,9 @@
@ -8969,8 +9049,8 @@
| ($(CD) $(JDK_IMAGE_DIR)/src && $(TAR) xf -); \
fi; \
done
--- jdk/make/common/shared/Compiler-gcc.gmk 2011-07-05 14:35:27.000000000 -0400
+++ jdk/make/common/shared/Compiler-gcc.gmk 2011-07-07 19:17:03.000000000 -0400
--- jdk/make/common/shared/Compiler-gcc.gmk 2012-05-01 17:17:59.000000000 -0400
+++ jdk/make/common/shared/Compiler-gcc.gmk 2012-09-11 18:26:48.000000000 -0400
@@ -99,6 +99,24 @@
endif
@ -8978,9 +9058,9 @@
+ifeq ($(PLATFORM), bsd)
+
+ # Settings specific to BSD
+ CC = $(COMPILER_PATH)gcc
+ CPP = $(COMPILER_PATH)gcc -E
+ CXX = $(COMPILER_PATH)g++
+ CC ?= $(COMPILER_PATH)gcc
+ CPP ?= $(COMPILER_PATH)gcc -E
+ CXX ?= $(COMPILER_PATH)g++
+ REQUIRED_CC_VER = 3.2
+
+ # Option used to create a shared library