| From 2aa455f838644cd804ec93aeea0d30bb265e91df Mon Sep 17 00:00:00 2001 |
| From: Nagaraju Mekala <nmekala@xilix.com> |
| Date: Sat, 13 Oct 2018 21:17:01 +0530 |
| Subject: [PATCH 22/43] Adding new relocation to support 64bit rodata |
| |
| --- |
| bfd/elf64-microblaze.c | 11 +++++++-- |
| 2 files changed, 54 insertions(+), 6 deletions(-) |
| |
| diff --git a/bfd/elf64-microblaze.c b/bfd/elf64-microblaze.c |
| index 40f10aac6d..4d9b90647f 100644 |
| --- a/bfd/elf64-microblaze.c |
| +++ b/bfd/elf64-microblaze.c |
| @@ -1461,6 +1461,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, |
| case (int) R_MICROBLAZE_64_PCREL : |
| case (int) R_MICROBLAZE_64: |
| case (int) R_MICROBLAZE_32: |
| + case (int) R_MICROBLAZE_IMML_64: |
| { |
| /* r_symndx will be STN_UNDEF (zero) only for relocs against symbols |
| from removed linkonce sections, or sections discarded by |
| @@ -1470,6 +1471,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, |
| relocation += addend; |
| if (r_type == R_MICROBLAZE_32)// || r_type == R_MICROBLAZE_IMML_64) |
| bfd_put_32 (input_bfd, relocation, contents + offset); |
| + else if (r_type == R_MICROBLAZE_IMML_64) |
| + bfd_put_64 (input_bfd, relocation, contents + offset); |
| else |
| { |
| if (r_type == R_MICROBLAZE_64_PCREL) |
| @@ -1547,7 +1550,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, |
| } |
| else |
| { |
| - if (r_type == R_MICROBLAZE_32) |
| + if (r_type == R_MICROBLAZE_32 || r_type == R_MICROBLAZE_IMML_64) |
| { |
| outrel.r_info = ELF64_R_INFO (0, R_MICROBLAZE_REL); |
| outrel.r_addend = relocation + addend; |
| @@ -1573,6 +1576,8 @@ microblaze_elf_relocate_section (bfd *output_bfd, |
| relocation += addend; |
| if (r_type == R_MICROBLAZE_32) |
| bfd_put_32 (input_bfd, relocation, contents + offset); |
| + else if (r_type == R_MICROBLAZE_IMML_64) |
| + bfd_put_64 (input_bfd, relocation, contents + offset + endian); |
| else |
| { |
| if (r_type == R_MICROBLAZE_64_PCREL) |
| @@ -2085,7 +2090,8 @@ microblaze_elf_relax_section (bfd *abfd, |
| microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset, |
| irelscan->r_addend); |
| } |
| - if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32) |
| + if (ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32 |
| + || ELF64_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_IMML_64) |
| { |
| isym = isymbuf + ELF64_R_SYM (irelscan->r_info); |
| |
| @@ -2591,6 +2597,7 @@ microblaze_elf_check_relocs (bfd * abfd, |
| case R_MICROBLAZE_64: |
| case R_MICROBLAZE_64_PCREL: |
| case R_MICROBLAZE_32: |
| + case R_MICROBLAZE_IMML_64: |
| { |
| if (h != NULL && !bfd_link_pic (info)) |
| { |
| -- |
| 2.17.1 |
| |