Parse the R_MIPS_32 and R_MIPS_64 relocations. Both Elf_Rel and
Elf_Rela relocations are handled since O32 MIPS uses Elf_Rel while N64
uses Elf_Rela. Note that R_MIPS_32 is only handled for 32-bit mips and
R_MIPS_64 for 64-bit. N32 is untested.
Details
- Reviewers
imp - Commits
- rS346651: Parse MIPS relocations to unbreak kldxref on MIPS.
- kldxref on mips and mips64 instances in qemu. All the warnings and errors on boot are now gone.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
So this looks good to me. Having at least mips64 covered, even if other things are unknown is a win. one question about r_mips_32 to think about.
usr.sbin/kldxref/ef_mips.c | ||
---|---|---|
77 โ | (On Diff #56027) | Do you need a cast here to where to only write 4 bytes instead of 8? |
usr.sbin/kldxref/ef_mips.c | ||
---|---|---|
77 โ | (On Diff #56027) | Hmm, this matches what the kernel code does. I didn't have any relevant R_MIPS_32 relocations in mips64 kernel modules though. Maybe I'll spin up a 32-bit mips qemu instance to see what happens there. It may be that I end up just using an #ifdef on the ABI for R_MIPS_32 vs R_MIPS_64 and the body of the case is the one for R_MIPS_64. |
- Tested and now works on o32 mips. o32 uses Elf_Rel instead of Elf_Rela. I didn't bother supporting R_MIPS_32 on mips64, only for 32-bit. I haven't tested n32, but I also mostly don't care about n32.
n32 has 64-bit registers, but 32-bit pointers. It doesn't define LP64, nor does it have 64-bit addresses, so it shouldn't ever generate R_MIPS_64 entries. We should be fine, though I agree that an n32 *KERNEL* is an odd duck.