Review request: 7118588 Profiled JVM needs to be linked statically for gprof to profile libjvm.so

Joe Provino joseph.provino at oracle.com
Sun Jan 27 06:28:14 PST 2013



On 1/26/2013 2:57 AM, David Holmes wrote:
> On 26/01/2013 2:33 AM, Joe Provino wrote:
>> Webrev is here: http://cr.openjdk.java.net/~jprovino/7118588/webrev.00
>
> The bug synopsis is confusing - seems to me it is the launcher your 
> are changing not the VM.

I agree.  A better synopsis would be "Unable to link gamma launcher 
statically with the VM object files."

> Do we have gprof on Solaris? Does this change fix or break other 
> profiling tools ?

I think these are actually unrelated to the problem once the problem is 
stated correctly.

> I don't grok the actual changes

The problem is that if you attempt to build the gamma launcher 
statically with the VM object files
by setting LINK_INTO=AOUT on the make command line, the launcher will 
get undefined symbols.

The handling of LINK_INTO in launcher.make is incorrect.

ifeq ($(LINK_INTO),AOUT)
   LAUNCHER.o                 = launcher.o $(JVM_OBJ_FILES)
   LIBS_LAUNCHER          += $(STATIC_STDCXX) $(LIBS)
else
   LAUNCHER.o                 = launcher.o
   LIBS_LAUNCHER          += -l$(JVM) $(LIBS)
endif

launcher.o is undefined.  That isn't a problem in itself because 
LAUNCHER.o is never used.

This is the line that links the launcher:

$(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LIBS_LAUNCHER)

The simple fix is to add $(LAUNCHER.o):

$(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LAUNCHER.o) 
$(LIBS_LAUNCHER)

I also got rid of launcher.o since it's not used.

I think to clean this up, I'd define LAUNCHER.o to be the launcher 
object files plus the JVM object files
if LINK_INTO is AOUT and the launcher object files plus -ljvm 
otherwise.  Then to link the launcher,
I'd use $(LAUNCHER.o)  $(LIBS).

Should I do something like this or just the minimal fix?

joe


> but there is a typo in the bsd file:
>
> + #       profiledminimal1  minimal1 <os>_<arch>_shark/profiled
>
> shark? :)

fixed.

>
> David
>
>>
>> joe


More information about the hotspot-dev mailing list