Date: Mon, 20 May 2019 02:41:09 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r347985 - head/sys/dev/ksyms Message-ID: <201905200241.x4K2f9Tt082233@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Mon May 20 02:41:09 2019 New Revision: 347985 URL: https://svnweb.freebsd.org/changeset/base/347985 Log: ksyms: Fixup symbols for powerpc in the kernel, not just modules Summary: PowerPC kernels are fully position independent, just like kernel modules. The same fixups that are done for modules therefore need to be done to the kernel, else symbol resolution in, e.g., DTrace, cannot resolve the kernel symbols, so only addresses in the kernel are printed, while kernel module symbols are printed. Test Plan: Run lockstat on powerpc64. Note symbols are resolved for kernel and modules. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D20316 Modified: head/sys/dev/ksyms/ksyms.c Modified: head/sys/dev/ksyms/ksyms.c ============================================================================== --- head/sys/dev/ksyms/ksyms.c Mon May 20 00:38:23 2019 (r347984) +++ head/sys/dev/ksyms/ksyms.c Mon May 20 02:41:09 2019 (r347985) @@ -191,6 +191,7 @@ ksyms_add(linker_file_t lf, void *arg) size_t len, numsyms, strsz, symsz; linker_symval_t symval; int error, i, nsyms; + bool fixup; buf = malloc(SYMBLKSZ, M_KSYMS, M_WAITOK); to = arg; @@ -201,6 +202,12 @@ ksyms_add(linker_file_t lf, void *arg) strsz = LINKER_STRTAB_GET(lf, &strtab); symsz = numsyms * sizeof(Elf_Sym); +#ifdef __powerpc__ + fixup = true; +#else + fixup = lf->id > 1; +#endif + while (symsz > 0) { len = min(SYMBLKSZ, symsz); bcopy(symtab, buf, len); @@ -214,7 +221,7 @@ ksyms_add(linker_file_t lf, void *arg) nsyms = len / sizeof(Elf_Sym); for (i = 0; i < nsyms; i++) { symp[i].st_name += to->to_stridx; - if (lf->id > 1 && LINKER_SYMBOL_VALUES(lf, + if (fixup && LINKER_SYMBOL_VALUES(lf, (c_linker_sym_t)&symtab[i], &symval) == 0) { symp[i].st_value = (uintptr_t)symval.value; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905200241.x4K2f9Tt082233>