binutils-gdb/bfd/coff-bfd.h

87 lines
3.1 KiB
C
Raw Normal View History

Don't always build coffgen.o Removes a bunch of unused functions from libbfd when building ELF or AOUT. Split off the bits we need externally when not building a COFF target into coff-bfd.c and coff-bfd.h. bfd/ * Makefile.am (BFD32_LIBS, BFD32_LIBS_CFILES): Remove dwarf2 and coffgen. Add coff-bfd. Sort. (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add coffgen and dwarf2. * bfd-in.h (bfd_coff_get_syment, bfd_coff_get_auxent): Delete. (struct coff_comdat_info, bfd_coff_get_comdat_section): Delete. * coffgen.c (coff_symbol_from): Move to coff-bfd.h as macro, without unused param. Update uses. (bfd_coff_get_comdat_section): Move to coff-bfd.h as macro. (bfd_coff_get_syment, bfd_coff_get_auxent): Move to coff-bfd.c. * libcoff-in.h: #include "coff-bfd.h". (struct coff_section_tdata, coff_section_data): Move to coff-bfd.h. (coff_symbol_from): Delete. * coff-bfd.c: New file. * coff-bfd.h: New file. * coff-i386.c: Update coff_symbol_from occurrences. * coff-i960.c: Likewise. * coff-m68k.c: Likewise. * coff-sh.c: Likewise. * coff-x86_64.c: Likewise. * coffcode.h: Likewise. * pe-mips.c: Likewise. * configure.ac (elf): Add dwarf2.lo. (coffgen, coff, ecoff, xcoff): Define. Use when mapping bfd target vectors to .o files. Add dwarf2 for mach-o targets. Fix the sh target FIXME. * po/SRC-POTFILES.in: Regenerate. * Makefile.in: Regenerate. * configure: Regenerate. * bfd-in2.h: Regenerate. * libcoff.h: Regenerate. binutils/ * objdump.c: #include "coff-bfd.h". ld/ * ldmisc.c: #include "coff-bfd.h"
2014-12-10 12:14:34 +01:00
/* BFD COFF interfaces used outside of BFD.
2016-01-01 12:25:12 +01:00
Copyright (C) 1990-2016 Free Software Foundation, Inc.
Don't always build coffgen.o Removes a bunch of unused functions from libbfd when building ELF or AOUT. Split off the bits we need externally when not building a COFF target into coff-bfd.c and coff-bfd.h. bfd/ * Makefile.am (BFD32_LIBS, BFD32_LIBS_CFILES): Remove dwarf2 and coffgen. Add coff-bfd. Sort. (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add coffgen and dwarf2. * bfd-in.h (bfd_coff_get_syment, bfd_coff_get_auxent): Delete. (struct coff_comdat_info, bfd_coff_get_comdat_section): Delete. * coffgen.c (coff_symbol_from): Move to coff-bfd.h as macro, without unused param. Update uses. (bfd_coff_get_comdat_section): Move to coff-bfd.h as macro. (bfd_coff_get_syment, bfd_coff_get_auxent): Move to coff-bfd.c. * libcoff-in.h: #include "coff-bfd.h". (struct coff_section_tdata, coff_section_data): Move to coff-bfd.h. (coff_symbol_from): Delete. * coff-bfd.c: New file. * coff-bfd.h: New file. * coff-i386.c: Update coff_symbol_from occurrences. * coff-i960.c: Likewise. * coff-m68k.c: Likewise. * coff-sh.c: Likewise. * coff-x86_64.c: Likewise. * coffcode.h: Likewise. * pe-mips.c: Likewise. * configure.ac (elf): Add dwarf2.lo. (coffgen, coff, ecoff, xcoff): Define. Use when mapping bfd target vectors to .o files. Add dwarf2 for mach-o targets. Fix the sh target FIXME. * po/SRC-POTFILES.in: Regenerate. * Makefile.in: Regenerate. * configure: Regenerate. * bfd-in2.h: Regenerate. * libcoff.h: Regenerate. binutils/ * objdump.c: #include "coff-bfd.h". ld/ * ldmisc.c: #include "coff-bfd.h"
2014-12-10 12:14:34 +01:00
Written by Cygnus Support.
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. */
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
sees a comdat section, it keeps only one of the sections with a
given name and associated with a given symbol. */
struct coff_comdat_info
{
/* The name of the symbol associated with a comdat section. */
const char *name;
/* The local symbol table index of the symbol associated with a
comdat section. This is only meaningful to the object file format
specific code; it is not an index into the list returned by
bfd_canonicalize_symtab. */
long symbol;
};
/* The used_by_bfd field of a section may be set to a pointer to this
structure. */
struct coff_section_tdata
{
/* The relocs, swapped into COFF internal form. This may be NULL. */
struct internal_reloc *relocs;
/* If this is TRUE, the relocs entry may not be freed. */
bfd_boolean keep_relocs;
/* The section contents. This may be NULL. */
bfd_byte *contents;
/* If this is TRUE, the contents entry may not be freed. */
bfd_boolean keep_contents;
/* Information cached by coff_find_nearest_line. */
bfd_vma offset;
unsigned int i;
const char *function;
/* Optional information about a COMDAT entry; NULL if not COMDAT. */
struct coff_comdat_info *comdat;
int line_base;
/* A pointer used for .stab linking optimizations. */
void * stab_info;
/* Available for individual backends. */
void * tdata;
};
/* An accessor macro for the coff_section_tdata structure. */
#define coff_section_data(abfd, sec) \
((struct coff_section_tdata *) (sec)->used_by_bfd)
#define bfd_coff_get_comdat_section(abfd, sec) \
((bfd_get_flavour (abfd) == bfd_target_coff_flavour \
&& coff_section_data (abfd, sec) != NULL) \
? coff_section_data (abfd, sec)->comdat : NULL)
#define coff_symbol_from(symbol) \
((bfd_family_coff (bfd_asymbol_bfd (symbol)) \
&& bfd_asymbol_bfd (symbol)->tdata.coff_obj_data) \
? (coff_symbol_type *) (symbol) : NULL)
struct internal_syment;
union internal_auxent;
extern bfd_boolean bfd_coff_get_syment
(bfd *, struct bfd_symbol *, struct internal_syment *);
extern bfd_boolean bfd_coff_get_auxent
(bfd *, struct bfd_symbol *, int, union internal_auxent *);