diff options
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/libdtrace/common/dt_module.c | 16 | ||||
-rw-r--r-- | usr/src/lib/libproc/common/Psymtab.c | 12 |
2 files changed, 19 insertions, 9 deletions
diff --git a/usr/src/lib/libdtrace/common/dt_module.c b/usr/src/lib/libdtrace/common/dt_module.c index 25197031ce..51a1bdd0d1 100644 --- a/usr/src/lib/libdtrace/common/dt_module.c +++ b/usr/src/lib/libdtrace/common/dt_module.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/modctl.h> #include <sys/kobj.h> @@ -66,6 +64,10 @@ dt_module_symhash_insert(dt_module_t *dmp, const char *name, uint_t id) static uint_t dt_module_syminit32(dt_module_t *dmp) { +#if STT_NUM != (STT_IFUNC + 1) +#error "STT_NUM has grown. update dt_module_syminit32()" +#endif + const Elf32_Sym *sym = dmp->dm_symtab.cts_data; const char *base = dmp->dm_strtab.cts_data; size_t ss_size = dmp->dm_strtab.cts_size; @@ -76,7 +78,7 @@ dt_module_syminit32(dt_module_t *dmp) const char *name = base + sym->st_name; uchar_t type = ELF32_ST_TYPE(sym->st_info); - if (type >= STT_NUM || type == STT_SECTION) + if (type >= STT_IFUNC || type == STT_SECTION) continue; /* skip sections and unknown types */ if (sym->st_name == 0 || sym->st_name >= ss_size) @@ -95,6 +97,10 @@ dt_module_syminit32(dt_module_t *dmp) static uint_t dt_module_syminit64(dt_module_t *dmp) { +#if STT_NUM != (STT_IFUNC + 1) +#error "STT_NUM has grown. update dt_module_syminit64()" +#endif + const Elf64_Sym *sym = dmp->dm_symtab.cts_data; const char *base = dmp->dm_strtab.cts_data; size_t ss_size = dmp->dm_strtab.cts_size; @@ -105,7 +111,7 @@ dt_module_syminit64(dt_module_t *dmp) const char *name = base + sym->st_name; uchar_t type = ELF64_ST_TYPE(sym->st_info); - if (type >= STT_NUM || type == STT_SECTION) + if (type >= STT_IFUNC || type == STT_SECTION) continue; /* skip sections and unknown types */ if (sym->st_name == 0 || sym->st_name >= ss_size) diff --git a/usr/src/lib/libproc/common/Psymtab.c b/usr/src/lib/libproc/common/Psymtab.c index 0a5c3dedd1..c279bdcd6a 100644 --- a/usr/src/lib/libproc/common/Psymtab.c +++ b/usr/src/lib/libproc/common/Psymtab.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -2753,6 +2753,10 @@ static int Psymbol_iter_com(struct ps_prochandle *P, Lmid_t lmid, const char *object_name, int which, int mask, pr_order_t order, proc_xsym_f *func, void *cd) { +#if STT_NUM != (STT_IFUNC + 1) +#error "STT_NUM has grown. update Psymbol_iter_com()" +#endif + GElf_Sym sym; GElf_Shdr shdr; map_info_t *mptr; @@ -2833,11 +2837,11 @@ Psymbol_iter_com(struct ps_prochandle *P, Lmid_t lmid, const char *object_name, * In case you haven't already guessed, this relies on * the bitmask used in <libproc.h> for encoding symbol * type and binding matching the order of STB and STT - * constants in <sys/elf.h>. ELF can't change without - * breaking binary compatibility, so I think this is + * constants in <sys/elf.h>. Changes to ELF must + * maintain binary compatibility, so I think this is * reasonably fair game. */ - if (s_bind < STB_NUM && s_type < STT_NUM) { + if (s_bind < STB_NUM && s_type < STT_IFUNC) { type = (1 << (s_type + 8)) | (1 << s_bind); if ((type & ~mask) != 0) continue; |