ppc64: Don't look for the TOC pointer all the time
Subsystems (2)
PATCH 1/1 ppc64: Don't look for the TOC pointer all the time
When dealing with the purgatory's relocation, the TOC pointer is computed by looking at the ".toc" section's address.
This should be done only once and the result kept back to avoid scanning all the ELF section each time a TOC relative relocation is processed.
Signed-off-by Laurent Dufour <[email protected]>
--- kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
kexec/arch/ppc64/kexec-elf-rel-ppc64.c +9 -5
@@ -1,4 +1,4 @@ -#include <stdio.h> +#include <stdio.h> #include <elf.h> #include <string.h> #include "../../kexec.h"
@@ -40,13 +40,17 @@ static struct mem_shdr *toc_section(const struct mem_ehdr *ehdr)unsigned long my_r2 (const struct mem_ehdr *ehdr) {struct mem_shdr *shdr; +static unsigned long r2 =0 ; - shdr =toc_section (ehdr); -if (!shdr) { -die ("TOC reloc without a toc section?" ); +if (!r2) { + shdr =toc_section (ehdr); +if (!shdr) { +die ("TOC reloc without a toc section?" ); + } + r2 = shdr->sh_addr +0x8000 ; } -return shdr->sh_addr +0x8000 ; +return r2; } static void do_relative_toc(unsigned long value, uint16_t *location,
Signature · 7 lines
1.9.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec