/* r2 is the TOC pointer: it actually points 0x8000 into the TOC (this gives the value maximum span in an instruction which uses a signed offset) */ unsigned long my_r2(const struct mem_ehdr *ehdr) { struct mem_shdr *shdr; shdr = toc_section(ehdr); if (!shdr) { die("TOC reloc without a toc section?"); } return shdr->sh_addr + 0x8000; }
int machine_verify_elf_rel(struct mem_ehdr *ehdr) { struct mem_shdr *toc; if (ehdr->ei_class != ELFCLASS64) { return 0; } if (ehdr->e_machine != EM_PPC64) { return 0; } /* Ensure .toc is sufficiently aligned. */ toc = toc_section(ehdr); if (toc && toc->sh_addralign < 256) toc->sh_addralign = 256; return 1; }