* [PATCH ARC 5/5] PLT content endianess awareness
@ 2016-04-04 12:51 Cupertino Miranda
2016-04-05 14:32 ` Nick Clifton
0 siblings, 1 reply; 3+ messages in thread
From: Cupertino Miranda @ 2016-04-04 12:51 UTC (permalink / raw)
To: binutils; +Cc: Claudiu Zissulescu, Francois Bedard
[-- Attachment #1: Type: text/plain, Size: 332 bytes --]
Hi all,
Please review.
PLT content was ignoring endianess of the target architecture. It was
always being written in little endian format.
Best regards,
Cupertino
bfd/ChangeLog:
Cupertino Miranda <cmiranda@synopsys.com>
elf32-arc.c (plt_do_relocs_for_symbol): Changed.
(relocate_plt_for_entry): Likewise.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0005-Fix-PLT-section-content-filling-on-big-endian.patch --]
[-- Type: text/x-patch; name="0005-Fix-PLT-section-content-filling-on-big-endian.patch", Size: 1718 bytes --]
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index e369e20..d286371 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1961,7 +1961,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) |
@@ -2005,9 +2005,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);
+
+ {
+ int 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,
@@ -2045,8 +2055,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);
+ {
+ int 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);
}
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH ARC 5/5] PLT content endianess awareness
2016-04-04 12:51 [PATCH ARC 5/5] PLT content endianess awareness Cupertino Miranda
@ 2016-04-05 14:32 ` Nick Clifton
2016-04-05 15:28 ` Claudiu Zissulescu
0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2016-04-05 14:32 UTC (permalink / raw)
To: Cupertino Miranda, binutils; +Cc: Claudiu Zissulescu, Francois Bedard
Hi Cupertino,
> bfd/ChangeLog:
>
> Cupertino Miranda <cmiranda@synopsys.com>
> elf32-arc.c (plt_do_relocs_for_symbol): Changed.
> (relocate_plt_for_entry): Likewise.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH ARC 5/5] PLT content endianess awareness
2016-04-05 14:32 ` Nick Clifton
@ 2016-04-05 15:28 ` Claudiu Zissulescu
0 siblings, 0 replies; 3+ messages in thread
From: Claudiu Zissulescu @ 2016-04-05 15:28 UTC (permalink / raw)
To: Nick Clifton, Cupertino Miranda, binutils; +Cc: Francois Bedard
Committed.
Thank you,
Claudiu
> > bfd/ChangeLog:
> >
> > Cupertino Miranda <cmiranda@synopsys.com>
> > elf32-arc.c (plt_do_relocs_for_symbol): Changed.
> > (relocate_plt_for_entry): Likewise.
>
> Approved - please apply.
>
> Cheers
> Nick
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-05 15:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-04 12:51 [PATCH ARC 5/5] PLT content endianess awareness Cupertino Miranda
2016-04-05 14:32 ` Nick Clifton
2016-04-05 15:28 ` Claudiu Zissulescu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).