Date: Mon, 7 Jul 2025 20:17:12 +0000 From: "markj (Mark Johnston)" <phabric-noreply@FreeBSD.org> To: Phabricator <phabric-noreply@FreeBSD.org> Cc: freebsd-dtrace@freebsd.org Subject: [Differential] D51188: dtrace: fix symbol address resolving Message-ID: <9643ce462338dde239710adbeb87539d@localhost.localdomain> In-Reply-To: <differential-rev-PHID-DREV-b4356atzpi5p55s5zcd7-req@reviews.freebsd.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rG12bef37a824c: dtrace: fix symbol address resolution (authored by zldrobit_gmail.com, committed by markj). REPOSITORY rG FreeBSD src repository CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D51188?vs=158120&id=158127 CHANGES SINCE LAST ACTION https://reviews.freebsd.org/D51188/new/ REVISION DETAIL https://reviews.freebsd.org/D51188 AFFECTED FILES cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: zldrobit_gmail.com, #dtrace, gnn, markj Cc: markj, avg, freebsd-dtrace-list, imp, me_reviews.freebsd_lelf.lu, kpraveen.lkml_gmail.com, bkidney_briankidney.ca, dnelson_1901_yahoo.com, yan.jurak_gmail.com, bcr, lwhsu, jonathan, pstef [-- Attachment #2 --] diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c @@ -109,8 +109,7 @@ if (sym->st_name == 0 || sym->st_name >= ss_size) continue; /* skip null or invalid names */ - if (sym->st_value != 0 && - (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) { + if (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size) { asrsv++; /* reserve space in the address map */ #if defined(__FreeBSD__) @@ -159,8 +158,7 @@ if (sym->st_name == 0 || sym->st_name >= ss_size) continue; /* skip null or invalid names */ - if (sym->st_value != 0 && - (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) { + if (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size) { asrsv++; /* reserve space in the address map */ #if defined(__FreeBSD__) sym->st_value += (Elf_Addr) dmp->dm_reloc_offset; @@ -245,8 +243,7 @@ for (i = 1; i < n; i++, dsp++) { Elf32_Sym *sym = symtab + dsp->ds_symid; - if (sym->st_value != 0 && - (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) + if (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size) *sympp++ = sym; } @@ -269,8 +266,7 @@ for (i = 1; i < n; i++, dsp++) { Elf64_Sym *sym = symtab + dsp->ds_symid; - if (sym->st_value != 0 && - (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) + if (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size) *sympp++ = sym; } @@ -1218,7 +1214,7 @@ continue; /* skip any malformed sections */ if (sh.sh_size == 0) continue; - if (sh.sh_type == SHT_PROGBITS || sh.sh_type == SHT_NOBITS) { + if (sh.sh_flags & SHF_ALLOC) { alignmask = sh.sh_addralign - 1; mapbase += alignmask; mapbase &= ~alignmask;help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9643ce462338dde239710adbeb87539d>
