32-bit powerpc's elf_reloc_internal has no support for R_PPC_JMP_SLOT but clang with devel/powerpc64-binutils uses such for building kernel modules

Mark Millard via freebsd-ppc <[email protected]>
Newsgroups gmane.os.freebsd.devel.ppc
Message-ID <[email protected]>
/usr/src/sys/powerpc/powerpc/elf64_machdep.c has:

static int
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
    int type, int local, elf_lookup_fn lookup)
{
. . .
        case R_PPC_JMP_SLOT:    /* function descriptor copy */
                lookup(lf, symidx, 1, &addr);
#if !defined(_CALL_ELF) || _CALL_ELF == 1
                memcpy(where, (Elf_Addr *)addr, 3*sizeof(Elf_Addr));
#else
                *where = addr;
#endif
                __asm __volatile("dcbst 0,%0; sync" :: "r"(where) : "memory");
                break;

. . .

But /usr/src/sys/powerpc/powerpc/elf32_machdep.c 's elf_reloc_internal
does not have any R_PPC_JMP_SLOT case in its code.

Yet, from using clang as the system compiler for targeting 32-bit powerpc,
readelf -asW /boot/kernel/if_gem.ko shows the likes of:

Relocation section with addend (.rela.plt):
r_offset r_info   r_type              st_value st_name + r_addend
00018328 00000215 R_PPC_JMP_SLOT      00000000 if_maddr_runlock + 0
00018330 00000315 R_PPC_JMP_SLOT      00000000 mii_mediachg + 0
00018338 00000415 R_PPC_JMP_SLOT      00000000 m_freem + 0
00018340 00000515 R_PPC_JMP_SLOT      00000000 device_get_softc + 0
00018348 00000715 R_PPC_JMP_SLOT      00000000 device_set_desc + 0
00018350 00000815 R_PPC_JMP_SLOT      00000000 printf + 0
00018358 00000b15 R_PPC_JMP_SLOT      00000000 ether_crc32_le + 0
00018360 00000e15 R_PPC_JMP_SLOT      00000000 bpf_mtap + 0
. . .

# file /boot/kernel/if_gem.ko
/boot/kernel/if_gem.ko: ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (FreeBSD), dynamically linked, BuildID[sha1]=013a358835fddcd6bbb82d35a6ce36243eccb743, not stripped

So, naturally, module loading such (manual or automatic)
is a problem for the 32-bit powerpc context.

The context was head -r347549 .

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ppc
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.