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