This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Move 'enum bfd_endian' to a non-generated header
- From: Pedro Alves <palves at redhat dot com>
- To: binutils at sourceware dot org
- Date: Fri, 12 Feb 2016 18:39:26 +0000
- Subject: [PATCH] Move 'enum bfd_endian' to a non-generated header
- Authentication-results: sourceware.org; auth=none
Because:
- GDB uses enum bfd_endian extensively.
- gdbserver does not build/link-with bfd.
- We'd like to share more code between gdb and gdbserver.
It'd make our lives easier if we could just use bfd_endian in
gdbserver as well.
The problem is that bfd_endian is defined in a header that only exists
if bfd is built/configured.
Thus this moves bfd_endian to a separate header, so gdbserver can
include it.
Build tested with --enable-targets=all, from scratch.
bfd/ChangeLog:
2016-02-12 Pedro Alves <palves@redhat.com>
* bfd-in.h: Include bfd-types.h
* bfd-in2.h: Regenerate.
* targets.c (enum bfd_endian): Moved to include/bfd-types.h.
include/ChangeLog:
2016-02-12 Pedro Alves <palves@redhat.com>
* bfd-types.h: New file.
---
bfd/bfd-in.h | 1 +
bfd/bfd-in2.h | 3 +--
bfd/targets.c | 2 --
include/bfd-types.h | 26 ++++++++++++++++++++++++++
4 files changed, 28 insertions(+), 4 deletions(-)
create mode 100644 include/bfd-types.h
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 5df2bab..277ca5f 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -35,6 +35,7 @@ extern "C" {
#include "ansidecl.h"
#include "symcat.h"
#include <sys/stat.h>
+#include "bfd-types.h"
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#ifndef SABER
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index fb4858c..0d6b40f 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -42,6 +42,7 @@ extern "C" {
#include "ansidecl.h"
#include "symcat.h"
#include <sys/stat.h>
+#include "bfd-types.h"
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
#ifndef SABER
@@ -7124,8 +7125,6 @@ enum bfd_flavour
bfd_target_sym_flavour
};
-enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
-
/* Forward declaration. */
typedef struct bfd_link_info _bfd_link_info;
diff --git a/bfd/targets.c b/bfd/targets.c
index 50f3712..a2ee6ee 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -171,8 +171,6 @@ DESCRIPTION
. bfd_target_sym_flavour
.};
.
-.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
-.
.{* Forward declaration. *}
.typedef struct bfd_link_info _bfd_link_info;
.
diff --git a/include/bfd-types.h b/include/bfd-types.h
new file mode 100644
index 0000000..816fac4
--- /dev/null
+++ b/include/bfd-types.h
@@ -0,0 +1,26 @@
+/* bfd core types that do not depend on configuration.
+
+ Copyright (C) 1990-2016 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef BFD_TYPES_H
+#define BFD_TYPES_H
+
+enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
+
+#endif
--
1.9.3