Make sure to relocate tmpstk with everything else and avoid processing

non-relative relocations that the UART code makes for absent modules.
This commit is contained in:
Nathan Whitehorn 2015-01-21 19:09:15 +00:00
parent 554dab448e
commit 7a28efd9ee
2 changed files with 8 additions and 2 deletions

View File

@ -126,9 +126,14 @@ ASENTRY_NOPROF(__start)
ld %r1,0(%r2)
add %r2,%r1,%r2
/* Get load offset */
ld %r31,-0x8000(%r2) /* First TOC entry is TOC base */
subf %r31,%r31,%r2 /* Subtract from real TOC base to get base */
/* Set up the stack pointer */
ld %r1,TOC_REF(tmpstk)(%r2)
addi %r1,%r1,TMPSTKSZ-96
add %r1,%r1,%r31
/* Relocate kernel */
std %r3,48(%r1)
@ -140,8 +145,7 @@ ASENTRY_NOPROF(__start)
1: mflr %r3
ld %r4,0(%r3)
add %r3,%r4,%r3
ld %r4,-0x8000(%r2) /* First TOC entry is TOC base */
subf %r4,%r4,%r2 /* Subtract from real TOC base to get base */
mr %r4,%r31
bl elf_reloc_self
nop
ld %r3,48(%r1)

View File

@ -226,6 +226,8 @@ elf_reloc_self(Elf_Dyn *dynp, Elf_Addr relocbase)
*/
relalim = (Elf_Rela *)((caddr_t)rela + relasz);
for (; rela < relalim; rela++) {
if (ELF_R_TYPE(rela->r_info) != R_PPC_RELATIVE)
continue;
where = (Elf_Addr *)(relocbase + rela->r_offset);
*where = (Elf_Addr)(relocbase + rela->r_addend);
}