--- Makefile.am +++ Makefile.am @@ -25,6 +25,7 @@ SUBDIRS = \ +AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 # The module will not build under distcheck --- agents/jvmpi/Makefile.am +++ agents/jvmpi/Makefile.am @@ -1,6 +1,6 @@ -pkglib_LTLIBRARIES = libjvmpi_oprofile.la +lib_LTLIBRARIES = libjvmpi_oprofile.la -libjvmpi_oprofile_la_CXXFLAGS = -W -Wall -fPIC +libjvmpi_oprofile_la_LDFLAGS = -module -avoid-version libjvmpi_oprofile_la_SOURCES = jvmpi_oprofile.cpp --- agents/jvmpi/jvmpi_oprofile.cpp +++ agents/jvmpi/jvmpi_oprofile.cpp @@ -16,6 +16,7 @@ #include #include #include +#include extern "C" { #include --- agents/jvmti/Makefile.am +++ agents/jvmti/Makefile.am @@ -1,8 +1,8 @@ AM_CFLAGS = @OP_CFLAGS@ -pkglib_LTLIBRARIES = libjvmti_oprofile.la +lib_LTLIBRARIES = libjvmti_oprofile.la -libjvmti_oprofile_la_CFLAGS = $(AM_CFLAGS) -fPIC +libjvmti_oprofile_la_LDFLAGS = -module -avoid-version libjvmti_oprofile_la_LIBADD = ../../libopagent/libopagent.la --- configure.in +++ configure.in @@ -140,7 +140,7 @@ AX_CHECK_DOCBOOK dnl finally restore the original libs setting LIBS="$ORIG_SAVE_LIBS" LIBERTY_LIBS="-liberty $DL_LIB $INTL_LIB" -BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB" +BFD_LIBS="-lbfd -liberty $Z_LIB $DL_LIB $INTL_LIB" POPT_LIBS="-lpopt" AC_SUBST(LIBERTY_LIBS) AC_SUBST(BFD_LIBS) --- libopagent/Makefile.am +++ libopagent/Makefile.am @@ -1,4 +1,4 @@ -pkglib_LTLIBRARIES = libopagent.la +lib_LTLIBRARIES = libopagent.la # install opagent.h to include directory include_HEADERS = opagent.h @@ -10,7 +10,7 @@ libopagent_la_SOURCES = opagent.c \ EXTRA_DIST = opagent_symbols.ver -libopagent_la_CFLAGS = -fPIC -I ${top_srcdir}/libop -I ${top_srcdir}/libutil +libopagent_la_CPPFLAGS = -I ${top_srcdir}/libop -I ${top_srcdir}/libutil libopagent_la_LIBADD = $(BFD_LIBS) # Do not increment the major version for this library except to --- libutil++/bfd_support.cpp +++ libutil++/bfd_support.cpp @@ -364,6 +364,9 @@ bool interesting_symbol(asymbol * sym) if (!strcmp("gcc2_compiled.", sym->name)) return false; + if (sym->flags & BSF_SECTION_SYM) + return false; + return true; } --- libutil++/file_manip.cpp +++ libutil++/file_manip.cpp @@ -44,7 +44,7 @@ bool copy_file(string const & source, st if (!in) return false; - int fd = open(destination.c_str(), O_RDWR|O_CREAT); + int fd = open(destination.c_str(), O_RDWR|O_CREAT, 0600); if (fd < 0) return false; close(fd); --- m4/binutils.m4 +++ m4/binutils.m4 @@ -8,11 +8,12 @@ AC_CHECK_FUNCS(xcalloc) AC_CHECK_FUNCS(xmemdup) AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl"; DL_LIB="-ldl", DL_LIB="") AC_CHECK_LIB(intl, main, LIBS="$LIBS -lintl"; INTL_LIB="-lintl", INTL_LIB="") +AC_CHECK_LIB(z, zlibVersion, LIBS="$LIBS -lz"; Z_LIB=-lz, Z_LIB=) AC_CHECK_LIB(bfd, bfd_openr,, AC_MSG_ERROR([bfd library not found])) AC_LANG_PUSH(C) SAVE_LIBS=$LIBS -LIBS=" -lbfd -liberty " +LIBS=" -lbfd -liberty -lz" # Determine if bfd_get_synthetic_symtab macro is available OS="`uname`" if test "$OS" = "Linux"; then --- m4/builtinexpect.m4 +++ m4/builtinexpect.m4 @@ -5,7 +5,7 @@ AC_MSG_CHECKING([whether __builtin_expec SAVE_CFLAGS=$CFLAGS CFLAGS="-Werror $CFLAGS" AC_TRY_LINK(,[ -int i; +int i = 0; if (__builtin_expect(i, 0)) { } ], AC_MSG_RESULT([yes]); EXTRA_CFLAGS_MODULE="$EXTRA_CFLAGS_MODULE -DEXPECT_OK", --- m4/cellspubfdsupport.m4 +++ m4/cellspubfdsupport.m4 @@ -12,7 +12,7 @@ AC_DEFUN([AX_CELL_SPU], AC_LANG_PUSH(C) SAVE_LIBS=$LIBS -LIBS=" -lbfd -liberty " +LIBS=" -lbfd -liberty -lz" AC_CHECK_LIB(bfd, bfd_openr_iovec, [bfd_openr_iovec_exists="yes"], --- m4/mallocattribute.m4 +++ m4/mallocattribute.m4 @@ -4,9 +4,9 @@ AC_DEFUN([AX_MALLOC_ATTRIBUTE], AC_MSG_CHECKING([whether malloc attribute is understood]) SAVE_CFLAGS=$CFLAGS CFLAGS="-Werror $CFLAGS" -AC_TRY_COMPILE(,[ +AC_TRY_COMPILE([ void monkey() __attribute__((malloc)); -],AC_MSG_RESULT([yes]); AC_DEFINE(MALLOC_ATTRIBUTE_OK, 1, [whether malloc attribute is understood]), AC_MSG_RESULT([no])) +],,AC_MSG_RESULT([yes]); AC_DEFINE(MALLOC_ATTRIBUTE_OK, 1, [whether malloc attribute is understood]), AC_MSG_RESULT([no])) CFLAGS=$SAVE_CFLAGS ] ) --- utils/opcontrol +++ utils/opcontrol @@ -508,10 +508,19 @@ get_image_range() exit 1 fi + kernel_file=$FILE_IMAGE + case $(file -L $kernel_file) in + *"gzip compressed"*) + kernel_file=$(mktemp /tmp/opcXXXXXX) || exit 1 + trap "rm -f $kernel_file" EXIT + gzip -cd $FILE_IMAGE > $kernel_file + ;; + esac + # start at the start of .text, and end at _etext - range_info=`objdump -h $FILE_IMAGE 2>/dev/null | grep " .text "` + range_info=`objdump -h $kernel_file 2>/dev/null | grep " .text "` tmp1=`echo $range_info | awk '{print $4}'` - tmp2=`objdump -t $FILE_IMAGE 2>/dev/null | grep "_etext$" | awk '{ print $1 }'` + tmp2=`objdump -t $kernel_file 2>/dev/null | grep "_etext$" | awk '{ print $1 }'` if test -z "$tmp1" -o -z "$tmp2"; then echo "The specified file $FILE_IMAGE does not seem to be valid" >&2