Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / elf32-or1k.c
index 9b795fb06ed30b56ca8a1a06eb8a952db6ac76c9..41e61ac7e2fcec80071ce91415cf56883b16a696 100644 (file)
@@ -1,5 +1,5 @@
 /* Or1k-specific support for 32-bit ELF.
-   Copyright (C) 2001-2019 Free Software Foundation, Inc.
+   Copyright (C) 2001-2020 Free Software Foundation, Inc.
    Contributed for OR32 by Johan Rydberg, jrydberg@opencores.org
 
    PIC parts added by Stefan Kristiansson, stefan.kristiansson@saunalahti.fi,
@@ -970,7 +970,7 @@ static struct bfd_link_hash_table *
 or1k_elf_link_hash_table_create (bfd *abfd)
 {
   struct elf_or1k_link_hash_table *ret;
-  bfd_size_type amt = sizeof (struct elf_or1k_link_hash_table);
+  size_t amt = sizeof (struct elf_or1k_link_hash_table);
 
   ret = bfd_zmalloc (amt);
   if (ret == NULL)
@@ -1303,7 +1303,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
 
          name = bfd_elf_string_from_elf_section
            (input_bfd, symtab_hdr->sh_link, sym->st_name);
-         name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
+         name = name == NULL ? bfd_section_name (sec) : name;
        }
       else
        {
@@ -2064,8 +2064,7 @@ or1k_elf_check_relocs (bfd *abfd,
                      return FALSE;
 
                    if (strncmp (name, ".rela", 5) != 0
-                       || strcmp (bfd_get_section_name (abfd, sec),
-                                  name + 5) != 0)
+                       || strcmp (bfd_section_name (sec), name + 5) != 0)
                      {
                        _bfd_error_handler
                          /* xgettext:c-format */
@@ -2119,7 +2118,7 @@ or1k_elf_check_relocs (bfd *abfd,
                p = *head;
                if (p == NULL || p->sec != sec)
                  {
-                   bfd_size_type amt = sizeof *p;
+                   size_t amt = sizeof *p;
                    p = ((struct elf_dyn_relocs *)
                         bfd_alloc (htab->root.dynobj, amt));
                    if (p == NULL)
@@ -2377,8 +2376,11 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
       or1k_write_plt_entry (output_bfd, splt->contents + h->plt.offset,
                            plt0, plt1, plt2, OR1K_JR(12));
 
-      /* Fill in the entry in the global offset table.  */
-      bfd_put_32 (output_bfd, plt_addr, sgot->contents + got_offset);
+      /* Fill in the entry in the global offset table.  We initialize it to
+        point to the top of the plt.  This is done to lazy lookup the actual
+        symbol as the first plt entry will be setup by libc to call the
+        runtime dynamic linker.  */
+      bfd_put_32 (output_bfd, plt_base_addr, sgot->contents + got_offset);
 
       /* Fill in the entry in the .rela.plt section.  */
       rela.r_offset = got_addr;
@@ -2993,7 +2995,7 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
          /* Strip this section if we don't need it; see the
             comment below.  */
        }
-      else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
+      else if (CONST_STRNEQ (bfd_section_name (s), ".rela"))
        {
          if (s->size != 0 && s != htab->root.srelplt)
            relocs = TRUE;
@@ -3156,8 +3158,8 @@ or1k_elf_object_p (bfd *abfd)
 
 /* Store the machine number in the flags field.  */
 
-static void
-or1k_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+or1k_elf_final_write_processing (bfd *abfd)
 {
   switch (bfd_get_mach (abfd))
     {
@@ -3168,7 +3170,7 @@ or1k_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
       elf_elfheader (abfd)->e_flags |= EF_OR1K_NODELAY;
       break;
     }
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 static bfd_boolean
This page took 0.029449 seconds and 4 git commands to generate.