summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/oprofile/oprofile/0001-Tidy-powerpc64-bfd-target-check.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/oprofile/oprofile/0001-Tidy-powerpc64-bfd-target-check.patch')
-rw-r--r--meta/recipes-kernel/oprofile/oprofile/0001-Tidy-powerpc64-bfd-target-check.patch123
1 files changed, 123 insertions, 0 deletions
diff --git a/meta/recipes-kernel/oprofile/oprofile/0001-Tidy-powerpc64-bfd-target-check.patch b/meta/recipes-kernel/oprofile/oprofile/0001-Tidy-powerpc64-bfd-target-check.patch
new file mode 100644
index 0000000000..93c62400cf
--- /dev/null
+++ b/meta/recipes-kernel/oprofile/oprofile/0001-Tidy-powerpc64-bfd-target-check.patch
@@ -0,0 +1,123 @@
1Upstream-Status: Backport
2
3From 63b5692aace5ff6022f892822b4bfdc51ed25bfb Mon Sep 17 00:00:00 2001
4From: Alan Modra <amodra@gmail.com>
5Date: Fri, 2 May 2014 07:54:08 -0500
6Subject: [PATCH] Tidy powerpc64 bfd target check
7
8Testing for a bfd_target vector might (will!) break. See
9https://sourceware.org/ml/binutils/2014-04/msg00283.html
10
11It's safer to ask BFD for the target name. I left the direct target
12vector checks in configure tests, and updated them, even though the
13target vector is no longer used in oprofile code, because a run-time
14configure test for powerpc64 support in bfd:
15 #include <bfd.h>
16 int main(void)
17 { return !bfd_find_target("elf64-powerpc", (void *)0); }
18unfortunately isn't possible when cross-compiling.
19
20The bfd_target vector tests could be omitted if we aren't bothered by
21the small runtime overhead of a strncmp on targets other than
22powerpc64.
23
24 * libutil++/bfd_support.cpp (get_synth_symbols): Don't check for
25 ppc64 target vector, use bfd_get_target to return the target
26 name instead.
27 * m4/binutils.m4: Modernize bfd_get_synthetic_symtab checks to
28 use AC_LINK_IFELSE. Check for either powerpc_elf64_vec or
29 bfd_elf64_powerpc_vec.
30
31Signed-off-by: Alan Modra <amodra@gmail.com>
32---
33 libutil++/bfd_support.cpp | 10 +++++++--
34 m4/binutils.m4 | 50 ++++++++++++++++++++++-----------------------
35 2 files changed, 33 insertions(+), 27 deletions(-)
36
37Index: oprofile-0.9.9/libutil++/bfd_support.cpp
38===================================================================
39--- oprofile-0.9.9.orig/libutil++/bfd_support.cpp 2013-07-29 08:55:06.000000000 -0700
40+++ oprofile-0.9.9/libutil++/bfd_support.cpp 2014-05-02 09:12:05.761146347 -0700
41@@ -633,10 +633,16 @@
42
43 bool bfd_info::get_synth_symbols()
44 {
45- extern const bfd_target bfd_elf64_powerpc_vec;
46- extern const bfd_target bfd_elf64_powerpcle_vec;
47- bool is_elf64_powerpc_target = (abfd->xvec == &bfd_elf64_powerpc_vec)
48- || (abfd->xvec == &bfd_elf64_powerpcle_vec);
49+ const char* targname = bfd_get_target(abfd);
50+ // Match elf64-powerpc and elf64-powerpc-freebsd, but not
51+ // elf64-powerpcle. elf64-powerpcle is a different ABI without
52+ // function descriptors, so we don't need the synthetic
53+ // symbols to have function code marked by a symbol.
54+ bool is_elf64_powerpc_target = (!strncmp(targname, "elf64-powerpc", 13)
55+ && (targname[13] == 0
56+ || targname[13] == '-'));
57+
58+
59
60 if (!is_elf64_powerpc_target)
61 return false;
62Index: oprofile-0.9.9/m4/binutils.m4
63===================================================================
64--- oprofile-0.9.9.orig/m4/binutils.m4 2013-07-29 08:55:07.000000000 -0700
65+++ oprofile-0.9.9/m4/binutils.m4 2014-05-02 09:07:32.471148147 -0700
66@@ -22,32 +22,32 @@
67
68 AC_LANG_PUSH(C)
69 # Determine if bfd_get_synthetic_symtab macro is available
70-OS="`uname`"
71-if test "$OS" = "Linux"; then
72- AC_MSG_CHECKING([whether bfd_get_synthetic_symtab() exists in BFD library])
73- rm -f test-for-synth
74- AC_LANG_CONFTEST(
75- [AC_LANG_PROGRAM([[#include <bfd.h>]],
76- [[asymbol * synthsyms; bfd * ibfd = 0;
77- long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
78- extern const bfd_target bfd_elf64_powerpc_vec;
79- extern const bfd_target bfd_elf64_powerpcle_vec;
80- char * ppc_name = bfd_elf64_powerpc_vec.name;
81- char * ppcle_name = bfd_elf64_powerpcle_vec.name;
82- printf("%s %s\n", ppc_name, ppcle_name);]])
83- ])
84- $CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS -o test-for-synth > /dev/null 2>&1
85- if test -f test-for-synth; then
86- echo "yes"
87- SYNTHESIZE_SYMBOLS='1'
88- else
89- echo "no"
90- SYNTHESIZE_SYMBOLS='0'
91- fi
92- AC_DEFINE_UNQUOTED(SYNTHESIZE_SYMBOLS, $SYNTHESIZE_SYMBOLS, [Synthesize special symbols when needed])
93- rm -f test-for-synth*
94+AC_MSG_CHECKING([whether bfd_get_synthetic_symtab() exists in BFD library])
95+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>
96+ ]],
97+ [[asymbol * synthsyms; bfd * ibfd = 0;
98+ long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
99+ extern const bfd_target powerpc_elf64_vec;
100+ char *ppc_name = powerpc_elf64_vec.name;
101+ printf("%s\n", ppc_name);
102+ ]])],
103+ [AC_MSG_RESULT([yes])
104+ SYNTHESIZE_SYMBOLS=2],
105+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bfd.h>
106+ ]],
107+ [[asymbol * synthsyms; bfd * ibfd = 0;
108+ long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
109+ extern const bfd_target bfd_elf64_powerpc_vec;
110+ char *ppc_name = bfd_elf64_powerpc_vec.name;
111+ printf("%s\n", ppc_name);
112+ ]])],
113+ [AC_MSG_RESULT([yes])
114+ SYNTHESIZE_SYMBOLS=1],
115+ [AC_MSG_RESULT([no])
116+ SYNTHESIZE_SYMBOLS=0])
117+ ])
118+AC_DEFINE_UNQUOTED(SYNTHESIZE_SYMBOLS, $SYNTHESIZE_SYMBOLS, [Synthesize special symbols when needed])
119
120-fi
121 AC_LANG_POP(C)
122 ]
123 )