xref: /titanic_52/usr/src/lib/libdwarf/common/pro_incl.h (revision 7fd791373689a6af05e27efec3b1ab556e02aa23)
1*7fd79137SRobert Mustacchi /*
2*7fd79137SRobert Mustacchi 
3*7fd79137SRobert Mustacchi   Copyright (C) 2000,2002,2004 Silicon Graphics, Inc.  All Rights Reserved.
4*7fd79137SRobert Mustacchi   Portions Copyright 2002-2010 Sun Microsystems, Inc. All rights reserved.
5*7fd79137SRobert Mustacchi   Portions Copyright 2008-2010 David Anderson. All rights reserved.
6*7fd79137SRobert Mustacchi 
7*7fd79137SRobert Mustacchi   This program is free software; you can redistribute it and/or modify it
8*7fd79137SRobert Mustacchi   under the terms of version 2.1 of the GNU Lesser General Public License
9*7fd79137SRobert Mustacchi   as published by the Free Software Foundation.
10*7fd79137SRobert Mustacchi 
11*7fd79137SRobert Mustacchi   This program is distributed in the hope that it would be useful, but
12*7fd79137SRobert Mustacchi   WITHOUT ANY WARRANTY; without even the implied warranty of
13*7fd79137SRobert Mustacchi   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14*7fd79137SRobert Mustacchi 
15*7fd79137SRobert Mustacchi   Further, this software is distributed without any warranty that it is
16*7fd79137SRobert Mustacchi   free of the rightful claim of any third person regarding infringement
17*7fd79137SRobert Mustacchi   or the like.  Any license provided herein, whether implied or
18*7fd79137SRobert Mustacchi   otherwise, applies only to this software file.  Patent licenses, if
19*7fd79137SRobert Mustacchi   any, provided herein do not apply to combinations of this program with
20*7fd79137SRobert Mustacchi   other software, or any other product whatsoever.
21*7fd79137SRobert Mustacchi 
22*7fd79137SRobert Mustacchi   You should have received a copy of the GNU Lesser General Public
23*7fd79137SRobert Mustacchi   License along with this program; if not, write the Free Software
24*7fd79137SRobert Mustacchi   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
25*7fd79137SRobert Mustacchi   USA.
26*7fd79137SRobert Mustacchi 
27*7fd79137SRobert Mustacchi   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
28*7fd79137SRobert Mustacchi   Mountain View, CA 94043, or:
29*7fd79137SRobert Mustacchi 
30*7fd79137SRobert Mustacchi   http://www.sgi.com
31*7fd79137SRobert Mustacchi 
32*7fd79137SRobert Mustacchi   For further information regarding this notice, see:
33*7fd79137SRobert Mustacchi 
34*7fd79137SRobert Mustacchi   http://oss.sgi.com/projects/GenInfo/NoticeExplan
35*7fd79137SRobert Mustacchi 
36*7fd79137SRobert Mustacchi */
37*7fd79137SRobert Mustacchi 
38*7fd79137SRobert Mustacchi 
39*7fd79137SRobert Mustacchi #ifdef HAVE_ELF_H
40*7fd79137SRobert Mustacchi #include <elf.h>
41*7fd79137SRobert Mustacchi #elif defined(HAVE_LIBELF_H)
42*7fd79137SRobert Mustacchi /* On one platform without elf.h this gets Elf32_Rel
43*7fd79137SRobert Mustacchi    type defined (a required type). */
44*7fd79137SRobert Mustacchi #include <libelf.h>
45*7fd79137SRobert Mustacchi #endif
46*7fd79137SRobert Mustacchi 
47*7fd79137SRobert Mustacchi #if defined(sun)
48*7fd79137SRobert Mustacchi #include <sys/elf_SPARC.h>
49*7fd79137SRobert Mustacchi #include <sys/elf_386.h>
50*7fd79137SRobert Mustacchi #endif
51*7fd79137SRobert Mustacchi 
52*7fd79137SRobert Mustacchi /* The target address is given: the place in the source integer
53*7fd79137SRobert Mustacchi    is to be determined.
54*7fd79137SRobert Mustacchi */
55*7fd79137SRobert Mustacchi #ifdef WORDS_BIGENDIAN
56*7fd79137SRobert Mustacchi #define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \
57*7fd79137SRobert Mustacchi     { \
58*7fd79137SRobert Mustacchi       dbg->de_copy_word(dest, \
59*7fd79137SRobert Mustacchi                         ((char *)source) +srclength-len_out,  \
60*7fd79137SRobert Mustacchi 			len_out) ; \
61*7fd79137SRobert Mustacchi     }
62*7fd79137SRobert Mustacchi 
63*7fd79137SRobert Mustacchi 
64*7fd79137SRobert Mustacchi #else /* LITTLE ENDIAN */
65*7fd79137SRobert Mustacchi 
66*7fd79137SRobert Mustacchi #define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \
67*7fd79137SRobert Mustacchi     { \
68*7fd79137SRobert Mustacchi       dbg->de_copy_word( (dest) , \
69*7fd79137SRobert Mustacchi                         ((char *)source) ,  \
70*7fd79137SRobert Mustacchi 			len_out) ; \
71*7fd79137SRobert Mustacchi     }
72*7fd79137SRobert Mustacchi #endif
73*7fd79137SRobert Mustacchi 
74*7fd79137SRobert Mustacchi 
75*7fd79137SRobert Mustacchi #if defined(sparc) && defined(sun)
76*7fd79137SRobert Mustacchi #define REL32 Elf32_Rela
77*7fd79137SRobert Mustacchi #define REL64 Elf64_Rela
78*7fd79137SRobert Mustacchi #define REL_SEC_PREFIX ".rela"
79*7fd79137SRobert Mustacchi #else
80*7fd79137SRobert Mustacchi #define REL32 Elf32_Rel
81*7fd79137SRobert Mustacchi #define REL64 Elf64_Rel
82*7fd79137SRobert Mustacchi #define REL_SEC_PREFIX ".rel"
83*7fd79137SRobert Mustacchi #endif
84*7fd79137SRobert Mustacchi 
85*7fd79137SRobert Mustacchi #include "dwarf.h"
86*7fd79137SRobert Mustacchi #include "libdwarf.h"
87*7fd79137SRobert Mustacchi 
88*7fd79137SRobert Mustacchi #include "pro_opaque.h"
89*7fd79137SRobert Mustacchi #include "pro_error.h"
90*7fd79137SRobert Mustacchi #include "pro_util.h"
91*7fd79137SRobert Mustacchi #include "pro_encode_nm.h"
92*7fd79137SRobert Mustacchi #include "pro_alloc.h"
93