diff options
author | Alan Modra <amodra@gmail.com> | 2003-06-17 12:37:26 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-06-17 12:37:26 +0000 |
commit | dad27d18ac0175ce7d0a2859b9b0e638c3eb46a5 (patch) | |
tree | 9a5ebaabbc752808e3e74477c7293d9b641e159d /bfd/elf64-ppc.c | |
parent | fea39bcb0781e1ee232093500d9ad8844fd23732 (diff) | |
download | gdb-dad27d18ac0175ce7d0a2859b9b0e638c3eb46a5.zip gdb-dad27d18ac0175ce7d0a2859b9b0e638c3eb46a5.tar.gz gdb-dad27d18ac0175ce7d0a2859b9b0e638c3eb46a5.tar.bz2 |
* elf64-ppc.c (ppc64_elf_relocate_section): Optimize unaligned relocs.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r-- | bfd/elf64-ppc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 371abb1..ca58c10 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -8272,6 +8272,26 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, } } + /* Optimize unaligned reloc use. */ + if ((ELF64_R_TYPE (outrel.r_info) == R_PPC64_ADDR64 + && (outrel.r_offset & 7) != 0) + || (ELF64_R_TYPE (outrel.r_info) == R_PPC64_UADDR64 + && (outrel.r_offset & 7) == 0)) + outrel.r_info ^= (ELF64_R_INFO (0, R_PPC64_ADDR64) + ^ ELF64_R_INFO (0, R_PPC64_UADDR64)); + else if ((ELF64_R_TYPE (outrel.r_info) == R_PPC64_ADDR32 + && (outrel.r_offset & 3) != 0) + || (ELF64_R_TYPE (outrel.r_info) == R_PPC64_UADDR32 + && (outrel.r_offset & 3) == 0)) + outrel.r_info ^= (ELF64_R_INFO (0, R_PPC64_ADDR32) + ^ ELF64_R_INFO (0, R_PPC64_UADDR32)); + else if ((ELF64_R_TYPE (outrel.r_info) == R_PPC64_ADDR16 + && (outrel.r_offset & 1) != 0) + || (ELF64_R_TYPE (outrel.r_info) == R_PPC64_UADDR16 + && (outrel.r_offset & 1) == 0)) + outrel.r_info ^= (ELF64_R_INFO (0, R_PPC64_ADDR16) + ^ ELF64_R_INFO (0, R_PPC64_UADDR16)); + sreloc = elf_section_data (input_section)->sreloc; if (sreloc == NULL) abort (); |