# HG changeset patch # User xlu # Date 1213141160 25200 # Node ID 6470a2a42f92141b88e22e44655eba94755fac1c # Parent cf1821c649d915ab43064916b77498f08f4e4602 6647068: libjvm.so is not built PIC Summary: Remove the preferred base address built with libjvm.so and unified the PIC approach on Solaris & Linux. Reviewed-by: never, kamg Contributed-by: xiaobin.lu@sun.com diff -r cf1821c649d9 -r 6470a2a42f92 make/defs.make --- a/make/defs.make Fri Jun 06 14:34:24 2008 -0700 +++ b/make/defs.make Tue Jun 10 16:39:20 2008 -0700 @@ -261,3 +261,21 @@ EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h + +# A list of object files built without the platform specific PIC flags, e.g. +# -fPIC on linux. Performance measurements show that by compiling GC related +# code, we could significantly reduce the GC pause time on 32 bit Linux/Unix +# platforms. See 6454213 for more details. +include $(GAMMADIR)/make/scm.make + +ifneq ($(OSNAME), windows) + ifndef LP64 + NONPIC_DIRS = memory oops gc_implementation gc_interface + NONPIC_DIRS := $(foreach dir,$(NONPIC_DIRS), $(GAMMADIR)/src/share/vm/$(dir)) + # Look for source files under NONPIC_DIRS + NONPIC_FILES := $(foreach dir,$(NONPIC_DIRS),\ + $(shell find $(dir) \( $(SCM_DIRS) \) -prune -o \ + -name '*.cpp' -print)) + NONPIC_OBJ_FILES := $(notdir $(subst .cpp,.o,$(NONPIC_FILES))) + endif +endif diff -r cf1821c649d9 -r 6470a2a42f92 make/linux/makefiles/gcc.make --- a/make/linux/makefiles/gcc.make Fri Jun 06 14:34:24 2008 -0700 +++ b/make/linux/makefiles/gcc.make Tue Jun 10 16:39:20 2008 -0700 @@ -50,14 +50,7 @@ VM_PICFLAG/LIBJVM = $(PICFLAG) VM_PICFLAG/AOUT = - -ifneq ($(BUILDARCH), i486) VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) -else -# PIC has significant overhead on x86, build nonpic VM for now. -# Link JVM at a "good" base location to avoid unnecessary .text patching. -JVM_BASE_ADDR = 0x06000000 -endif CFLAGS += $(VM_PICFLAG) CFLAGS += -fno-rtti diff -r cf1821c649d9 -r 6470a2a42f92 make/linux/makefiles/rules.make --- a/make/linux/makefiles/rules.make Fri Jun 06 14:34:24 2008 -0700 +++ b/make/linux/makefiles/rules.make Tue Jun 10 16:39:20 2008 -0700 @@ -133,10 +133,22 @@ COMPILE_DONE = && { echo Done with $<; } endif +include $(GAMMADIR)/make/defs.make + +# The non-PIC object files are only generated for 32 bit platforms. +ifdef LP64 %.o: %.cpp @echo Compiling $< $(QUIETLY) $(REMOVE_TARGET) $(QUIETLY) $(COMPILE.CC) -o $@ $< $(COMPILE_DONE) +else +%.o: %.cpp + @echo Compiling $< + $(QUIETLY) $(REMOVE_TARGET) + $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ + $(subst $(VM_PICFLAG), ,$(COMPILE.CC)) -o $@ $< $(COMPILE_DONE), \ + $(COMPILE.CC) -o $@ $< $(COMPILE_DONE)) +endif %.o: %.s @echo Assembling $< diff -r cf1821c649d9 -r 6470a2a42f92 make/solaris/makefiles/rules.make --- a/make/solaris/makefiles/rules.make Fri Jun 06 14:34:24 2008 -0700 +++ b/make/solaris/makefiles/rules.make Tue Jun 10 16:39:20 2008 -0700 @@ -133,19 +133,7 @@ COMPILE_DONE = && { echo Done with $<; } endif -# A list of directories under which all source code are built without -KPIC/-Kpic -# flag. Performance measurements show that compiling GC related code will -# dramatically reduce the gc pause time. See bug 6454213 for more details. - -include $(GAMMADIR)/make/scm.make - -NONPIC_DIRS = memory oops gc_implementation gc_interface -NONPIC_DIRS := $(foreach dir,$(NONPIC_DIRS), $(GAMMADIR)/src/share/vm/$(dir)) -# Look for source code under NONPIC_DIRS -NONPIC_FILES := $(foreach dir,$(NONPIC_DIRS),\ - $(shell find $(dir) \( $(SCM_DIRS) \) -prune -o \ - -name '*.cpp' -print)) -NONPIC_OBJ_FILES := $(notdir $(subst .cpp,.o,$(NONPIC_FILES))) +include $(GAMMADIR)/make/defs.make # Sun compiler for 64 bit Solaris does not support building non-PIC object files. ifdef LP64