summaryrefslogtreecommitdiff
path: root/x11-libs/cairo/files/cairo-1.16.0-binutils-2.34.patch
blob: a10cad5ee553ae5cac535439a83b0db6cab19e41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From e30259f6237571c61992433c110bc6e1ef900244 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Tue, 23 Feb 2021 11:36:24 +0000
Subject: [PATCH] cairo-trace: fix build with newer versions of bfd

And update configure/meson checks to check for the new function.

Drop libiberty.h check since it's only needed by backtrace-symbols.c
which we're about to remove.

Closes #391, #460
---
 Makefile.am                        |  1 +
 configure.ac                       |  8 +++++++-
 meson-cc-tests/bfd-section-flags.c |  9 +++++++++
 meson.build                        | 11 ++++++-----
 util/cairo-trace/lookup-symbol.c   |  7 +++----
 5 files changed, 26 insertions(+), 10 deletions(-)
 create mode 100644 meson-cc-tests/bfd-section-flags.c

diff --git a/configure.ac b/configure.ac
index 18e4a305f..6444a3da3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -826,7 +826,13 @@ CAIRO_ENABLE(interpreter, cairo-script-interpreter, yes, [
 AC_CHECK_LIB(bfd, bfd_openr,
 	 [AC_CHECK_HEADER(bfd.h, [have_bfd=yes],
 	 [have_bfd=no])], [have_bfd=no])
-AC_CHECK_HEADER(libiberty.h,, [have_bfd=no])
+dnl bfd_section_flags is an inline func so we don't bother with linking the lib in
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
+  #include <bfd.h>
+  asection *s;
+],[
+  return bfd_section_flags(s) == 0;
+])],[],[have_bfd=no])
 if test "x$have_bfd" = "xyes"; then
     AC_DEFINE([HAVE_BFD], [1], [Define to 1 if you have the binutils development files installed])
     BFD_LIBS=-lbfd
diff --git a/util/cairo-trace/lookup-symbol.c b/util/cairo-trace/lookup-symbol.c
index f9665b36f..9af0b5944 100644
--- a/util/cairo-trace/lookup-symbol.c
+++ b/util/cairo-trace/lookup-symbol.c
@@ -65,7 +65,6 @@
 
 #if HAVE_BFD
 #include <bfd.h>
-#include <libiberty.h>
 
 struct symtab {
     bfd *bfd;
@@ -145,14 +144,14 @@ find_address_in_section (bfd *abfd,
     if (symbol->found)
 	return;
 
-    if ((bfd_get_section_flags (symtab->bfd, section) & SEC_ALLOC) == 0)
+    if ((bfd_section_flags (section) & SEC_ALLOC) == 0)
 	return;
 
-    vma = bfd_get_section_vma (symtab->bfd, section);
+    vma = bfd_section_vma (section);
     if (symbol->pc < vma)
 	return;
 
-    size = bfd_section_size (symtab->bfd, section);
+    size = bfd_section_size (section);
     if (symbol->pc >= vma + size)
 	return;
 
-- 
2.34.1