summaryrefslogtreecommitdiff
path: root/elfcpp
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2020-12-15 14:37:22 -0800
committerCary Coutant <ccoutant@gmail.com>2020-12-15 14:37:22 -0800
commit2b2d74f4a135e69fa2e0b68dd273212a4db88f81 (patch)
tree7b43bfe833c9b37411c723ee671d7d910a8e6a65 /elfcpp
parent8947abe6bfbf2615e1f4ea2420b3aad5cbac4d90 (diff)
downloadbinutils-gdb-2b2d74f4a135e69fa2e0b68dd273212a4db88f81.tar.gz
Cosmetic improvements for OSABI access.
Add accessor methods to elfcpp::Ehdr class for EI_OSABI and EI_ABIVERSION; use those to simplify initialization of Osabi class and eliminate the need to template the class. elfcpp/ * elfcpp.h (class Ehdr): Add get_ei_osabi and get_ei_abiversion methods. gold/ * dwp.cc (class Dwo_file): Use new Ehdr::get_ei_osabi and get_ei_abiversion methods. * incremental.cc (make_sized_incremental_binary): Likewise. * object.cc (Sized_relobj_file::Sized_relobj_file): Likewise. (make_elf_sized_object): Likewise. * object.h (class Osabi): Make the class untemplated.
Diffstat (limited to 'elfcpp')
-rw-r--r--elfcpp/ChangeLog4
-rw-r--r--elfcpp/elfcpp.h8
2 files changed, 12 insertions, 0 deletions
diff --git a/elfcpp/ChangeLog b/elfcpp/ChangeLog
index 73432dad9b2..0ae886e1780 100644
--- a/elfcpp/ChangeLog
+++ b/elfcpp/ChangeLog
@@ -1,3 +1,7 @@
+2020-12-15 Cary Coutant <ccoutant@gmail.com>
+
+ * elfcpp.h (class Ehdr): Add get_ei_osabi and get_ei_abiversion methods.
+
2020-12-15 Vivek Das Mohapatra <vivek@collabora.com>
* elfcpp.h (enum DT): New enum member DT_GNU_FLAGS_1.
diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h
index ee69d322e79..428ecb89350 100644
--- a/elfcpp/elfcpp.h
+++ b/elfcpp/elfcpp.h
@@ -1100,6 +1100,14 @@ class Ehdr
get_e_ident() const
{ return this->p_->e_ident; }
+ unsigned char
+ get_ei_osabi() const
+ { return this->p_->e_ident[EI_OSABI]; }
+
+ unsigned char
+ get_ei_abiversion() const
+ { return this->p_->e_ident[EI_ABIVERSION]; }
+
Elf_Half
get_e_type() const
{ return Convert<16, big_endian>::convert_host(this->p_->e_type); }