coff-bfd.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* BFD COFF interfaces used outside of BFD.
  2. Copyright (C) 1990-2022 Free Software Foundation, Inc.
  3. Written by Cygnus Support.
  4. This file is part of BFD, the Binary File Descriptor library.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  16. MA 02110-1301, USA. */
  17. /* This structure is used for a comdat section, as in PE. A comdat
  18. section is associated with a particular symbol. When the linker
  19. sees a comdat section, it keeps only one of the sections with a
  20. given name and associated with a given symbol. */
  21. struct coff_comdat_info
  22. {
  23. /* The name of the symbol associated with a comdat section. */
  24. const char *name;
  25. /* The local symbol table index of the symbol associated with a
  26. comdat section. This is only meaningful to the object file format
  27. specific code; it is not an index into the list returned by
  28. bfd_canonicalize_symtab. */
  29. long symbol;
  30. };
  31. /* The used_by_bfd field of a section may be set to a pointer to this
  32. structure. */
  33. struct coff_section_tdata
  34. {
  35. /* The relocs, swapped into COFF internal form. This may be NULL. */
  36. struct internal_reloc *relocs;
  37. /* If this is TRUE, the relocs entry may not be freed. */
  38. bool keep_relocs;
  39. /* The section contents. This may be NULL. */
  40. bfd_byte *contents;
  41. /* If this is TRUE, the contents entry may not be freed. */
  42. bool keep_contents;
  43. /* Information cached by coff_find_nearest_line. */
  44. bool saved_bias;
  45. bfd_signed_vma bias;
  46. bfd_vma offset;
  47. unsigned int i;
  48. const char *function;
  49. /* Optional information about a COMDAT entry; NULL if not COMDAT. */
  50. struct coff_comdat_info *comdat;
  51. int line_base;
  52. /* A pointer used for .stab linking optimizations. */
  53. void * stab_info;
  54. /* Available for individual backends. */
  55. void * tdata;
  56. };
  57. /* An accessor macro for the coff_section_tdata structure. */
  58. #define coff_section_data(abfd, sec) \
  59. ((struct coff_section_tdata *) (sec)->used_by_bfd)
  60. #define bfd_coff_get_comdat_section(abfd, sec) \
  61. ((bfd_get_flavour (abfd) == bfd_target_coff_flavour \
  62. && coff_section_data (abfd, sec) != NULL) \
  63. ? coff_section_data (abfd, sec)->comdat : NULL)
  64. #define coff_symbol_from(symbol) \
  65. ((bfd_family_coff (bfd_asymbol_bfd (symbol)) \
  66. && bfd_asymbol_bfd (symbol)->tdata.coff_obj_data) \
  67. ? (coff_symbol_type *) (symbol) : NULL)
  68. struct internal_syment;
  69. union internal_auxent;
  70. extern bool bfd_coff_get_syment
  71. (bfd *, struct bfd_symbol *, struct internal_syment *);
  72. extern bool bfd_coff_get_auxent
  73. (bfd *, struct bfd_symbol *, int, union internal_auxent *);
  74. extern bool bfd_coff_set_symbol_class
  75. (bfd *, struct bfd_symbol *, unsigned int);