1178481Sjb/*
2178481Sjb * CDDL HEADER START
3178481Sjb *
4178481Sjb * The contents of this file are subject to the terms of the
5178481Sjb * Common Development and Distribution License, Version 1.0 only
6178481Sjb * (the "License").  You may not use this file except in compliance
7178481Sjb * with the License.
8178481Sjb *
9178481Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10178481Sjb * or http://www.opensolaris.org/os/licensing.
11178481Sjb * See the License for the specific language governing permissions
12178481Sjb * and limitations under the License.
13178481Sjb *
14178481Sjb * When distributing Covered Code, include this CDDL HEADER in each
15178481Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16178481Sjb * If applicable, add the following below this CDDL HEADER, with the
17178481Sjb * fields enclosed by brackets "[]" replaced with your own identifying
18178481Sjb * information: Portions Copyright [yyyy] [name of copyright owner]
19178481Sjb *
20178481Sjb * CDDL HEADER END
21178481Sjb */
22178481Sjb/*
23178481Sjb * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24178481Sjb * Use is subject to license terms.
25178481Sjb */
26178481Sjb
27178481Sjb#pragma ident	"%Z%%M%	%I%	%E% SMI"
28178481Sjb
29178481Sjb#include <sys/types.h>
30178481Sjb#include <string.h>
31178481Sjb
32178481Sjb#include "symbol.h"
33178481Sjb
34178481Sjbint
35178481Sjbignore_symbol(GElf_Sym *sym, const char *name)
36178481Sjb{
37178481Sjb	uchar_t type = GELF_ST_TYPE(sym->st_info);
38178481Sjb
39178481Sjb	/*
40178481Sjb	 * As an optimization, we do not output function or data object
41178481Sjb	 * records for undefined or anonymous symbols.
42178481Sjb	 */
43178481Sjb	if (sym->st_shndx == SHN_UNDEF || sym->st_name == 0)
44178481Sjb		return (1);
45178481Sjb
46178481Sjb	/*
47178481Sjb	 * _START_ and _END_ are added to the symbol table by the
48178481Sjb	 * linker, and will never have associated type information.
49178481Sjb	 */
50178481Sjb	if (strcmp(name, "_START_") == 0 || strcmp(name, "_END_") == 0)
51178481Sjb		return (1);
52178481Sjb
53178481Sjb	/*
54178481Sjb	 * Do not output records for absolute-valued object symbols
55178481Sjb	 * that have value zero.  The compiler insists on generating
56178481Sjb	 * things like this for __fsr_init_value settings, etc.
57178481Sjb	 */
58178481Sjb	if (type == STT_OBJECT && sym->st_shndx == SHN_ABS &&
59178481Sjb	    sym->st_value == 0)
60178481Sjb		return (1);
61178481Sjb	return (0);
62178481Sjb}
63