Wrap BFD headers in extern "C"
authorPedro Alves <palves@redhat.com>
Wed, 11 Feb 2015 10:04:47 +0000 (10:04 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 11 Feb 2015 10:04:47 +0000 (10:04 +0000)
These were the BFD changes needed for building a C++ GDB with
--enable-targets=all, on x86_64 Fedora 20.

For libbfd.h and libcoff.h, this does same as already done when
generating bfd.h: open extern "C" in the -in.h header, and close it
from the Makefile.

bfd/doc/ChangeLog:
2015-02-11  Pedro Alves  <palves@redhat.com>

* Makefile.am (libbfd.h, libcoff.h): Close extern "C" scope.
* Makefile.in: Regenerate.

bfd/ChangeLog:
2015-02-11  Pedro Alves  <palves@redhat.com>

* libbfd-in.h [__cplusplus]: Open extern "C" scope.
* libcoff-in.h [__cplusplus]: Open extern "C" scope.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.

* elf-bfd.h [__cplusplus]: Wrap in extern "C".
* mach-o.h [__cplusplus]: Wrap in extern "C".
* som.h [__cplusplus]: Wrap in extern "C".

bfd/ChangeLog
bfd/doc/ChangeLog
bfd/doc/Makefile.am
bfd/doc/Makefile.in
bfd/elf-bfd.h
bfd/libbfd-in.h
bfd/libbfd.h
bfd/libcoff-in.h
bfd/libcoff.h
bfd/mach-o.h
bfd/som.h

index d5b50b7..3d575f2 100644 (file)
@@ -1,3 +1,14 @@
+2015-02-11  Pedro Alves  <palves@redhat.com>
+
+       * libbfd-in.h [__cplusplus]: Open extern "C" scope.
+       * libcoff-in.h [__cplusplus]: Open extern "C" scope.
+       * libbfd.h: Regenerate.
+       * libcoff.h: Regenerate.
+
+       * elf-bfd.h [__cplusplus]: Wrap in extern "C".
+       * mach-o.h [__cplusplus]: Wrap in extern "C".
+       * som.h [__cplusplus]: Wrap in extern "C".
+
 2015-02-10  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/17512
index fe3d691..07682da 100644 (file)
@@ -1,3 +1,8 @@
+2015-02-11  Pedro Alves  <palves@redhat.com>
+
+       * Makefile.am (libbfd.h, libcoff.h): Close extern "C" scope.
+       * Makefile.in: Regenerate.
+
 2015-01-12  Bernd Edlinger  <bernd.edlinger@hotmail.de>
            Alan Modra  <amodra@gmail.com>
 
index 779f361..52da14e 100644 (file)
@@ -275,6 +275,9 @@ libbfd.h: $(LIBBFD_H_DEP)
                ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
          esac; \
        done
+       echo "#ifdef __cplusplus" >> $@
+       echo "}" >> $@
+       echo "#endif" >> $@
 
 LIBCOFF_H_DEP = \
        $(srcdir)/../libcoff-in.h       \
@@ -294,6 +297,9 @@ libcoff.h: $(LIBCOFF_H_DEP)
                ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
          esac; \
        done
+       echo "#ifdef __cplusplus" >> $@
+       echo "}" >> $@
+       echo "#endif" >> $@
 
 BFD_H_DEP = \
        $(srcdir)/../bfd-in.h           \
index 78d8ec0..72099f1 100644 (file)
@@ -960,6 +960,9 @@ libbfd.h: $(LIBBFD_H_DEP)
                ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
          esac; \
        done
+       echo "#ifdef __cplusplus" >> $@
+       echo "}" >> $@
+       echo "#endif" >> $@
 
 libcoff.h: $(LIBCOFF_H_DEP)
        echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@
@@ -972,6 +975,9 @@ libcoff.h: $(LIBCOFF_H_DEP)
                ./$(MKDOC) -i -f $(srcdir)/proto.str < $$file >> $@ ;; \
          esac; \
        done
+       echo "#ifdef __cplusplus" >> $@
+       echo "}" >> $@
+       echo "#endif" >> $@
 
 bfd.h: $(BFD_H_DEP)
        echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
index 49ffe79..495053d 100644 (file)
 #include "elf/internal.h"
 #include "bfdlink.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* The number of entries in a section is its size divided by the size
    of a single entry.  This is normally only applicable to reloc and
    symbol table sections.
@@ -2540,4 +2544,7 @@ extern asection _bfd_elf_large_com_section;
     (!(H)->unique_global \
      && ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic)))
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* _LIBELF_H_ */
index cb7805f..7c661e3 100644 (file)
 
 #include "hashtab.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Align an address upward to a boundary, expressed as a number of bytes.
    E.g. align to an 8-byte boundary with argument of 8.  Take care never
    to wrap around if the address is within boundary-1 of the end of the
index a1c0a01..bd56afb 100644 (file)
 
 #include "hashtab.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Align an address upward to a boundary, expressed as a number of bytes.
    E.g. align to an 8-byte boundary with argument of 8.  Take care never
    to wrap around if the address is within boundary-1 of the end of the
@@ -3015,3 +3019,6 @@ void *bfd_arch_default_fill (bfd_size_type count,
     bfd_boolean code);
 
 /* Extracted from elf.c.  */
+#ifdef __cplusplus
+}
+#endif
index 6d00db0..34e71a8 100644 (file)
 #include "bfdlink.h"
 #include "coff-bfd.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Object file tdata; access macros.  */
 
 #define coff_data(bfd)               ((bfd)->tdata.coff_obj_data)
index df0e00f..ee72de3 100644 (file)
 #include "bfdlink.h"
 #include "coff-bfd.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Object file tdata; access macros.  */
 
 #define coff_data(bfd)               ((bfd)->tdata.coff_obj_data)
@@ -951,3 +955,6 @@ typedef struct
    PE object file.  */
 #define bfd_pei_p(abfd) \
   (CONST_STRNEQ ((abfd)->xvec->name, "pei-"))
+#ifdef __cplusplus
+}
+#endif
index bc694ba..0445398 100644 (file)
 #include "bfd.h"
 #include "mach-o/loader.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct bfd_mach_o_header
 {
   unsigned long magic;
@@ -746,4 +750,8 @@ bfd_mach_o_backend_data;
 #define SYM_MACHO_FIELDS_UNSET ((bfd_vma) -1)
 #define SYM_MACHO_FIELDS_NOT_VALIDATED ((bfd_vma) -2)
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _BFD_MACH_O_H_ */
index a300104..7f8a5ba 100644 (file)
--- a/bfd/som.h
+++ b/bfd/som.h
 #include <dl.h>
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #if defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
 /* BSD uses a completely different scheme for object file identification.
    so for now, define _PA_RISC_ID to accept any random value for a model
@@ -235,4 +239,7 @@ int **       hppa_som_gen_reloc_type           (bfd *, int, int, enum hppa_reloc
 bfd_boolean  bfd_som_attach_compilation_unit   (bfd *, const char *, const char *, const char *, const char *);
 asection *   bfd_section_from_som_symbol       (bfd *abfd, struct som_external_symbol_dictionary_record *symbol);
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* _SOM_H */