[163] | 1 | /* |
---|
| 2 | This file is part of Libelfpp. |
---|
| 3 | |
---|
| 4 | Libelfpp is free software: you can redistribute it and/or modify |
---|
| 5 | it under the terms of the GNU Lesser General Public License as |
---|
| 6 | published by the Free Software Foundation, either version 3 of the |
---|
| 7 | License, or (at your option) any later version. |
---|
| 8 | |
---|
| 9 | Libelfpp is distributed in the hope that it will be useful, but |
---|
| 10 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 12 | General Public License for more details. |
---|
| 13 | |
---|
| 14 | You should have received a copy of the GNU Lesser General Public |
---|
| 15 | License along with Libelfpp. If not, see |
---|
| 16 | <http://www.gnu.org/licenses/>. |
---|
| 17 | |
---|
| 18 | Copyright (c) Alexandre Becoulet <alexandre.becoulet@free.fr> |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | #ifndef ELFPP_SYMBOL_HXX_ |
---|
| 22 | #define ELFPP_SYMBOL_HXX_ |
---|
| 23 | |
---|
| 24 | namespace elfpp |
---|
| 25 | { |
---|
| 26 | |
---|
| 27 | const std::string & symbol::get_name() const |
---|
| 28 | { |
---|
| 29 | return name_; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | section * symbol::get_section() const |
---|
| 33 | { |
---|
| 34 | return section_; |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | void symbol::set_section_ndx(unsigned int ndx) |
---|
| 38 | { |
---|
| 39 | sec_ndx_ = ndx; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | unsigned int symbol::get_section_ndx() const |
---|
| 43 | { |
---|
| 44 | return sec_ndx_; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | uint8_t symbol::get_info() const |
---|
| 48 | { |
---|
| 49 | return info_; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | void symbol::set_info(uint8_t info) |
---|
| 53 | { |
---|
| 54 | info_ = info; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | uint8_t symbol::get_other() const |
---|
| 58 | { |
---|
| 59 | return other_; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | void symbol::set_other(uint8_t other) |
---|
| 63 | { |
---|
| 64 | other_ = other; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | uint64_t symbol::get_value() const |
---|
| 68 | { |
---|
| 69 | return value_; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | size_t symbol::get_size() const |
---|
| 73 | { |
---|
| 74 | return size_; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | uint8_t * symbol::get_content() const |
---|
| 78 | { |
---|
| 79 | return content_; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | void symbol::set_value(uint64_t val) |
---|
| 83 | { |
---|
| 84 | value_ = val; |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | void symbol::set_size(size_t size) |
---|
| 88 | { |
---|
| 89 | size_ = size; |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | const reloc_table_t & symbol::get_reloc_table() const |
---|
| 93 | { |
---|
| 94 | return reloc_tab_; |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | const reloc_modlist_t & symbol::get_mangling_relocs() const |
---|
| 98 | { |
---|
| 99 | return reloc_mod_; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | st_info_type_e symbol::get_type() const |
---|
| 103 | { |
---|
| 104 | return ELF_ST_TYPE(info_); |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | void symbol::set_type(st_info_type_e type) |
---|
| 108 | { |
---|
| 109 | info_ = ELF_ST_INFO(get_bind(), type); |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | st_info_bind_e symbol::get_bind() const |
---|
| 113 | { |
---|
| 114 | return ELF_ST_BIND(info_); |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | void symbol::set_bind(st_info_bind_e bind) |
---|
| 118 | { |
---|
| 119 | info_ = ELF_ST_INFO(bind, get_type()); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | #endif |
---|
| 125 | |
---|