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