* dw2gencfi.c, dw2gencfi.h: New files.
[binutils-gdb.git] / bfd / elf-bfd.h
index 2e5587cf798990f56284954ae697bcad27d79383..46f612a63d26451c7b542fbec00c6fb7d44d6575 100644 (file)
@@ -204,8 +204,36 @@ struct elf_link_hash_entry
   /* Symbol is referenced by a non-GOT/non-PLT relocation.  This is
      not currently set by all the backends.  */
 #define ELF_LINK_NON_GOT_REF 010000
+  /* Symbol has a definition in a shared object.  */
+#define ELF_LINK_DYNAMIC_DEF 020000
+  /* Symbol is weak in all shared objects.  */
+#define ELF_LINK_DYNAMIC_WEAK 040000
 };
 
+/* Will references to this symbol always reference the symbol
+   in this object?  STV_PROTECTED is excluded from the visibility test
+   here so that function pointer comparisons work properly.  Since
+   function symbols not defined in an app are set to their .plt entry,
+   it's necessary for shared libs to also reference the .plt even
+   though the symbol is really local to the shared lib.  */
+#define SYMBOL_REFERENCES_LOCAL(INFO, H)                               \
+  ((! (INFO)->shared                                                   \
+    || (INFO)->symbolic                                                        \
+    || (H)->dynindx == -1                                              \
+    || ELF_ST_VISIBILITY ((H)->other) == STV_INTERNAL                  \
+    || ELF_ST_VISIBILITY ((H)->other) == STV_HIDDEN                    \
+    || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)                \
+   && ((H)->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+
+/* Will _calls_ to this symbol always call the version in this object?  */
+#define SYMBOL_CALLS_LOCAL(INFO, H)                                    \
+  ((! (INFO)->shared                                                   \
+    || (INFO)->symbolic                                                        \
+    || (H)->dynindx == -1                                              \
+    || ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT                   \
+    || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)                \
+   && ((H)->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+
 /* Records local symbols to be emitted in the dynamic symbol table.  */
 
 struct elf_link_local_dynamic_entry
@@ -424,7 +452,7 @@ struct elf_size_info {
      handle all back-ends.  */
 #define MAX_INT_RELS_PER_EXT_REL 3
 
-  unsigned char arch_size, file_align;
+  unsigned char arch_size, log_file_align;
   unsigned char elfclass, ev_current;
   int (*write_out_phdrs)
     PARAMS ((bfd *, const Elf_Internal_Phdr *, unsigned int));
@@ -1048,6 +1076,46 @@ typedef struct elf_linker_section_pointers
   bfd_boolean written_address_p;               /* whether address was written yet */
 } elf_linker_section_pointers_t;
 
+/* This struct is used to pass information to routines called via
+   elf_link_hash_traverse which must return failure.  */
+
+struct elf_info_failed
+{
+  bfd_boolean failed;
+  struct bfd_link_info *info;
+  struct bfd_elf_version_tree *verdefs;
+};
+
+/* This structure is used to pass information to
+   _bfd_elf_link_assign_sym_version.  */
+
+struct elf_assign_sym_version_info
+{
+  /* Output BFD.  */
+  bfd *output_bfd;
+  /* General link information.  */
+  struct bfd_link_info *info;
+  /* Version tree.  */
+  struct bfd_elf_version_tree *verdefs;
+  /* Whether we had a failure.  */
+  bfd_boolean failed;
+};
+
+/* This structure is used to pass information to
+   _bfd_elf_link_find_version_dependencies.  */
+
+struct elf_find_verdep_info
+{
+  /* Output BFD.  */
+  bfd *output_bfd;
+  /* General link information.  */
+  struct bfd_link_info *info;
+  /* The number of dependencies.  */
+  unsigned int vers;
+  /* Whether we had a failure.  */
+  bfd_boolean failed;
+};
+
 /* Some private data is stashed away for future use using the tdata pointer
    in the bfd structure.  */
 
@@ -1391,8 +1459,6 @@ extern asection *bfd_section_from_r_symndx
   PARAMS ((bfd *, struct sym_sec_cache *, asection *, unsigned long));
 extern asection *bfd_section_from_elf_index
   PARAMS ((bfd *, unsigned int));
-extern bfd_boolean _bfd_elf_create_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
 extern struct bfd_strtab_hash *_bfd_elf_stringtab_init
   PARAMS ((void));
 
@@ -1431,6 +1497,26 @@ extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr
 extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
   PARAMS ((struct bfd_link_info *));
 
+extern bfd_boolean _bfd_elf_merge_symbol
+  PARAMS ((bfd *, struct bfd_link_info *, const char *,
+          Elf_Internal_Sym *, asection **, bfd_vma *,
+          struct elf_link_hash_entry **, bfd_boolean *, bfd_boolean *,
+          bfd_boolean *, bfd_boolean *, bfd_boolean));
+
+extern bfd_boolean _bfd_elf_add_default_symbol
+  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+          const char *, Elf_Internal_Sym *, asection **, bfd_vma *,
+          bfd_boolean *, bfd_boolean, bfd_boolean));
+
+extern bfd_boolean _bfd_elf_export_symbol
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+
+extern bfd_boolean _bfd_elf_link_find_version_dependencies
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+
+extern bfd_boolean _bfd_elf_link_assign_sym_version
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+
 extern bfd_boolean _bfd_elf_link_record_dynamic_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 extern long _bfd_elf_link_lookup_local_dynindx
@@ -1445,6 +1531,8 @@ extern file_ptr _bfd_elf_assign_file_position_for_section
 extern bfd_boolean _bfd_elf_validate_reloc
   PARAMS ((bfd *, arelent *));
 
+extern bfd_boolean _bfd_elf_link_create_dynamic_sections
+  PARAMS ((bfd *, struct bfd_link_info *));
 extern bfd_boolean _bfd_elf_create_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 extern bfd_boolean _bfd_elf_create_got_section
@@ -1486,6 +1574,24 @@ extern bfd_vma bfd_elf64_finish_pointer_linker_section
 extern bfd_boolean _bfd_elf_make_linker_section_rela
   PARAMS ((bfd *, elf_linker_section_t *, int));
 
+extern Elf_Internal_Rela *_bfd_elf_link_read_relocs
+  PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, bfd_boolean));
+
+extern bfd_boolean _bfd_elf_link_size_reloc_section
+  PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
+
+extern bfd_boolean _bfd_elf_link_output_relocs
+  PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *));
+
+extern bfd_boolean _bfd_elf_fix_symbol_flags
+  PARAMS ((struct elf_link_hash_entry *, struct elf_info_failed *));
+
+extern bfd_boolean _bfd_elf_adjust_dynamic_symbol
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+
+extern bfd_boolean _bfd_elf_link_sec_merge_syms
+  PARAMS ((struct elf_link_hash_entry *, PTR));
+
 extern const bfd_target *bfd_elf32_object_p
   PARAMS ((bfd *));
 extern const bfd_target *bfd_elf32_core_file_p
@@ -1534,10 +1640,6 @@ extern bfd_boolean bfd_elf32_slurp_reloc_table
   PARAMS ((bfd *, asection *, asymbol **, bfd_boolean));
 extern bfd_boolean bfd_elf32_add_dynamic_entry
   PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
-extern bfd_boolean bfd_elf32_link_create_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern Elf_Internal_Rela *_bfd_elf32_link_read_relocs
-  PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, bfd_boolean));
 
 extern const bfd_target *bfd_elf64_object_p
   PARAMS ((bfd *));
@@ -1586,10 +1688,6 @@ extern bfd_boolean bfd_elf64_slurp_reloc_table
   PARAMS ((bfd *, asection *, asymbol **, bfd_boolean));
 extern bfd_boolean bfd_elf64_add_dynamic_entry
   PARAMS ((struct bfd_link_info *, bfd_vma, bfd_vma));
-extern bfd_boolean bfd_elf64_link_create_dynamic_sections
-  PARAMS ((bfd *, struct bfd_link_info *));
-extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
-  PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, bfd_boolean));
 
 #define bfd_elf32_link_record_dynamic_symbol \
   _bfd_elf_link_record_dynamic_symbol