Brad Bishop | 286d45c | 2018-10-02 15:21:57 -0400 | [diff] [blame] | 1 | From c9f1f07e5b0756069e3d4b04eb9505027f09677f Mon Sep 17 00:00:00 2001 |
| 2 | From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> |
| 3 | Date: Tue, 14 Feb 2012 01:00:22 +0100 |
| 4 | Subject: [PATCH 13/16] [LOCAL]: Fix relaxation of assembler resolved |
| 5 | references |
| 6 | |
| 7 | Upstream-Status: Pending |
| 8 | --- |
| 9 | bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++++++++++ |
| 10 | 1 file changed, 39 insertions(+) |
| 11 | |
| 12 | diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c |
| 13 | index cbd18f0..f90df47 100644 |
| 14 | --- a/bfd/elf32-microblaze.c |
| 15 | +++ b/bfd/elf32-microblaze.c |
| 16 | @@ -1968,6 +1968,45 @@ microblaze_elf_relax_section (bfd *abfd, |
| 17 | irelscanend = irelocs + o->reloc_count; |
| 18 | for (irelscan = irelocs; irelscan < irelscanend; irelscan++) |
| 19 | { |
| 20 | + if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE) |
| 21 | + { |
| 22 | + unsigned int val; |
| 23 | + |
| 24 | + isym = isymbuf + ELF32_R_SYM (irelscan->r_info); |
| 25 | + |
| 26 | + /* This was a PC-relative instruction that was completely resolved. */ |
| 27 | + if (ocontents == NULL) |
| 28 | + { |
| 29 | + if (elf_section_data (o)->this_hdr.contents != NULL) |
| 30 | + ocontents = elf_section_data (o)->this_hdr.contents; |
| 31 | + else |
| 32 | + { |
| 33 | + /* We always cache the section contents. |
| 34 | + Perhaps, if info->keep_memory is FALSE, we |
| 35 | + should free them, if we are permitted to. */ |
| 36 | + |
| 37 | + if (o->rawsize == 0) |
| 38 | + o->rawsize = o->size; |
| 39 | + ocontents = (bfd_byte *) bfd_malloc (o->rawsize); |
| 40 | + if (ocontents == NULL) |
| 41 | + goto error_return; |
| 42 | + if (!bfd_get_section_contents (abfd, o, ocontents, |
| 43 | + (file_ptr) 0, |
| 44 | + o->rawsize)) |
| 45 | + goto error_return; |
| 46 | + elf_section_data (o)->this_hdr.contents = ocontents; |
| 47 | + } |
| 48 | + } |
| 49 | + |
| 50 | + irelscan->r_addend -= calc_fixup (irelscan->r_addend |
| 51 | + + isym->st_value, sec); |
| 52 | + val = bfd_get_32 (abfd, ocontents + irelscan->r_offset); |
| 53 | + microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, |
| 54 | + irelscan->r_addend); |
| 55 | + } |
| 56 | + if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) { |
| 57 | + fprintf(stderr, "Unhandled NONE 64\n"); |
| 58 | + } |
| 59 | if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) |
| 60 | { |
| 61 | isym = isymbuf + ELF32_R_SYM (irelscan->r_info); |
| 62 | -- |
| 63 | 1.9.0 |
| 64 | |