forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -464,7 +464,8 @@ Sized_relobj_file<size, big_endian>::Sized_relobj_file(
|
||||
const elfcpp::Ehdr<size, big_endian>& ehdr)
|
||||
: Sized_relobj<size, big_endian>(name, input_file, offset),
|
||||
elf_file_(this, ehdr),
|
||||
osabi_(ehdr),
|
||||
osabi_(ehdr.get_ei_osabi()),
|
||||
e_type_(ehdr.get_e_type()),
|
||||
symtab_shndx_(-1U),
|
||||
local_symbol_count_(0),
|
||||
output_local_symbol_count_(0),
|
||||
@@ -482,7 +483,6 @@ Sized_relobj_file<size, big_endian>::Sized_relobj_file(
|
||||
deferred_layout_relocs_(),
|
||||
output_views_(NULL)
|
||||
{
|
||||
this->e_type_ = ehdr.get_e_type();
|
||||
}
|
||||
|
||||
template<int size, bool big_endian>
|
||||
@@ -3387,8 +3387,8 @@ make_elf_sized_object(const std::string& name, Input_file* input_file,
|
||||
{
|
||||
Target* target = select_target(input_file, offset,
|
||||
ehdr.get_e_machine(), size, big_endian,
|
||||
ehdr.get_e_ident()[elfcpp::EI_OSABI],
|
||||
ehdr.get_e_ident()[elfcpp::EI_ABIVERSION]);
|
||||
ehdr.get_ei_osabi(),
|
||||
ehdr.get_ei_abiversion());
|
||||
if (target == NULL)
|
||||
gold_fatal(_("%s: unsupported ELF machine number %d"),
|
||||
name.c_str(), ehdr.get_e_machine());
|
||||
|
||||
Reference in New Issue
Block a user