+// Osabi represents the EI_OSABI field from the ELF header.
+
+class Osabi
+{
+ public:
+ Osabi(unsigned char ei_osabi)
+ : ei_osabi_(static_cast<elfcpp::ELFOSABI>(ei_osabi))
+ { }
+
+ bool
+ has_shf_retain(elfcpp::Elf_Xword sh_flags) const
+ {
+ switch (this->ei_osabi_)
+ {
+ case elfcpp::ELFOSABI_GNU:
+ case elfcpp::ELFOSABI_FREEBSD:
+ return (sh_flags & elfcpp::SHF_GNU_RETAIN) != 0;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ elfcpp::Elf_Xword
+ ignored_sh_flags() const
+ {
+ switch (this->ei_osabi_)
+ {
+ case elfcpp::ELFOSABI_GNU:
+ case elfcpp::ELFOSABI_FREEBSD:
+ return elfcpp::SHF_GNU_RETAIN;
+ default:
+ break;
+ }
+ return 0;
+ }
+
+ private:
+ elfcpp::ELFOSABI ei_osabi_;
+};
+