aboutsummaryrefslogtreecommitdiff
path: root/elfcpp
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2006-08-18 22:29:20 +0000
committerIan Lance Taylor <iant@google.com>2006-08-18 22:29:20 +0000
commit14bfc3f55540e60253cc4aae73261325309f750a (patch)
treecb74fe438b44c7aa6e02f05e14f13ba1ae0b508a /elfcpp
parent476308bf9bd077b87791da50a13a74b2698c01c7 (diff)
downloadgdb-14bfc3f55540e60253cc4aae73261325309f750a.zip
gdb-14bfc3f55540e60253cc4aae73261325309f750a.tar.gz
gdb-14bfc3f55540e60253cc4aae73261325309f750a.tar.bz2
Another snapshot of the current state of the sources. Gets to the
point of symbol resolution and can now issue a multiple definition error. Also added target selection infrastructure.
Diffstat (limited to 'elfcpp')
-rw-r--r--elfcpp/elfcpp.h49
1 files changed, 48 insertions, 1 deletions
diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h
index 14027fa..9af0b8d 100644
--- a/elfcpp/elfcpp.h
+++ b/elfcpp/elfcpp.h
@@ -396,6 +396,25 @@ enum STT
STT_HIPROC = 15
};
+inline STB
+elf_st_bind(unsigned char info)
+{
+ return static_cast<STB>(info >> 4);
+}
+
+inline STT
+elf_st_type(unsigned char info)
+{
+ return static_cast<STT>(info & 0xf);
+}
+
+inline unsigned char
+elf_st_info(STB bind, STT type)
+{
+ return ((static_cast<unsigned char>(bind) << 4)
+ + (static_cast<unsigned char>(type) & 0xf));
+}
+
// Symbol visibility from Sym st_other field.
enum STV
@@ -406,6 +425,18 @@ enum STV
STV_PROTECTED = 3
};
+inline STV
+elf_st_visibility(unsigned char other)
+{
+ return static_cast<STV>(other & 0x3);
+}
+
+inline unsigned char
+elf_st_nonvis(unsigned char other)
+{
+ return static_cast<STV>(other >> 2);
+}
+
} // End namespace elfcpp.
// Include internal details after defining the types.
@@ -576,16 +607,32 @@ class Sym
typename Elf_types<size>::Elf_WXword
get_st_size() const
- { return internal::convert_wxword<big_endian>(this->p_->st_size); }
+ { return internal::convert_wxword<size, big_endian>(this->p_->st_size); }
unsigned char
get_st_info() const
{ return this->p_->st_info; }
+ STB
+ get_st_bind() const
+ { return elf_st_bind(this->get_st_info()); }
+
+ STT
+ get_st_type() const
+ { return elf_st_type(this->get_st_info()); }
+
unsigned char
get_st_other() const
{ return this->p_->st_other; }
+ STV
+ get_st_visibility() const
+ { return elf_st_visibility(this->get_st_other()); }
+
+ unsigned char
+ get_st_nonvis() const
+ { return elf_st_nonvis(this->get_st_other()); }
+
Elf_Half
get_st_shndx() const
{ return internal::convert_half<big_endian>(this->p_->st_shndx); }