xref: /illumos-gate/usr/src/lib/libdwarf/common/pro_weaks.c (revision d464f34577edaa31dd6978ec04d66a57529dd2c8)
1 /*
2 
3   Copyright (C) 2000,2004 Silicon Graphics, Inc.  All Rights Reserved.
4   Portions Copyright 2011  David Anderson. All Rights Reserved.
5 
6   This program is free software; you can redistribute it and/or modify it
7   under the terms of version 2.1 of the GNU Lesser General Public License
8   as published by the Free Software Foundation.
9 
10   This program is distributed in the hope that it would be useful, but
11   WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 
14   Further, this software is distributed without any warranty that it is
15   free of the rightful claim of any third person regarding infringement
16   or the like.  Any license provided herein, whether implied or
17   otherwise, applies only to this software file.  Patent licenses, if
18   any, provided herein do not apply to combinations of this program with
19   other software, or any other product whatsoever.
20 
21   You should have received a copy of the GNU Lesser General Public
22   License along with this program; if not, write the Free Software
23   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
24   USA.
25 
26 */
27 
28 #include "config.h"
29 #include "libdwarfdefs.h"
30 #include <stdio.h>
31 #ifdef HAVE_STRING_H
32 #include <string.h>
33 #endif /* HAVE_STRING_H */
34 #ifdef HAVE_ELFACCESS_H
35 #include <elfaccess.h>
36 #endif /*  HAVE_ELFACCESS_H */
37 #ifdef HAVE_STDDEF_H
38 #include <stddef.h>
39 #endif /* HAVE_STDDEF_H */
40 #include "dwarf.h"
41 #include "libdwarf.h"
42 #include "pro_opaque.h"
43 #include "pro_error.h"
44 
45 /*
46     This function adds another weak name to the
47     list of weak names for the given Dwarf_P_Debug.
48     It returns 0 on error, and 1 otherwise.
49 */
50 Dwarf_Unsigned
51 dwarf_add_weakname(Dwarf_P_Debug dbg,
52     Dwarf_P_Die die,
53     char *weak_name, Dwarf_Error * error)
54 {
55     int res = 0;
56 
57     res = _dwarf_add_simple_name_entry(dbg, die, weak_name,
58         dwarf_snk_weakname, error);
59     if (res != DW_DLV_OK) {
60         return 0;
61     }
62     return 1;
63 }
64 
65 int
66 dwarf_add_weakname_a(Dwarf_P_Debug dbg,
67     Dwarf_P_Die die,
68     char *weak_name, Dwarf_Error * error)
69 {
70     int res = 0;
71 
72     res = _dwarf_add_simple_name_entry(dbg, die, weak_name,
73         dwarf_snk_weakname, error);
74     return res;
75 }
76