xref: /illumos-gate/usr/src/lib/libdwarf/common/pro_incl.h (revision ed093b41a93e8563e6e1e5dae0768dda2a7bcc27)
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-2012 David Anderson. All rights reserved.
6   Portions Copyright 2010-2012 SN Systems Ltd. All rights reserved.
7 
8   This program is free software; you can redistribute it and/or modify it
9   under the terms of version 2.1 of the GNU Lesser General Public License
10   as published by the Free Software Foundation.
11 
12   This program is distributed in the hope that it would be useful, but
13   WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 
16   Further, this software is distributed without any warranty that it is
17   free of the rightful claim of any third person regarding infringement
18   or the like.  Any license provided herein, whether implied or
19   otherwise, applies only to this software file.  Patent licenses, if
20   any, provided herein do not apply to combinations of this program with
21   other software, or any other product whatsoever.
22 
23   You should have received a copy of the GNU Lesser General Public
24   License along with this program; if not, write the Free Software
25   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
26   USA.
27 
28 */
29 
30 /* Windows specific header files */
31 #if defined(_WIN32) && defined(HAVE_STDAFX_H)
32 #include "stdafx.h"
33 #endif /* HAVE_STDAFX_H */
34 
35 #ifdef DWARF_WITH_LIBELF
36 #ifdef HAVE_ELF_H /* does includes of elf.h libelf.h here. */
37 #include <elf.h>
38 #elif defined(HAVE_LIBELF_H)
39 /* On one platform without elf.h this gets Elf32_Rel
40    type defined (a required type). */
41 #include <libelf.h>
42 /* Consider the other known directory too */
43 #elif defined(HAVE_LIBELF_LIBELF_H)
44 #include <libelf/libelf.h>
45 #endif /* HAVE_ELF_H or HAVE_LIBELF*H */
46 #endif /* DWARF_WITH_LIBELF */
47 
48 #if defined(sun)
49 #include <sys/elf_SPARC.h>
50 #include <sys/elf_386.h>
51 #endif
52 
53 /* The target address is given: the place in the source integer
54    is to be determined.
55 */
56 #ifdef WORDS_BIGENDIAN
57 #define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \
58     { \
59         dbg->de_copy_word(dest,                     \
60             ((const char *)source) +(srclength)-(len_out),\
61             (len_out)) ;                            \
62     }
63 #else /* LITTLE ENDIAN */
64 #define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \
65     { \
66         dbg->de_copy_word( (dest) , \
67             ((const char *)source) ,      \
68             (len_out)) ;            \
69     }
70 #endif /* BIG- LITTLE-ENDIAN */
71 
72 
73 #if defined(sparc) && defined(sun)
74 #define REL32 Elf32_Rela
75 #define REL64 Elf64_Rela
76 #define REL_SEC_PREFIX ".rela"
77 #else
78 #define REL32 Elf32_Rel
79 #define REL64 Elf64_Rel
80 #define REL_SEC_PREFIX ".rel"
81 #endif
82