author | Hajime Tazaki <tazaki@sfc.wide.ad.jp> |
Mon, 01 Jun 2015 14:21:35 +0900 | |
changeset 664 | 213835f32c54 |
parent 540 | f2b7d02973a0 |
permissions | -rw-r--r-- |
423
6e3048fc7596
file-symbol -> lookup
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
412
diff
changeset
|
1 |
#ifndef VDL_LOOKUP_H |
6e3048fc7596
file-symbol -> lookup
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
412
diff
changeset
|
2 |
#define VDL_LOOKUP_H |
226
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
|
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
#include <elf.h> |
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
#include <link.h> |
426
69e9e6e032a1
store result status in result datatstructure
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
423
diff
changeset
|
6 |
#include <stdbool.h> |
226
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
|
540
f2b7d02973a0
split some more
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
529
diff
changeset
|
8 |
struct VdlContext; |
f2b7d02973a0
split some more
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
529
diff
changeset
|
9 |
struct VdlFile; |
f2b7d02973a0
split some more
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
529
diff
changeset
|
10 |
struct VdlList; |
f2b7d02973a0
split some more
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
529
diff
changeset
|
11 |
|
423
6e3048fc7596
file-symbol -> lookup
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
412
diff
changeset
|
12 |
struct VdlLookupResult |
226
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
{ |
426
69e9e6e032a1
store result status in result datatstructure
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
423
diff
changeset
|
14 |
bool found; |
226
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
const struct VdlFile *file; |
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
const ElfW(Sym) *symbol; |
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
}; |
423
6e3048fc7596
file-symbol -> lookup
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
412
diff
changeset
|
18 |
enum VdlLookupFlag { |
226
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
// indicates whether the symbol lookup is allowed to |
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
// find a matching symbol in the main binary. This is |
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
// typically used to perform the lookup associated |
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
// with a R_*_COPY relocation. |
476
0a304a4b0c5e
do proper shutdown
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
427
diff
changeset
|
23 |
VDL_LOOKUP_NO_EXEC = 1, |
0a304a4b0c5e
do proper shutdown
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
427
diff
changeset
|
24 |
// indicates that no symbol remap should be performed |
0a304a4b0c5e
do proper shutdown
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
427
diff
changeset
|
25 |
// This can be used to get the original symbol back. |
0a304a4b0c5e
do proper shutdown
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
427
diff
changeset
|
26 |
VDL_LOOKUP_NO_REMAP = 2 |
226
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
}; |
427
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
28 |
struct VdlLookupResult vdl_lookup (struct VdlFile *from_file, |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
29 |
const char *name, |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
30 |
const char *ver_name, |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
31 |
const char *ver_filename, |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
32 |
enum VdlLookupFlag flags); |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
33 |
struct VdlLookupResult vdl_lookup_local (const struct VdlFile *file, |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
34 |
const char *name); |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
35 |
struct VdlLookupResult vdl_lookup_with_scope (const struct VdlContext *from_context, |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
36 |
const char *name, |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
37 |
const char *ver_name, |
28f342d4868f
do not use int to return status information
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
426
diff
changeset
|
38 |
const char *ver_filename, |
476
0a304a4b0c5e
do proper shutdown
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
427
diff
changeset
|
39 |
enum VdlLookupFlag flags, |
529
cccc081ed03d
get rid of VdlFileList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
476
diff
changeset
|
40 |
struct VdlList *scope); |
226
6419fa323734
fix the gnu hashtable implementation, make it the default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
|
423
6e3048fc7596
file-symbol -> lookup
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
412
diff
changeset
|
42 |
#endif /* VDL_LOOKUP_H */ |