* elf32-d10v.c (extract_rel_addend, insert_rel_addend): New functions.
[deliverable/binutils-gdb.git] / bfd / elf-bfd.h
index 02cb3024fb132070a1da70cfb0c98056be8b3122..8059b4e244d120d8cb8312a1f5931328c6846148 100644 (file)
@@ -309,14 +309,6 @@ struct eh_frame_hdr_info
   bfd_boolean table;
 };
 
-/* Cached start, size and alignment of PT_TLS segment.  */
-struct elf_link_tls_segment
-{
-  bfd_vma start;
-  bfd_size_type size;
-  unsigned int align;
-};
-
 /* ELF linker hash table.  */
 
 struct elf_link_hash_table
@@ -377,8 +369,9 @@ struct elf_link_hash_table
      objects included in the link.  */
   struct bfd_link_needed_list *runpath;
 
-  /* Cached start, size and alignment of PT_TLS segment.  */
-  struct elf_link_tls_segment *tls_segment;
+  /* Cached first output tls section and size of PT_TLS segment.  */
+  asection *tls_sec;
+  bfd_size_type tls_size;
 
   /* A linked list of BFD's loaded in the link.  */
   struct elf_link_loaded_list *loaded;
@@ -511,11 +504,16 @@ typedef enum {
 struct bfd_elf_special_section
 {
   const char *prefix;
-  size_t prefix_length;
-  const char *suffix;
-  size_t suffix_length;
+  int prefix_length;
+  /* 0 means name must match PREFIX exactly.
+     -1 means name must start with PREFIX followed by an arbitrary string.
+     -2 means name must match PREFIX exactly or consist of PREFIX followed
+     by a dot then anything.
+     > 0 means name must start with the first PREFIX_LENGTH chars of
+     PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX.  */
+  int suffix_length;
   int type;
-  int attributes;
+  int attr;
 };
 
 struct elf_backend_data
@@ -800,7 +798,7 @@ struct elf_backend_data
      newly created and plt/got refcounts and dynamic indices should not
      be copied.  */
   void (*elf_backend_copy_indirect_symbol)
-    (struct elf_backend_data *, struct elf_link_hash_entry *,
+    (const struct elf_backend_data *, struct elf_link_hash_entry *,
      struct elf_link_hash_entry *);
 
   /* Modify any information related to dynamic linking such that the
@@ -808,6 +806,11 @@ struct elf_backend_data
   void (*elf_backend_hide_symbol)
     (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
 
+  /* Merge the backend specific symbol attribute.  */
+  void (*elf_backend_merge_symbol_attribute)
+    (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean,
+     bfd_boolean);
+
   /* Emit relocations.  Overrides default routine for emitting relocs,
      except during a relocatable link, or if all relocs are being emitted.  */
   bfd_boolean (*elf_backend_emit_relocs)
@@ -884,10 +887,9 @@ struct elf_backend_data
      .got section */
   bfd_vma got_symbol_offset;
 
-  /* The size in bytes of the headers for the GOT and PLT.  This includes
-     the so-called reserved entries on some systems.  */
+  /* The size in bytes of the header for the GOT.  This includes the
+     so-called reserved entries on some systems.  */
   bfd_vma got_header_size;
-  bfd_vma plt_header_size;
 
   /* This is TRUE if the linker should act like collect and gather
      global constructors and destructors by name.  This is TRUE for
@@ -1003,7 +1005,7 @@ struct bfd_elf_section_data
     const char *name;
 
     /* Group signature sym, if this is the SHT_GROUP section.  */
-    struct symbol_cache_entry *id;
+    struct bfd_symbol *id;
   } group;
 
   /* A linked list of sections in the group.  Circular when used by
@@ -1029,7 +1031,7 @@ struct bfd_elf_section_data
    && sec->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
 
 #define get_elf_backend_data(abfd) \
-  ((struct elf_backend_data *) (abfd)->xvec->backend_data)
+  ((const struct elf_backend_data *) (abfd)->xvec->backend_data)
 
 /* This struct is used to pass information to routines called via
    elf_link_hash_traverse which must return failure.  */
@@ -1319,7 +1321,7 @@ extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
 extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
   (bfd *);
 extern void _bfd_elf_link_hash_copy_indirect
-  (struct elf_backend_data *, struct elf_link_hash_entry *,
+  (const struct elf_backend_data *, struct elf_link_hash_entry *,
    struct elf_link_hash_entry *);
 extern void _bfd_elf_link_hash_hide_symbol
   (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
@@ -1332,7 +1334,7 @@ extern bfd_boolean _bfd_elf_slurp_version_tables
 extern bfd_boolean _bfd_elf_merge_sections
   (bfd *, struct bfd_link_info *);
 extern bfd_boolean bfd_elf_discard_group
-  (bfd *, struct sec *);
+  (bfd *, struct bfd_section *);
 extern void bfd_elf_set_group_contents
   (bfd *, asection *, void *);
 extern void _bfd_elf_link_just_syms
@@ -1346,10 +1348,10 @@ extern bfd_boolean _bfd_elf_write_object_contents
 extern bfd_boolean _bfd_elf_write_corefile_contents
   (bfd *);
 extern bfd_boolean _bfd_elf_set_section_contents
-  (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
+  (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
 extern long _bfd_elf_get_symtab_upper_bound
   (bfd *);
-extern long _bfd_elf_get_symtab
+extern long _bfd_elf_canonicalize_symtab
   (bfd *, asymbol **);
 extern long _bfd_elf_get_dynamic_symtab_upper_bound
   (bfd *);
@@ -1384,8 +1386,8 @@ extern bfd_boolean _bfd_elf_new_section_hook
   (bfd *, asection *);
 extern bfd_boolean _bfd_elf_init_reloc_shdr
   (bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean);
-extern bfd_boolean _bfd_elf_get_sec_type_attr
-  (bfd *, const char *, int *, int *);
+extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
+  (bfd *, const char *);
 
 /* If the target doesn't have reloc handling written yet:  */
 extern void _bfd_elf_no_info_to_howto
@@ -1624,7 +1626,7 @@ extern int elf_link_record_local_dynamic_symbol
 extern bfd_boolean _bfd_elf_close_and_cleanup
   (bfd *);
 extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
-  (bfd *, arelent *, struct symbol_cache_entry *, void *,
+  (bfd *, arelent *, struct bfd_symbol *, void *,
    asection *, bfd *, char **);
 
 extern bfd_boolean _bfd_elf32_gc_sections
@@ -1682,4 +1684,60 @@ extern bfd *_bfd_elf64_bfd_from_remote_memory
 extern bfd_boolean _sh_elf_set_mach_from_flags
   (bfd *);
 
+/* This macro is to avoid lots of duplicated code in the body
+   of xxx_relocate_section() in the various elfxx-xxxx.c files.  */
+#define RELOC_FOR_GLOBAL_SYMBOL(h, sym_hashes, r_symndx, symtab_hdr, relocation, sec, unresolved_reloc, info, warned)  \
+  do                                                                                                                   \
+    {                                                                                                                  \
+      /* It seems this can happen with erroneous or unsupported                                                                \
+        input (mixing a.out and elf in an archive, for example.)  */                                                   \
+      if (sym_hashes == NULL)                                                                                          \
+       return FALSE;                                                                                                   \
+                                                                                                                       \
+      h = sym_hashes[r_symndx - symtab_hdr->sh_info];                                                                  \
+                                                                                                                       \
+      while (h->root.type == bfd_link_hash_indirect                                                                    \
+            || h->root.type == bfd_link_hash_warning)                                                                  \
+       h = (struct elf_link_hash_entry *) h->root.u.i.link;                                                            \
+                                                                                                                       \
+      warned = FALSE;                                                                                                  \
+      unresolved_reloc = FALSE;                                                                                                \
+      relocation = 0;                                                                                                  \
+      if (h->root.type == bfd_link_hash_defined                                                                                \
+         || h->root.type == bfd_link_hash_defweak)                                                                     \
+       {                                                                                                               \
+         sec = h->root.u.def.section;                                                                                  \
+         if (sec == NULL                                                                                               \
+             || sec->output_section == NULL)                                                                           \
+           /* Set a flag that will be cleared later if we find a                                                       \
+              relocation value for this symbol.  output_section                                                        \
+              is typically NULL for symbols satisfied by a shared                                                      \
+              library.  */                                                                                             \
+           unresolved_reloc = TRUE;                                                                                    \
+         else                                                                                                          \
+           relocation = (h->root.u.def.value                                                                           \
+                         + sec->output_section->vma                                                                    \
+                         + sec->output_offset);                                                                        \
+       }                                                                                                               \
+      else if (h->root.type == bfd_link_hash_undefweak)                                                                        \
+       ;                                                                                                               \
+      else if (!info->executable                                                                                       \
+              && info->unresolved_syms_in_objects == RM_IGNORE                                                         \
+              && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)                                                          \
+       ;                                                                                                               \
+      else                                                                                                             \
+       {                                                                                                               \
+         if (! info->callbacks->undefined_symbol                                                                       \
+             (info, h->root.root.string, input_bfd,                                                                    \
+              input_section, rel->r_offset,                                                                            \
+              ((info->shared && info->unresolved_syms_in_shared_libs == RM_GENERATE_ERROR)                             \
+               || (!info->shared && info->unresolved_syms_in_objects == RM_GENERATE_ERROR)                             \
+               || ELF_ST_VISIBILITY (h->other))                                                                        \
+              ))                                                                                                       \
+           return FALSE;                                                                                               \
+         warned = TRUE;                                                                                                \
+       }                                                                                                               \
+    }                                                                                                                  \
+  while (0)
+
 #endif /* _LIBELF_H_ */
This page took 0.02807 seconds and 4 git commands to generate.