1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "elf_symbol.h" |
|
17 |
|
18 |
|
19 namespace elf |
|
20 { |
|
21 // All of the following functions are candidates for inlining ... |
|
22 |
|
23 Symbol::Symbol(const char* p) : m_data( reinterpret_cast<const Elf32_Sym*>(p) ) |
|
24 { |
|
25 } |
|
26 |
|
27 uint32_t Symbol::get_name() const |
|
28 { |
|
29 return m_data->st_name; |
|
30 } |
|
31 |
|
32 uint32_t Symbol::get_value() const |
|
33 { |
|
34 return m_data->st_value; |
|
35 } |
|
36 |
|
37 uint32_t Symbol::get_size() const |
|
38 { |
|
39 return m_data->st_size; |
|
40 } |
|
41 |
|
42 bool Symbol::is_info_bind_local() const |
|
43 { |
|
44 return (m_data->st_info >> 4) == STB_LOCAL; |
|
45 } |
|
46 |
|
47 bool Symbol::is_info_bind_global() const |
|
48 { |
|
49 return (m_data->st_info >> 4) == STB_GLOBAL; |
|
50 } |
|
51 |
|
52 bool Symbol::is_info_bind_weak() const |
|
53 { |
|
54 return (m_data->st_info >> 4) == STB_WEAK; |
|
55 } |
|
56 |
|
57 bool Symbol::is_info_type_notype() const |
|
58 { |
|
59 return (m_data->st_info & 0x0f) == STT_NOTYPE; |
|
60 } |
|
61 |
|
62 bool Symbol::is_info_type_object() const |
|
63 { |
|
64 return (m_data->st_info & 0x0f) == STT_OBJECT; |
|
65 } |
|
66 |
|
67 bool Symbol::is_info_type_func() const |
|
68 { |
|
69 return (m_data->st_info & 0x0f) == STT_FUNC; |
|
70 } |
|
71 |
|
72 bool Symbol::is_info_type_section() const |
|
73 { |
|
74 return (m_data->st_info & 0x0f) == STT_SECTION; |
|
75 } |
|
76 |
|
77 bool Symbol::is_info_type_file() const |
|
78 { |
|
79 return (m_data->st_info & 0x0f) == STT_FILE; |
|
80 } |
|
81 |
|
82 //bool Symbol::is_info_type_common() const |
|
83 //{ |
|
84 // return (m_data->st_info == STT_COMMON); |
|
85 //} |
|
86 |
|
87 //bool Symbol::is_info_type_tls() const |
|
88 //{ |
|
89 // return (m_data->st_info == STT_TLS); |
|
90 //} |
|
91 |
|
92 uint8_t Symbol::get_other() const |
|
93 { |
|
94 return m_data->st_other; |
|
95 } |
|
96 |
|
97 uint16_t Symbol::get_shndx() const |
|
98 { |
|
99 return m_data->st_shndx; |
|
100 } |
|
101 |
|
102 } // namespace elf |
|
103 |
|
104 |
|