I am writing a backend for my own architecture. Its object file format is XCOFF.
Unlike ELF, XCOFF is only supported to a limited amount of targets in the current code base. I don’t know how to add my own target to the function XCOFFObjectFile::getFileFormatName()
, and XCOFFObjectFile::getArch()
. They only use the is64Bit()
predicate to differentiate only two targets.
StringRef XCOFFObjectFile::getFileFormatName() const {
return is64Bit() ? "aix5coff64-rs6000" : "aixcoff-rs6000";
}
Triple::ArchType XCOFFObjectFile::getArch() const {
return is64Bit() ? Triple::ppc64 : Triple::ppc;
}
As for ELF, the getFileFormatName()
and getArch()
functions have switch-case
statements to differentiate many target architectures.
Above is just an example, there are many other places where the XCOFF code looks “not that COMMONLY supported”, despite the word “common” in its full name.
Can anyone point me to the right direction? Any help is appreciated.