extern crate alloc;
pub enum SpecialName {
Fixed(&'static str),
RelPrefix, RelaPrefix, }
impl SpecialName {
pub fn generate(&self, target: &str) -> alloc::string::String {
match self {
SpecialName::Fixed(s) => (*s).into(),
SpecialName::RelPrefix => [".rel", target].concat().into(),
SpecialName::RelaPrefix => [".rela", target].concat().into(),
}
}
}
pub struct Special {
pub name: SpecialName,
pub types: &'static [super::Type],
pub flags: &'static [super::Flag],
}
#[rustfmt::skip]
pub const SPECIALS: &'static [Special] = &[
Special { name: SpecialName::Fixed(".bss"), types : &[super::Type::Nobits], flags : &[super::Flag::Alloc, super::Flag::Write]},
Special { name: SpecialName::Fixed(".comment"), types : &[super::Type::Progbits], flags : &[] },
Special { name: SpecialName::Fixed(".data"), types : &[super::Type::Progbits], flags : &[super::Flag::Alloc, super::Flag::Write] },
Special { name: SpecialName::Fixed(".data1"), types : &[super::Type::Progbits], flags : &[super::Flag::Alloc, super::Flag::Write] },
Special { name: SpecialName::Fixed(".debug"), types : &[super::Type::Progbits], flags : &[] },
Special { name: SpecialName::Fixed(".dynamic"), types : &[super::Type::Dynamic], flags : &[] }, Special { name: SpecialName::Fixed(".dynstr"), types : &[super::Type::Strtab], flags : &[super::Flag::Alloc] },
Special { name: SpecialName::Fixed(".dynsym"), types : &[super::Type::Dynsym], flags : &[super::Flag::Alloc] },
Special { name: SpecialName::Fixed(".fini"), types : &[super::Type::Progbits], flags : &[super::Flag::Alloc, super::Flag::Execinstr] },
Special { name: SpecialName::Fixed(".fini_array"), types : &[super::Type::FiniArray], flags : &[super::Flag::Alloc, super::Flag::Write] },
Special { name: SpecialName::Fixed(".got"), types : &[super::Type::Progbits], flags : &[] }, Special { name: SpecialName::Fixed(".hash"), types : &[super::Type::Hash], flags : &[super::Flag::Alloc] },
Special { name: SpecialName::Fixed(".init"), types : &[super::Type::Progbits], flags : &[super::Flag::Alloc, super::Flag::Execinstr] },
Special { name: SpecialName::Fixed(".init_array"), types : &[super::Type::InitArray], flags : &[super::Flag::Alloc, super::Flag::Write] },
Special { name: SpecialName::Fixed(".interp"), types : &[super::Type::Progbits], flags : &[] }, Special { name: SpecialName::Fixed(".line"), types : &[super::Type::Progbits], flags : &[] },
Special { name: SpecialName::Fixed(".note"), types : &[super::Type::Note], flags : &[] },
Special { name: SpecialName::Fixed(".plt"), types : &[super::Type::Progbits], flags : &[] }, Special { name: SpecialName::Fixed(".preinit_array"), types : &[super::Type::PreinitArray], flags : &[super::Flag::Alloc, super::Flag::Write] },
Special { name: SpecialName::RelPrefix, types : &[super::Type::Rel], flags : &[] }, Special { name: SpecialName::RelaPrefix, types : &[super::Type::Rela], flags : &[] }, Special { name: SpecialName::Fixed(".relr.dyn"), types : &[super::Type::Relr], flags : &[super::Flag::Alloc] },
Special { name: SpecialName::Fixed(".rodata"), types : &[super::Type::Progbits], flags : &[super::Flag::Alloc] },
Special { name: SpecialName::Fixed(".rodata1"), types : &[super::Type::Progbits], flags : &[super::Flag::Alloc] },
Special { name: SpecialName::Fixed(".shstrtab"), types : &[super::Type::Strtab], flags : &[] },
Special { name: SpecialName::Fixed(".strtab"), types : &[super::Type::Strtab], flags : &[] }, Special { name: SpecialName::Fixed(".symtab"), types : &[super::Type::Symtab], flags : &[] }, Special { name: SpecialName::Fixed(".symtab_shndx"), types : &[super::Type::SymtabShndx], flags : &[] }, Special { name: SpecialName::Fixed(".tbss"), types : &[super::Type::Nobits], flags : &[super::Flag::Alloc, super::Flag::Write, super::Flag::Tls] },
Special { name: SpecialName::Fixed(".tdata"), types : &[super::Type::Progbits], flags : &[super::Flag::Alloc, super::Flag::Write, super::Flag::Tls] },
Special { name: SpecialName::Fixed(".tdata1"), types : &[super::Type::Progbits], flags : &[super::Flag::Alloc, super::Flag::Write, super::Flag::Tls] },
Special { name: SpecialName::Fixed(".text"), types : &[super::Type::Progbits], flags : &[super::Flag::Alloc, super::Flag::Execinstr] },
];