You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-util/oprofile/files/oprofile-0.9.7-bfd.h-1.patch

93 lines
3.7 KiB

From 0fa5fc43ca2004546864051a584367a50413f190 Mon Sep 17 00:00:00 2001
From: Maynard Johnson <maynardj@us.ibm.com>
Date: Fri, 15 Jun 2012 13:55:33 -0500
Subject: [PATCH] Add #include "config.h" before bfd.h for perf-events branch
While building oprofile against a current CVS snapshot of binutils,
I received the following error:
-----------------------------------------
make[2]: Entering directory `/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent'
/bin/sh ../libtool --tag=CC --mode=compile /opt/at5.0-5-rc1/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent -fPIC -I /home/cseo/at5.0/at5.0-5/src/oprofile/libop -I /home/cseo/at5.0/at5.0-5/src/oprofile/libutil -g -MT libopagent_la-opagent.lo -MD -MP -MF .deps/libopagent_la-opagent.Tpo -c -o libopagent_la-opagent.lo `test -f 'opagent.c' || echo '/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent/'`opagent.c
libtool: compile: /opt/at5.0-5-rc1/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I/home/cseo/at5.0/at5.0-5/src/oprofile/libopagent -fPIC -I /home/cseo/at5.0/at5.0-5/src/oprofile/libop -I /home/cseo/at5.0/at5.0-5/src/oprofile/libutil -g -MT libopagent_la-opagent.lo -MD -MP -MF .deps/libopagent_la-opagent.Tpo -c opagent.c -fPIC -DPIC -o .libs/libopagent_la-opagent.o
In file included from opagent.c:63:0:
/opt/at5.0-5-rc1/include/bfd.h:37:2: error: #error config.h must be included before this header
-----------------------------------------
I opened a bug against binutils for this (see http://sourceware.org/bugzilla/show_bug.cgi?id=14243),
but the rationale for this error was explained to me thusly:
"This is a correctness issue. bfd.h and the headers that bfd.h #include test at
least one HAVE_* macro. So you need to include the file that defines those
HAVE_* macros before bfd.h. [sic] It is a really good idea to always include
config.h (or sysdep.h or alloca-conf.h that include config.h) before any other
files, including system headers."
This patch is a minimal patch that addresses the build failure with binutils,
ensuring that our config.h is #include'd before bfd.h
Since my work on the perf-events branch has involved testing on newer
binutils, I want to get this fix committed into the perf-events branch now
so I don't need to be adding a private patch for those times when I build
with new binutils.
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
---
libopagent/opagent.c | 1 +
libpp/symbol.h | 1 +
opjitconv/debug_line.c | 1 +
opjitconv/opjitconv.h | 1 +
4 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libopagent/opagent.c b/libopagent/opagent.c
index 2db1477..860413f 100644
--- a/libopagent/opagent.c
+++ b/libopagent/opagent.c
@@ -50,6 +50,7 @@
* See libopagent/Makefile.am for more information.
*******************************************************************/
+#include "config.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
diff --git a/libpp/symbol.h b/libpp/symbol.h
index ea2724d..8041cb9 100644
--- a/libpp/symbol.h
+++ b/libpp/symbol.h
@@ -12,6 +12,7 @@
#ifndef SYMBOL_H
#define SYMBOL_H
+#include "config.h"
#include "name_storage.h"
#include "growable_vector.h"
#include "sparse_array.h"
diff --git a/opjitconv/debug_line.c b/opjitconv/debug_line.c
index d7db8ec..babb943 100644
--- a/opjitconv/debug_line.c
+++ b/opjitconv/debug_line.c
@@ -8,6 +8,7 @@
* @author Philippe Elie
*/
+#include "config.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
diff --git a/opjitconv/opjitconv.h b/opjitconv/opjitconv.h
index 9562256..3f4919a 100644
--- a/opjitconv/opjitconv.h
+++ b/opjitconv/opjitconv.h
@@ -26,6 +26,7 @@
#define OP_JIT_CONV_ALREADY_DONE 5
#define OP_JIT_CONV_TMPDIR_NOT_REMOVED 6
+#include "config.h"
#include <bfd.h>
#include <stddef.h>
#include <sys/stat.h>
--
1.7.4.1