summaryrefslogtreecommitdiff
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
commit973d1d89d15d7fd8acb8e4e6335ce1b6a6aafec3 (patch)
treeed5316d8094437d5ce77bd1137c7ddee6fd8b43c /elfcpp
parent28b82c911fc239cf57d19b1f57c7dee87cc38081 (diff)
downloadbinutils-redhat-973d1d89d15d7fd8acb8e4e6335ce1b6a6aafec3.tar.gz
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 14027fad05..9af0b8d4de 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); }