* elf64-ppc.c (ppc64_elf_relocate_section): Optimize unaligned relocs.

This commit is contained in:
Alan Modra 2003-06-17 12:37:26 +00:00
parent fea39bcb07
commit dad27d18ac
2 changed files with 24 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2003-06-17 Alan Modra <amodra@bigpond.net.au>
* elf64-ppc.c (ppc64_elf_relocate_section): Optimize unaligned relocs.
2003-06-17 Nick Clifton <nickc@redhat.com>
* elflink.h (elf_gc_record_vtentry): Allocate an extra element

View file

@ -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 ();