|
1 /* |
|
2 |
|
3 Copyright (C) 2000,2002,2004 Silicon Graphics, Inc. All Rights Reserved. |
|
4 Portions Copyright 2002 Sun Microsystems, Inc. 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 Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane, |
|
27 Mountain View, CA 94043, or: |
|
28 |
|
29 http://www.sgi.com |
|
30 |
|
31 For further information regarding this notice, see: |
|
32 |
|
33 http://oss.sgi.com/projects/GenInfo/NoticeExplan |
|
34 |
|
35 */ |
|
36 |
|
37 |
|
38 #ifdef HAVE_ELF_H |
|
39 #include <elf.h> |
|
40 #elif defined(HAVE_LIBELF_H) |
|
41 /* On one platform without elf.h this gets Elf32_Rel |
|
42 type defined (a required type). */ |
|
43 #include <libelf.h> |
|
44 #endif |
|
45 |
|
46 #if defined(sun) |
|
47 #include <sys/elf_SPARC.h> |
|
48 #include <sys/elf_386.h> |
|
49 #endif |
|
50 |
|
51 /* The target address is given: the place in the source integer |
|
52 is to be determined. |
|
53 */ |
|
54 #ifdef WORDS_BIGENDIAN |
|
55 #define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \ |
|
56 { \ |
|
57 dbg->de_copy_word(dest, \ |
|
58 ((char *)source) +srclength-len_out, \ |
|
59 len_out) ; \ |
|
60 } |
|
61 |
|
62 |
|
63 #else /* LITTLE ENDIAN */ |
|
64 |
|
65 #define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \ |
|
66 { \ |
|
67 dbg->de_copy_word( (dest) , \ |
|
68 ((char *)source) , \ |
|
69 len_out) ; \ |
|
70 } |
|
71 #endif |
|
72 |
|
73 |
|
74 #if defined(sparc) && defined(sun) |
|
75 #define REL32 Elf32_Rela |
|
76 #define REL64 Elf64_Rela |
|
77 #define REL_SEC_PREFIX ".rela" |
|
78 #else |
|
79 #define REL32 Elf32_Rel |
|
80 #define REL64 Elf64_Rel |
|
81 #define REL_SEC_PREFIX ".rel" |
|
82 #endif |
|
83 |
|
84 |
|
85 #include "libdwarf.h" |
|
86 |
|
87 #include "dwarf.h" |
|
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" |