gas/arc: Additional work to support multiple arc_opcode chains
[deliverable/binutils-gdb.git] / bfd / elf32-arc.c
index 6facd92087817c25292903fa4db6113a991e5903..323f65d0bbec6e4c322103b339c148c897c1b882 100644 (file)
@@ -1735,7 +1735,8 @@ elf_arc_check_relocs (bfd *                        abfd,
               non-readonly sections.  */
            if (bfd_link_dll (info) && !bfd_link_pie (info)
                && (sec->flags & SEC_ALLOC) != 0
-               && (sec->flags & SEC_READONLY) != 0)
+               && (sec->flags & SEC_READONLY) == 0
+               && (sec->flags & SEC_CODE) != 0)
              {
                const char *name;
                if (h)
@@ -1959,7 +1960,7 @@ plt_do_relocs_for_symbol (bfd *abfd,
 
       /* TODO: being ME is not a property of the relocation but of the
         section of which is applying the relocation. */
-      if (IS_MIDDLE_ENDIAN (reloc->symbol) || bfd_big_endian (abfd))
+      if (IS_MIDDLE_ENDIAN (reloc->symbol) && !bfd_big_endian (abfd))
        {
          relocation =
              ((relocation & 0xffff0000) >> 16) |
@@ -2003,9 +2004,19 @@ GOT_ENTRY_OFFSET = 0x%x, GOT_ENTRY_VMA = 0x%x, for symbol %s\n",
             + got_offset,
             h->root.root.string);
 
-  memcpy (htab->splt->contents + h->plt.offset,
-         plt_data->elem,
-         plt_data->elem_size);
+
+  {
+    bfd_vma i = 0;
+    uint16_t *ptr = (uint16_t *) plt_data->elem;
+    for (i = 0; i < plt_data->elem_size/2; i++)
+      {
+       uint16_t data = ptr[i];
+       bfd_put_16 (output_bfd,
+                   (bfd_vma) data,
+                   htab->splt->contents + h->plt.offset + (i*2));
+      }
+  }
+
   plt_do_relocs_for_symbol (output_bfd, htab,
                            plt_data->elem_relocs,
                            h->plt.offset,
@@ -2043,8 +2054,17 @@ relocate_plt_for_entry (bfd *abfd,
   struct plt_version_t *plt_data = arc_get_plt_version (info);
   struct elf_link_hash_table *htab = elf_hash_table (info);
 
-  memcpy (htab->splt->contents, plt_data->entry,
-         plt_data->entry_size);
+  {
+    bfd_vma i = 0;
+    uint16_t *ptr = (uint16_t *) plt_data->entry;
+    for (i = 0; i < plt_data->entry_size/2; i++)
+      {
+       uint16_t data = ptr[i];
+       bfd_put_16 (abfd,
+                   (bfd_vma) data,
+                   htab->splt->contents + (i*2));
+      }
+  }
   PLT_DO_RELOCS_FOR_ENTRY (abfd, htab, plt_data->entry_relocs);
 }
 
This page took 0.023992 seconds and 4 git commands to generate.