Mercurial > hg > truffle
annotate src/share/vm/utilities/elfFuncDescTable.hpp @ 17977:0b9500028980
8029381: assert(is_method_type()) failed: bad cast
Summary: Access to method_type and appendix from constant pool (cpcache) needs to be guarded by is_f1_null() because of racy update/initialization.
Reviewed-by: kvn, coleenp, jrose
author | drchase |
---|---|
date | Mon, 02 Jun 2014 14:32:29 -0400 |
parents | e7cbc95179c4 |
children |
rev | line source |
---|---|
14441
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
1 /* |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
3 * Copyright 2012, 2013 SAP AG. All rights reserved. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
5 * |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
6 * This code is free software; you can redistribute it and/or modify it |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
7 * under the terms of the GNU General Public License version 2 only, as |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
8 * published by the Free Software Foundation. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
9 * |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
10 * This code is distributed in the hope that it will be useful, but WITHOUT |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
13 * version 2 for more details (a copy is included in the LICENSE file that |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
14 * accompanied this code). |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
15 * |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License version |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
17 * 2 along with this work; if not, write to the Free Software Foundation, |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
19 * |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
21 * or visit www.oracle.com if you need additional information or have any |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
22 * questions. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
23 * |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
24 */ |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
25 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
26 #ifndef SHARE_VM_UTILITIES_ELF_FUNC_DESC_TABLE_HPP |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
27 #define SHARE_VM_UTILITIES_ELF_FUNC_DESC_TABLE_HPP |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
28 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
29 #if !defined(_WINDOWS) && !defined(__APPLE__) |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
30 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
31 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
32 #include "memory/allocation.hpp" |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
33 #include "utilities/decoder.hpp" |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
34 #include "utilities/elfFile.hpp" |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
35 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
36 /* |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
37 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
38 On PowerPC-64 (and other architectures like for example IA64) a pointer to a |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
39 function is not just a plain code address, but instead a pointer to a so called |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
40 function descriptor (which is simply a structure containing 3 pointers). |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
41 This fact is also reflected in the ELF ABI for PowerPC-64. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
42 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
43 On architectures like x86 or SPARC, the ELF symbol table contains the start |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
44 address and size of an object. So for example for a function object (i.e. type |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
45 'STT_FUNC') the symbol table's 'st_value' and 'st_size' fields directly |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
46 represent the starting address and size of that function. On PPC64 however, the |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
47 symbol table's 'st_value' field only contains an index into another, PPC64 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
48 specific '.opd' (official procedure descriptors) section, while the 'st_size' |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
49 field still holds the size of the corresponding function. In order to get the |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
50 actual start address of a function, it is necessary to read the corresponding |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
51 function descriptor entry in the '.opd' section at the corresponding index and |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
52 extract the start address from there. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
53 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
54 That's exactly what this 'ElfFuncDescTable' class is used for. If the HotSpot |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
55 runs on a PPC64 machine, and the corresponding ELF files contains an '.opd' |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
56 section (which is actually mandatory on PPC64) it will be read into an object |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
57 of type 'ElfFuncDescTable' just like the string and symbol table sections. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
58 Later on, during symbol lookup in 'ElfSymbolTable::lookup()' this function |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
59 descriptor table will be used if available to find the real function address. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
60 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
61 All this is how things work today (2013) on contemporary Linux distributions |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
62 (i.e. SLES 10) and new version of GCC (i.e. > 4.0). However there is a history, |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
63 and it goes like this: |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
64 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
65 In SLES 9 times (sometimes before GCC 3.4) gcc/ld on PPC64 generated two |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
66 entries in the symbol table for every function. The value of the symbol with |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
67 the name of the function was the address of the function descriptor while the |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
68 dot '.' prefixed name was reserved to hold the actual address of that function |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
69 (http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-DES). |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
70 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
71 For a C-function 'foo' this resulted in two symbol table entries like this |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
72 (extracted from the output of 'readelf -a <lib.so>'): |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
73 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
74 Section Headers: |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
75 [ 9] .text PROGBITS 0000000000000a20 00000a20 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
76 00000000000005a0 0000000000000000 AX 0 0 16 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
77 [21] .opd PROGBITS 00000000000113b8 000013b8 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
78 0000000000000138 0000000000000000 WA 0 0 8 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
79 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
80 Symbol table '.symtab' contains 86 entries: |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
81 Num: Value Size Type Bind Vis Ndx Name |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
82 76: 00000000000114c0 24 FUNC GLOBAL DEFAULT 21 foo |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
83 78: 0000000000000bb0 76 FUNC GLOBAL DEFAULT 9 .foo |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
84 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
85 You can see now that the '.foo' entry actually points into the '.text' segment |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
86 ('Ndx'=9) and its value and size fields represent the functions actual address |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
87 and size. On the other hand, the entry for plain 'foo' points into the '.opd' |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
88 section ('Ndx'=21) and its value and size fields are the index into the '.opd' |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
89 section and the size of the corresponding '.opd' section entry (3 pointers on |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
90 PPC64). |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
91 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
92 These so called 'dot symbols' were dropped around gcc 3.4 from GCC and BINUTILS, |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
93 see http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00557.html. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
94 But nevertheless it may still be necessary to support both formats because we |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
95 either run on an old system or because it is possible at any time that functions |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
96 appear in the stack trace which come from old-style libraries. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
97 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
98 Therefore we not only have to check for the presence of the function descriptor |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
99 table during symbol lookup in 'ElfSymbolTable::lookup()'. We additionally have |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
100 to check that the symbol table entry references the '.opd' section. Only in |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
101 that case we can resolve the actual function address from there. Otherwise we |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
102 use the plain 'st_value' field from the symbol table as function address. This |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
103 way we can also lookup the symbols in old-style ELF libraries (although we get |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
104 the 'dotted' versions in that case). However, if present, the 'dot' will be |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
105 conditionally removed on PPC64 from the symbol in 'ElfDecoder::demangle()' in |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
106 decoder_linux.cpp. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
107 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
108 Notice that we can not reliably get the function address from old-style |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
109 libraries because the 'st_value' field of the symbol table entries which point |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
110 into the '.opd' section denote the size of the corresponding '.opd' entry and |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
111 not that of the corresponding function. This has changed for the symbol table |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
112 entries in new-style libraries as described at the beginning of this |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
113 documentation. |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
114 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
115 */ |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
116 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
117 class ElfFuncDescTable: public CHeapObj<mtInternal> { |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
118 friend class ElfFile; |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
119 public: |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
120 ElfFuncDescTable(FILE* file, Elf_Shdr shdr, int index); |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
121 ~ElfFuncDescTable(); |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
122 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
123 // return the function address for the function descriptor at 'index' or NULL on error |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
124 address lookup(Elf_Word index); |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
125 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
126 int get_index() { return m_index; }; |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
127 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
128 NullDecoder::decoder_status get_status() { return m_status; }; |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
129 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
130 protected: |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
131 // holds the complete function descriptor section if |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
132 // we can allocate enough memory |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
133 address* m_funcDescs; |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
134 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
135 // file contains string table |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
136 FILE* m_file; |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
137 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
138 // section header |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
139 Elf_Shdr m_shdr; |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
140 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
141 // The section index of this function descriptor (i.e. '.opd') section in the ELF file |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
142 int m_index; |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
143 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
144 NullDecoder::decoder_status m_status; |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
145 }; |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
146 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
147 #endif // !_WINDOWS && !__APPLE__ |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
148 |
e7cbc95179c4
8019929: PPC64 (part 107): Extend ELF-decoder to support PPC64 function descriptor tables
simonis
parents:
diff
changeset
|
149 #endif // SHARE_VM_UTILITIES_ELF_FUNC_DESC_TABLE_HPP |