Path: blob/main/cddl/contrib/opensolaris/tools/ctf/common/symbol.c
39562 views
/*1* CDDL HEADER START2*3* The contents of this file are subject to the terms of the4* Common Development and Distribution License, Version 1.0 only5* (the "License"). You may not use this file except in compliance6* with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or http://www.opensolaris.org/os/licensing.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/21/*22* Copyright 2004 Sun Microsystems, Inc. All rights reserved.23* Use is subject to license terms.24*/2526#pragma ident "%Z%%M% %I% %E% SMI"2728#include <sys/types.h>29#include <string.h>3031#include "symbol.h"3233int34ignore_symbol(GElf_Sym *sym, const char *name)35{36uchar_t type = GELF_ST_TYPE(sym->st_info);3738/*39* As an optimization, we do not output function or data object40* records for undefined or anonymous symbols.41*/42if (sym->st_shndx == SHN_UNDEF || sym->st_name == 0)43return (1);4445/*46* _START_ and _END_ are added to the symbol table by the47* linker, and will never have associated type information.48*/49if (strcmp(name, "_START_") == 0 || strcmp(name, "_END_") == 0)50return (1);5152/*53* Do not output records for absolute-valued object symbols54* that have value zero. The compiler insists on generating55* things like this for __fsr_init_value settings, etc.56*/57if (type == STT_OBJECT && sym->st_shndx == SHN_ABS &&58sym->st_value == 0)59return (1);60return (0);61}626364