+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.
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); }
+2020-12-15 Cary Coutant <ccoutant@gmail.com>
+
+ * 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.
+
2020-12-15 Vivek Das Mohapatra <vivek@collabora.com>
Implement -z unique / -z nounique options.
if (output_file != NULL)
output_file->record_target_info(
this->name_, 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());
return obj;
}
{
Target* target = select_target(NULL, 0, // XXX
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)
{
explain_no_incremental(_("unsupported ELF machine number %d"),
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),
deferred_layout_relocs_(),
output_views_(NULL)
{
- this->e_type_ = ehdr.get_e_type();
}
template<int size, bool big_endian>
{
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());
// 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
{ return this->e_type_; }
// Return the EI_OSABI.
- const Osabi<size, big_endian>&
+ const Osabi&
osabi() const
{ return this->osabi_; }
// 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_;