Remove the elf_symbol::get_value property
authorDodji Seketeli <dodji@redhat.com>
Thu, 19 Sep 2019 15:36:45 +0000 (17:36 +0200)
committerDodji Seketeli <dodji@redhat.com>
Fri, 20 Sep 2019 12:40:54 +0000 (14:40 +0200)
Now that there are proper facilities to lookup ELF symbols inside the
ELF/DWARF reader and get a native GElf_Sym type instance (from
libelf), we don't need to carry the value of the symbol (that is
relevant only that low level anyway) in the abigail::ir::elf_symbol
type.

This patch removes that property.

* include/abg-ir.h (elf_symbol::{elf_symbol, create}): Remove the
'val' parameter.
* src/abg-dwarf-reader.cc (elf_symbol::get_value): Remove this
member function declaration.
(lookup_symbol_from_sysv_hash_tab)
(lookup_symbol_from_gnu_hash_tab, lookup_symbol_from_symtab)
(create_default_var_sym, create_default_fn_sym)
(read_context::lookup_elf_symbol_from_index): Adjust calls to
creating elf_symbol instances.
* src/abg-ir.cc (elf_symbol::priv::value_): Remove this data
member.
(elf_symbol::{priv::priv, elf_symbol, create): Adjust.
* src/abg-reader.cc (build_elf_symbol): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-ir.h
src/abg-dwarf-reader.cc
src/abg-ir.cc
src/abg-reader.cc

index d4150e0008018d5af24ab8caff3883a4632e229e..0d344f79b100ea5f00dbe1ed4f7eeb1ec5654396 100644 (file)
@@ -818,7 +818,6 @@ private:
   elf_symbol(const environment* e,
             size_t             i,
             size_t             s,
-            uint64_t           val,
             const string&      n,
             type               t,
             binding            b,
@@ -842,7 +841,6 @@ public:
   create(const environment*    e,
         size_t         i,
         size_t         s,
-        uint64_t               val,
         const string&          n,
         type                   t,
         binding                b,
@@ -864,9 +862,6 @@ public:
   void
   set_index(size_t);
 
-  uint64_t
-  get_value() const;
-
   bool
   get_is_linux_string_cst() const;
 
index ee5d859ce7a9c6304a8093c9a23b48c38cc9ab7f..dbac01b65f20c061e9d303ba7ea8aad06d173011 100644 (file)
@@ -1770,7 +1770,6 @@ lookup_symbol_from_sysv_hash_tab(const environment*               env,
   GElf_Sym symbol;
   const char* sym_name_str;
   size_t sym_size;
-  uint64_t sym_value;
   elf_symbol::type sym_type;
   elf_symbol::binding sym_binding;
   elf_symbol::visibility sym_visibility;
@@ -1794,7 +1793,6 @@ lookup_symbol_from_sysv_hash_tab(const environment*               env,
          sym_visibility =
            stv_to_elf_symbol_visibility(GELF_ST_VISIBILITY(symbol.st_other));
          sym_size = symbol.st_size;
-         sym_value = symbol.st_value;
          elf_symbol::version ver;
          if (get_version_for_symbol(elf_handle, symbol_index,
                                     /*get_def_version=*/true, ver))
@@ -1803,7 +1801,6 @@ lookup_symbol_from_sysv_hash_tab(const environment*               env,
            elf_symbol::create(env,
                               symbol_index,
                               sym_size,
-                              sym_value,
                               sym_name_str,
                               sym_type,
                               sym_binding,
@@ -2088,7 +2085,6 @@ lookup_symbol_from_gnu_hash_tab(const environment*                env,
          elf_symbol_sptr symbol_found =
            elf_symbol::create(env, i,
                               symbol.st_size,
-                              symbol.st_value,
                               sym_name_str,
                               sym_type, sym_binding,
                               symbol.st_shndx != SHN_UNDEF,
@@ -2247,7 +2243,6 @@ lookup_symbol_from_symtab(const environment*              env,
            ABG_ASSERT(!ver.str().empty());
          elf_symbol_sptr symbol_found =
            elf_symbol::create(env, i, sym->st_size,
-                              sym->st_value,
                               name_str, sym_type,
                               sym_binding, sym_is_defined,
                               sym_is_common, ver, sym_visibility,
@@ -6487,8 +6482,7 @@ public:
 
     elf_symbol_sptr sym =
       elf_symbol::create(env(), symbol_index, native_sym.st_size,
-                        native_sym.st_value, name_str,
-                        stt_to_elf_symbol_type
+                        name_str, stt_to_elf_symbol_type
                         (GELF_ST_TYPE(native_sym.st_info)),
                         stb_to_elf_symbol_binding
                         (GELF_ST_BIND(native_sym.st_info)),
@@ -16263,7 +16257,6 @@ create_default_var_sym(const string& sym_name, const environment *env)
     elf_symbol::create(env,
                       /*symbol index=*/ 0,
                       /*symbol size=*/ 0,
-                      /*symbol value=*/ 0,
                       sym_name,
                       /*symbol type=*/ elf_symbol::OBJECT_TYPE,
                       /*symbol binding=*/ elf_symbol::GLOBAL_BINDING,
@@ -16704,7 +16697,6 @@ create_default_fn_sym(const string& sym_name, const environment *env)
     elf_symbol::create(env,
                       /*symbol index=*/ 0,
                       /*symbol size=*/ 0,
-                      /*symbol value=*/ 0,
                       sym_name,
                       /*symbol type=*/ elf_symbol::FUNC_TYPE,
                       /*symbol binding=*/ elf_symbol::GLOBAL_BINDING,
index 35abeec5c032f3e8ad4366bf371ec5d83240b7c4..87b20e48665c98c8bceed14c06af236afc65c56d 100644 (file)
@@ -1169,7 +1169,6 @@ struct elf_symbol::priv
   const environment*   env_;
   size_t               index_;
   size_t               size_;
-  uint64_t             value_;
   string               name_;
   elf_symbol::type     type_;
   elf_symbol::binding  binding_;
@@ -1215,7 +1214,6 @@ struct elf_symbol::priv
     : env_(),
       index_(),
       size_(),
-      value_(),
       type_(elf_symbol::NOTYPE_TYPE),
       binding_(elf_symbol::GLOBAL_BINDING),
       visibility_(elf_symbol::DEFAULT_VISIBILITY),
@@ -1227,7 +1225,6 @@ struct elf_symbol::priv
   priv(const environment*              e,
        size_t                          i,
        size_t                          s,
-       uint64_t                        val,
        const string&                   n,
        elf_symbol::type                t,
        elf_symbol::binding             b,
@@ -1239,7 +1236,6 @@ struct elf_symbol::priv
     : env_(e),
       index_(i),
       size_(s),
-      value_(val),
       name_(n),
       type_(t),
       binding_(b),
@@ -1277,8 +1273,6 @@ elf_symbol::elf_symbol()
 ///
 /// @param s the size of the symbol.
 ///
-/// @param val the value of the symbol.
-///
 /// @param n the name of the symbol.
 ///
 /// @param t the type of the symbol.
@@ -1298,7 +1292,6 @@ elf_symbol::elf_symbol()
 elf_symbol::elf_symbol(const environment*      e,
                       size_t                   i,
                       size_t                   s,
-                      uint64_t         val,
                       const string&            n,
                       type                     t,
                       binding                  b,
@@ -1307,7 +1300,7 @@ elf_symbol::elf_symbol(const environment* e,
                       const version&           ve,
                       visibility               vi,
                       bool                     is_linux_string_cst)
-  : priv_(new priv(e, i, s, val, n, t, b, d,
+  : priv_(new priv(e, i, s, n, t, b, d,
                   c, ve, vi, is_linux_string_cst))
 {}
 
@@ -1335,8 +1328,6 @@ elf_symbol::create()
 ///
 /// @param s the size of the symbol.
 ///
-/// @param val the value of the symbol.
-///
 /// @param n the name of the symbol.
 ///
 /// @param t the type of the symbol.
@@ -1360,7 +1351,6 @@ elf_symbol_sptr
 elf_symbol::create(const environment*  e,
                   size_t               i,
                   size_t               s,
-                  uint64_t             val,
                   const string&        n,
                   type         t,
                   binding              b,
@@ -1370,8 +1360,7 @@ elf_symbol::create(const environment*     e,
                   visibility           vi,
                   bool         is_linux_string_cst)
 {
-  elf_symbol_sptr sym(new elf_symbol(e, i, s, val,
-                                    n, t, b, d, c, ve,
+  elf_symbol_sptr sym(new elf_symbol(e, i, s, n, t, b, d, c, ve,
                                     vi, is_linux_string_cst));
   sym->priv_->main_symbol_ = sym;
   return sym;
@@ -1436,13 +1425,6 @@ void
 elf_symbol::set_index(size_t s)
 {priv_->index_ = s;}
 
-/// Getter for the symbol value.
-///
-/// @return the value of the symbol.
-uint64_t
-elf_symbol::get_value() const
-{return priv_->value_;}
-
 /// Test if the ELF symbol is for a string constant of a Linux binary
 /// defined in the __ksymtab_strings symbol table.
 ///
index d08b8008acb7d0237d4e810cc7afa390852a16c9..2ff6dfce45fefcd4c29146abb108c89612a474c7 100644 (file)
@@ -2659,8 +2659,7 @@ build_elf_symbol(read_context& ctxt, const xmlNodePtr node)
 
   const environment* env = ctxt.get_environment();
   elf_symbol_sptr e = elf_symbol::create(env, /*index=*/0,
-                                        size, /*value=*/0,
-                                        name, type, binding,
+                                        size, name, type, binding,
                                         is_defined, is_common,
                                         version, visibility,
                                         /*is_linux_string_cst=*/false);