[oprofile] Fix ftbfs for fedora 21, rhbz1106680.

William Eden Cohen wcohen at fedoraproject.org
Tue Jun 10 21:19:03 UTC 2014


commit d4d6854bc4bc334841089f9812cd6d774cb958b6
Author: William Cohen <wcohen at redhat.com>
Date:   Tue Jun 10 17:18:27 2014 -0400

    Fix ftbfs for fedora 21, rhbz1106680.

 oprofile-config.patch |  163 +++++++++++++++++++++++++++++++++++++++++++++++++
 oprofile-unused.patch |   53 ++++++++++++++++
 oprofile.spec         |    9 +++-
 3 files changed, 224 insertions(+), 1 deletions(-)
---
diff --git a/oprofile-config.patch b/oprofile-config.patch
new file mode 100644
index 0000000..d46ba18
--- /dev/null
+++ b/oprofile-config.patch
@@ -0,0 +1,163 @@
+commit 63b5692aace5ff6022f892822b4bfdc51ed25bfb
+Author: Alan Modra <amodra at gmail.com>
+Date:   Fri May 2 07:54:08 2014 -0500
+
+    Tidy powerpc64 bfd target check
+    
+    Testing for a bfd_target vector might (will!) break.  See
+    https://sourceware.org/ml/binutils/2014-04/msg00283.html
+    
+    It's safer to ask BFD for the target name.  I left the direct target
+    vector checks in configure tests, and updated them, even though the
+    target vector is no longer used in oprofile code, because a run-time
+    configure test for powerpc64 support in bfd:
+           #include <bfd.h>
+           int main(void)
+           { return !bfd_find_target("elf64-powerpc", (void *)0); }
+    unfortunately isn't possible when cross-compiling.
+    
+    The bfd_target vector tests could be omitted if we aren't bothered by
+    the small runtime overhead of a strncmp on targets other than
+    powerpc64.
+    
+            * libutil++/bfd_support.cpp (get_synth_symbols): Don't check for
+            ppc64 target vector, use bfd_get_target to return the target
+            name instead.
+            * m4/binutils.m4: Modernize bfd_get_synthetic_symtab checks to
+            use AC_LINK_IFELSE.  Check for either powerpc_elf64_vec or
+            bfd_elf64_powerpc_vec.
+    
+    Signed-off-by: Alan Modra <amodra at gmail.com>
+
+diff --git a/libutil++/bfd_support.cpp b/libutil++/bfd_support.cpp
+index 4b744f8..a3bee99 100644
+--- a/libutil++/bfd_support.cpp
++++ b/libutil++/bfd_support.cpp
+@@ -633,8 +633,14 @@ void bfd_info::translate_debuginfo_syms(asymbol ** dbg_syms, long nr_dbg_syms)
+ 
+ bool bfd_info::get_synth_symbols()
+ {
+-	extern const bfd_target bfd_elf64_powerpc_vec;
+-	bool is_elf64_powerpc_target = (abfd->xvec == &bfd_elf64_powerpc_vec);
++	const char* targname = bfd_get_target(abfd);
++	// Match elf64-powerpc and elf64-powerpc-freebsd, but not
++	// elf64-powerpcle.  elf64-powerpcle is a different ABI without
++	// function descriptors, so we don't need the synthetic
++	// symbols to have function code marked by a symbol.
++	bool is_elf64_powerpc_target = (!strncmp(targname, "elf64-powerpc", 13)
++					&& (targname[13] == 0
++					    || targname[13] == '-'));
+ 
+ 	if (!is_elf64_powerpc_target)
+ 		return false;
+diff --git a/m4/binutils.m4 b/m4/binutils.m4
+index 25fb15a..c83ba41 100644
+--- a/m4/binutils.m4
++++ b/m4/binutils.m4
+@@ -22,32 +22,32 @@ dnl Use a different bfd function here so as not to use cached result from above
+ 
+ AC_LANG_PUSH(C)
+ # Determine if bfd_get_synthetic_symtab macro is available
+-OS="`uname`"
+-if test "$OS" = "Linux"; then
+-	AC_MSG_CHECKING([whether bfd_get_synthetic_symtab() exists in BFD library])
+-	rm -f test-for-synth
+-	AC_LANG_CONFTEST(
+-		[AC_LANG_PROGRAM([[#include <bfd.h>]],
+-			[[asymbol * synthsyms;	bfd * ibfd = 0; 
+-			long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
+-			extern const bfd_target bfd_elf64_powerpc_vec;
+-			extern const bfd_target bfd_elf64_powerpcle_vec;
+-			char * ppc_name = bfd_elf64_powerpc_vec.name;
+-			char * ppcle_name = bfd_elf64_powerpcle_vec.name;
+-			printf("%s %s\n", ppc_name, ppcle_name);]])
+-		])
+-	$CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS -o  test-for-synth > /dev/null 2>&1
+-	if test -f test-for-synth; then
+-		echo "yes"
+-		SYNTHESIZE_SYMBOLS='1'
+-	else
+-		echo "no"
+-		SYNTHESIZE_SYMBOLS='0'
+-	fi
+-	AC_DEFINE_UNQUOTED(SYNTHESIZE_SYMBOLS, $SYNTHESIZE_SYMBOLS, [Synthesize special symbols when needed])
+-	rm -f test-for-synth*
++AC_MSG_CHECKING([whether bfd_get_synthetic_symtab() exists in BFD library])
++AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>
++	]],
++	[[asymbol * synthsyms;	bfd * ibfd = 0;
++	long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
++	extern const bfd_target powerpc_elf64_vec;
++	char *ppc_name = powerpc_elf64_vec.name;
++	printf("%s\n", ppc_name);
++	]])],
++	[AC_MSG_RESULT([yes])
++	SYNTHESIZE_SYMBOLS=2],
++	[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>
++		]],
++		[[asymbol * synthsyms;	bfd * ibfd = 0;
++		long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
++		extern const bfd_target bfd_elf64_powerpc_vec;
++		char *ppc_name = bfd_elf64_powerpc_vec.name;
++		printf("%s\n", ppc_name);
++		]])],
++		[AC_MSG_RESULT([yes])
++		SYNTHESIZE_SYMBOLS=1],
++		[AC_MSG_RESULT([no])
++		SYNTHESIZE_SYMBOLS=0])
++	])
++AC_DEFINE_UNQUOTED(SYNTHESIZE_SYMBOLS, $SYNTHESIZE_SYMBOLS, [Synthesize special symbols when needed])
+ 
+-fi
+ AC_LANG_POP(C)
+ ]
+ )
+commit 008e470a9b8751de0a3745e511cbc05b68759688
+Author: Aaro Koskinen <aaro.koskinen at iki.fi>
+Date:   Mon May 12 08:28:46 2014 -0500
+
+    configure: fix test-for-synth check with GCC 4.9.0
+    
+    With GCC 4.9.0 oprofile 0.9.9 build fails on non-PPC platfroms because
+    the "test-for-synth" configure check result is incorrect: There is a NULL
+    pointer dereference in the test program, so the compiler seems to optimize
+    the rest of the code away, and the test will always succeed regardless
+    whether powerpc_elf64_vec/bfd_elf64_powerpc_vec are present or not.
+    Fix by allocating the referred struct statically.
+    
+    While at it, also include stdio.h to avoid a compiler warning.
+    
+    Signed-off-by: Aaro Koskinen <aaro.koskinen at iki.fi>
+
+diff --git a/m4/binutils.m4 b/m4/binutils.m4
+index c83ba41..c50e2f3 100644
+--- a/m4/binutils.m4
++++ b/m4/binutils.m4
+@@ -23,9 +23,10 @@ dnl Use a different bfd function here so as not to use cached result from above
+ AC_LANG_PUSH(C)
+ # Determine if bfd_get_synthetic_symtab macro is available
+ AC_MSG_CHECKING([whether bfd_get_synthetic_symtab() exists in BFD library])
+-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>
+-	]],
+-	[[asymbol * synthsyms;	bfd * ibfd = 0;
++AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>]
++	[#include <stdio.h>]
++	[static bfd _ibfd;]],
++	[[asymbol * synthsyms;	bfd * ibfd = &_ibfd;
+ 	long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
+ 	extern const bfd_target powerpc_elf64_vec;
+ 	char *ppc_name = powerpc_elf64_vec.name;
+@@ -33,9 +34,10 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>
+ 	]])],
+ 	[AC_MSG_RESULT([yes])
+ 	SYNTHESIZE_SYMBOLS=2],
+-	[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>
+-		]],
+-		[[asymbol * synthsyms;	bfd * ibfd = 0;
++	[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>]
++		[#include <stdio.h>]
++		[static bfd _ibfd;]],
++		[[asymbol * synthsyms;	bfd * ibfd = &_ibfd;
+ 		long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
+ 		extern const bfd_target bfd_elf64_powerpc_vec;
+ 		char *ppc_name = bfd_elf64_powerpc_vec.name;
diff --git a/oprofile-unused.patch b/oprofile-unused.patch
new file mode 100644
index 0000000..ec239ae
--- /dev/null
+++ b/oprofile-unused.patch
@@ -0,0 +1,53 @@
+From 90efab5dbd81e22443023c898c19c1fde0409f1b Mon Sep 17 00:00:00 2001
+From: William Cohen <wcohen at redhat.com>
+Date: Mon, 9 Jun 2014 16:37:58 -0400
+Subject: [PATCH] Remove unused functions from OProfile
+
+The Fedora rawhide compiler is now stricter and will treat the
+warnings for unused functions as errors and stop the compile. This patch
+removes two unused functions in the code.
+
+Signed-off-by: William Cohen <wcohen at redhat.com>
+---
+ libpp/callgraph_container.cpp | 7 -------
+ libpp/xml_utils.cpp           | 6 ------
+ 2 files changed, 13 deletions(-)
+
+diff --git a/libpp/callgraph_container.cpp b/libpp/callgraph_container.cpp
+index 1d1c95f..c5bc272 100644
+--- a/libpp/callgraph_container.cpp
++++ b/libpp/callgraph_container.cpp
+@@ -36,13 +36,6 @@ using namespace std;
+ 
+ namespace {
+ 
+-bool operator==(cg_symbol const & lhs, cg_symbol const & rhs)
+-{
+-	less_symbol cmp_symb;
+-	return !cmp_symb(lhs, rhs) && !cmp_symb(rhs, lhs);
+-}
+-
+-
+ // we store {caller,callee} inside a single u64
+ odb_key_t caller_to_key(u32 value)
+ {
+diff --git a/libpp/xml_utils.cpp b/libpp/xml_utils.cpp
+index 5f1a3a1..3de41e5 100644
+--- a/libpp/xml_utils.cpp
++++ b/libpp/xml_utils.cpp
+@@ -101,12 +101,6 @@ bool has_separated_thread_info()
+ }
+ 
+ 
+-string get_cpu_num(size_t pclass)
+-{
+-	return classes.v[pclass].ptemplate.cpu;
+-}
+-
+-
+ };  // anonymous namespace
+ 
+ xml_utils::xml_utils(format_output::xml_formatter * xo,
+-- 
+2.0.0
+
diff --git a/oprofile.spec b/oprofile.spec
index 5678f6b..fff4866 100644
--- a/oprofile.spec
+++ b/oprofile.spec
@@ -1,7 +1,7 @@
 Summary: System wide profiler
 Name: oprofile
 Version: 0.9.9
-Release: 4.54.gb7e9a57%{?dist}
+Release: 5.54.gb7e9a57%{?dist}
 License: GPLv2+ and LGPLv2+
 Group: Development/System
 #
@@ -13,6 +13,8 @@ Requires(postun): shadow-utils
 Patch10: oprofile-0.4-guess2.patch
 Patch83: oprofile-0.9.7-xen.patch
 Patch84: oprofile-xenppc.patch
+Patch500: oprofile-unused.patch
+Patch501: oprofile-config.patch
 
 URL: http://oprofile.sf.net
 
@@ -78,6 +80,8 @@ agent library.
 %patch10 -p1 -b .guess2
 %patch83 -p1 -b .xen
 %patch84 -p1 -b .xenppc
+%patch500 -p1 -b .unused
+%patch501 -p1 -b .config
 
 ./autogen.sh
 
@@ -167,6 +171,9 @@ exit 0
 %{_sysconfdir}/ld.so.conf.d/*
 
 %changelog
+* Tue Jun 10 2014 William Cohen <wcohen at redhat.com> - 0.9.9-5.54.gb7e9a57
+- Fix ftbfs for fedora 21, rhbz1106680.
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.9.9-4.54.gb7e9a57
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list