Date: Wed, 10 Jul 2024 21:28:34 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 7bbcbd43c53b - main - libdtrace: Compute the relocation offset for all non-ET_REL objects Message-ID: <202407102128.46ALSY0N012487@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7bbcbd43c53b49360969ca82b152fd6d971e9055 commit 7bbcbd43c53b49360969ca82b152fd6d971e9055 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-07-10 21:21:54 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-07-10 21:21:54 +0000 libdtrace: Compute the relocation offset for all non-ET_REL objects The use of an ifdef here most likely carries over from when the dtrace port only worked on x86 platforms. MFC after: 2 weeks Sponsored by: Innovate UK --- .../opensolaris/lib/libdtrace/common/dt_module.c | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c index 6fb9b0f84769..2a0386c33124 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c @@ -1251,19 +1251,21 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat) * [Text][R/O data][R/W data][Dynamic][BSS][Non loadable] */ dmp->dm_text_size = dmp->dm_data_va - dmp->dm_text_va; -#if defined(__i386__) - /* - * Find the first load section and figure out the relocation - * offset for the symbols. The kernel module will not need - * relocation, but the kernel linker modules will. - */ - for (i = 0; gelf_getphdr(dmp->dm_elf, i, &ph) != NULL; i++) { - if (ph.p_type == PT_LOAD) { - dmp->dm_reloc_offset = k_stat->address - ph.p_vaddr; - break; + + if (!is_elf_obj) { + /* + * Find the first load section and figure out the relocation + * offset for the symbols. The kernel module will not need + * relocation, but the kernel linker modules will. + */ + for (i = 0; gelf_getphdr(dmp->dm_elf, i, &ph) != NULL; i++) { + if (ph.p_type == PT_LOAD) { + dmp->dm_reloc_offset = + k_stat->address - ph.p_vaddr; + break; + } } } -#endif if (dmp->dm_info.objfs_info_primary) dmp->dm_flags |= DT_DM_PRIMARY;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407102128.46ALSY0N012487>