Remove unused variables
[deliverable/binutils-gdb.git] / gdb / elfread.c
index fa900a09b76c7a2db2a154df743b8831de6a0048..e90466b00cb43a6ad5f74bd1ca8be5cdeb27a68b 100644 (file)
@@ -1,6 +1,6 @@
 /* Read ELF (Executable and Linking Format) object files for GDB.
 
-   Copyright (C) 1991-2015 Free Software Foundation, Inc.
+   Copyright (C) 1991-2016 Free Software Foundation, Inc.
 
    Written by Fred Fish at Cygnus Support.
 
@@ -89,7 +89,7 @@ elf_symfile_segments (bfd *abfd)
   if (phdrs_size == -1)
     return NULL;
 
-  phdrs = alloca (phdrs_size);
+  phdrs = (Elf_Internal_Phdr *) alloca (phdrs_size);
   num_phdrs = bfd_get_elf_phdrs (abfd, phdrs);
   if (num_phdrs == -1)
     return NULL;
@@ -233,7 +233,6 @@ elf_symtab_read (struct objfile *objfile, int type,
   asymbol *sym;
   long i;
   CORE_ADDR symaddr;
-  CORE_ADDR offset;
   enum minimal_symbol_type ms_type;
   /* Name of the last file symbol.  This is either a constant string or is
      saved on the objfile's filename cache.  */
@@ -263,8 +262,6 @@ elf_symtab_read (struct objfile *objfile, int type,
          continue;
        }
 
-      offset = ANOFFSET (objfile->section_offsets,
-                        gdb_bfd_section_index (objfile->obfd, sym->section));
       if (type == ST_DYNAMIC
          && sym->section == bfd_und_section_ptr
          && (sym->flags & BSF_FUNCTION))
@@ -338,8 +335,9 @@ elf_symtab_read (struct objfile *objfile, int type,
        continue;
       if (sym->flags & BSF_FILE)
        {
-         filesymname = bcache (sym->name, strlen (sym->name) + 1,
-                               objfile->per_bfd->filename_cache);
+         filesymname
+           = (const char *) bcache (sym->name, strlen (sym->name) + 1,
+                                    objfile->per_bfd->filename_cache);
        }
       else if (sym->flags & BSF_SECTION_SYM)
        continue;
@@ -603,7 +601,7 @@ elf_rel_plt_read (struct objfile *objfile, asymbol **dyn_symbol_table)
       if (string_buffer_size < name_len + got_suffix_len + 1)
        {
          string_buffer_size = 2 * (name_len + got_suffix_len);
-         string_buffer = xrealloc (string_buffer, string_buffer_size);
+         string_buffer = (char *) xrealloc (string_buffer, string_buffer_size);
        }
       memcpy (string_buffer, name, name_len);
       memcpy (&string_buffer[name_len], SYMBOL_GOT_PLT_SUFFIX,
@@ -638,7 +636,8 @@ struct elf_gnu_ifunc_cache
 static hashval_t
 elf_gnu_ifunc_cache_hash (const void *a_voidp)
 {
-  const struct elf_gnu_ifunc_cache *a = a_voidp;
+  const struct elf_gnu_ifunc_cache *a
+    = (const struct elf_gnu_ifunc_cache *) a_voidp;
 
   return htab_hash_string (a->name);
 }
@@ -648,8 +647,10 @@ elf_gnu_ifunc_cache_hash (const void *a_voidp)
 static int
 elf_gnu_ifunc_cache_eq (const void *a_voidp, const void *b_voidp)
 {
-  const struct elf_gnu_ifunc_cache *a = a_voidp;
-  const struct elf_gnu_ifunc_cache *b = b_voidp;
+  const struct elf_gnu_ifunc_cache *a
+    = (const struct elf_gnu_ifunc_cache *) a_voidp;
+  const struct elf_gnu_ifunc_cache *b
+    = (const struct elf_gnu_ifunc_cache *) b_voidp;
 
   return strcmp (a->name, b->name) == 0;
 }
@@ -687,7 +688,7 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
   if (strcmp (bfd_get_section_name (objfile->obfd, sect), ".plt") == 0)
     return 0;
 
-  htab = objfile_data (objfile, elf_objfile_gnu_ifunc_cache_data);
+  htab = (htab_t) objfile_data (objfile, elf_objfile_gnu_ifunc_cache_data);
   if (htab == NULL)
     {
       htab = htab_create_alloc_ex (1, elf_gnu_ifunc_cache_hash,
@@ -702,12 +703,14 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
   obstack_grow (&objfile->objfile_obstack, &entry_local,
                offsetof (struct elf_gnu_ifunc_cache, name));
   obstack_grow_str0 (&objfile->objfile_obstack, name);
-  entry_p = obstack_finish (&objfile->objfile_obstack);
+  entry_p
+    = (struct elf_gnu_ifunc_cache *) obstack_finish (&objfile->objfile_obstack);
 
   slot = htab_find_slot (htab, entry_p, INSERT);
   if (*slot != NULL)
     {
-      struct elf_gnu_ifunc_cache *entry_found_p = *slot;
+      struct elf_gnu_ifunc_cache *entry_found_p
+       = (struct elf_gnu_ifunc_cache *) *slot;
       struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
       if (entry_found_p->addr != addr)
@@ -746,17 +749,18 @@ elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p)
       struct elf_gnu_ifunc_cache *entry_p;
       void **slot;
 
-      htab = objfile_data (objfile, elf_objfile_gnu_ifunc_cache_data);
+      htab = (htab_t) objfile_data (objfile, elf_objfile_gnu_ifunc_cache_data);
       if (htab == NULL)
        continue;
 
-      entry_p = alloca (sizeof (*entry_p) + strlen (name));
+      entry_p = ((struct elf_gnu_ifunc_cache *)
+                alloca (sizeof (*entry_p) + strlen (name)));
       strcpy (entry_p->name, name);
 
       slot = htab_find_slot (htab, entry_p, NO_INSERT);
       if (slot == NULL)
        continue;
-      entry_p = *slot;
+      entry_p = (struct elf_gnu_ifunc_cache *) *slot;
       gdb_assert (entry_p != NULL);
 
       if (addr_p)
@@ -782,7 +786,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
   struct objfile *objfile;
   const size_t got_suffix_len = strlen (SYMBOL_GOT_PLT_SUFFIX);
 
-  name_got_plt = alloca (strlen (name) + got_suffix_len + 1);
+  name_got_plt = (char *) alloca (strlen (name) + got_suffix_len + 1);
   sprintf (name_got_plt, "%s" SYMBOL_GOT_PLT_SUFFIX, name);
 
   ALL_PSPACE_OBJFILES (current_program_space, objfile)
@@ -793,7 +797,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
       size_t ptr_size = TYPE_LENGTH (ptr_type);
       CORE_ADDR pointer_address, addr;
       asection *plt;
-      gdb_byte *buf = alloca (ptr_size);
+      gdb_byte *buf = (gdb_byte *) alloca (ptr_size);
       struct bound_minimal_symbol msym;
 
       msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
@@ -895,7 +899,7 @@ elf_gnu_ifunc_resolver_stop (struct breakpoint *b)
   struct frame_info *prev_frame = get_prev_frame (get_current_frame ());
   struct frame_id prev_frame_id = get_stack_frame_id (prev_frame);
   CORE_ADDR prev_pc = get_frame_pc (prev_frame);
-  int thread_id = pid_to_thread_id (inferior_ptid);
+  int thread_id = ptid_to_global_thread_id (inferior_ptid);
 
   gdb_assert (b->type == bp_gnu_ifunc_resolver);
 
@@ -999,7 +1003,7 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b)
   sals_end.nelts = 0;
 
   b->type = bp_breakpoint;
-  update_breakpoint_locations (b, sals, sals_end);
+  update_breakpoint_locations (b, current_program_space, sals, sals_end);
 }
 
 /* A helper function for elf_symfile_read that reads the minimal
@@ -1058,7 +1062,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
       /* Memory gets permanently referenced from ABFD after
         bfd_canonicalize_symtab so it must not get freed before ABFD gets.  */
 
-      symbol_table = bfd_alloc (abfd, storage_needed);
+      symbol_table = (asymbol **) bfd_alloc (abfd, storage_needed);
       symcount = bfd_canonicalize_symtab (objfile->obfd, symbol_table);
 
       if (symcount < 0)
@@ -1082,7 +1086,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
         done by _bfd_elf_get_synthetic_symtab which is all a bfd
         implementation detail, though.  */
 
-      dyn_symbol_table = bfd_alloc (abfd, storage_needed);
+      dyn_symbol_table = (asymbol **) bfd_alloc (abfd, storage_needed);
       dynsymcount = bfd_canonicalize_dynamic_symtab (objfile->obfd,
                                                     dyn_symbol_table);
 
@@ -1324,7 +1328,7 @@ elf_get_probes (struct objfile *objfile)
   VEC (probe_p) *probes_per_bfd;
 
   /* Have we parsed this objfile's probes already?  */
-  probes_per_bfd = bfd_data (objfile->obfd, probe_key);
+  probes_per_bfd = (VEC (probe_p) *) bfd_data (objfile->obfd, probe_key);
 
   if (!probes_per_bfd)
     {
@@ -1356,7 +1360,7 @@ static void
 probe_key_free (bfd *abfd, void *d)
 {
   int ix;
-  VEC (probe_p) *probes = d;
+  VEC (probe_p) *probes = (VEC (probe_p) *) d;
   struct probe *probe;
 
   for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++)
This page took 0.026678 seconds and 4 git commands to generate.