8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / tools / ctf / common / symbol.c
blob29796acb2c61e58a0b0743b029ce4b72f5c0ae79
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/types.h>
30 #include <string.h>
32 #include "symbol.h"
34 int
35 ignore_symbol(GElf_Sym *sym, const char *name)
37 uchar_t type = GELF_ST_TYPE(sym->st_info);
40 * As an optimization, we do not output function or data object
41 * records for undefined or anonymous symbols.
43 if (sym->st_shndx == SHN_UNDEF || sym->st_name == 0)
44 return (1);
47 * _START_ and _END_ are added to the symbol table by the
48 * linker, and will never have associated type information.
50 if (strcmp(name, "_START_") == 0 || strcmp(name, "_END_") == 0)
51 return (1);
54 * Do not output records for absolute-valued object symbols
55 * that have value zero. The compiler insists on generating
56 * things like this for __fsr_init_value settings, etc.
58 if (type == STT_OBJECT && sym->st_shndx == SHN_ABS &&
59 sym->st_value == 0)
60 return (1);
61 return (0);