This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix binutils build on sparc.


Hi,

Attached is a patch to fix binutils build on sparc.

In gprof.h, sysdep.h eventually includes sys/feature_tests.h, defining
_FILE_OFFSET_BITS before gprof.h includes gconfig.h, which also
defines _FILE_OFFSET_BITS, resulting in a multiple definition.

The patch teaches gprof.h to include gconfig.h first to prevent
sys/feature_tests.h from defining _FILE_OFFSET_BITS.

Now, gprof.h also includes bfd.h, which defines PACKAGE.  Since we
want PACKAGE to be defined as "gprof", we #undef PACKAGE right after
including gconfig.h.

This is quite ugly.  I don't know if there is a better solution to
this problem.

In ldlang.c, limits.h eventually includes sys/feature_tests.h,
defining _FILE_OFFSET_BITS before ldlang.c includes config.h, which
also defines _FILE_OFFSET_BITS.  The patch teaches ldlang.c to include
config.h first to prevent sys/feature_tests.h from defining
_FILE_OFFSET_BITS.

Tested by building sparc-solaris2.8.  OK to apply?

gprof/
2009-04-14  Kazu Hirata  <kazu@codesourcery.com>

	* gprof.h: Include gconfig.h.  #undef PACKAGE.

ld/
2009-04-14  Kazu Hirata  <kazu@codesourcery.com>

	* ldlang.c: Include config.h.

Index: gprof/gprof.h
===================================================================
RCS file: /cvs/src/src/gprof/gprof.h,v
retrieving revision 1.13
diff -u -d -p -r1.13 gprof.h
--- gprof/gprof.h	19 Apr 2007 10:46:56 -0000	1.13
+++ gprof/gprof.h	14 Apr 2009 19:00:29 -0000
@@ -29,6 +29,10 @@
 #ifndef gprof_h
 #define gprof_h
 
+#include "gconfig.h"
+
+#undef PACKAGE
+
 /* Include the BFD sysdep.h file.  */
 #include "sysdep.h"
 #include "bfd.h"
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.304
diff -u -d -p -r1.304 ldlang.c
--- ld/ldlang.c	3 Apr 2009 07:45:27 -0000	1.304
+++ ld/ldlang.c	14 Apr 2009 19:00:29 -0000
@@ -20,6 +20,8 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
+#include "config.h"
+
 #include <limits.h>
 
 #include "sysdep.h"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]