diff options
author | Cary Coutant <ccoutant@gmail.com> | 2020-12-15 14:37:22 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2020-12-15 14:37:22 -0800 |
commit | 2b2d74f4a135e69fa2e0b68dd273212a4db88f81 (patch) | |
tree | 7b43bfe833c9b37411c723ee671d7d910a8e6a65 /gold/object.h | |
parent | 8947abe6bfbf2615e1f4ea2420b3aad5cbac4d90 (diff) | |
download | binutils-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 'gold/object.h')
-rw-r--r-- | gold/object.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/gold/object.h b/gold/object.h index 4afee993e85..1ab98ced464 100644 --- a/gold/object.h +++ b/gold/object.h @@ -386,13 +386,11 @@ build_compressed_section_map(const unsigned char* pshdrs, unsigned int shnum, // Osabi represents the EI_OSABI field from the ELF header. -template <int size, bool big_endian> class Osabi { public: - Osabi(const elfcpp::Ehdr<size, big_endian>& ehdr) - : ei_osabi_(static_cast<elfcpp::ELFOSABI>( - ehdr.get_e_ident()[elfcpp::EI_OSABI])) + Osabi(unsigned char ei_osabi) + : ei_osabi_(static_cast<elfcpp::ELFOSABI>(ei_osabi)) { } bool @@ -2249,7 +2247,7 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian> { return this->e_type_; } // Return the EI_OSABI. - const Osabi<size, big_endian>& + const Osabi& osabi() const { return this->osabi_; } @@ -2894,7 +2892,7 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian> // General access to the ELF file. elfcpp::Elf_file<size, big_endian, Object> elf_file_; // The EI_OSABI. - const Osabi<size, big_endian> osabi_; + const Osabi osabi_; // Type of ELF file (ET_REL or ET_EXEC). ET_EXEC files are allowed // as input files only for the --just-symbols option. int e_type_; |