36a37
> #include "base/loader/object_file.hh"
46a48,81
> namespace
> {
>
> class SparcLinuxObjectFileLoader : public ObjectFile::Loader
> {
> public:
> Process *
> load(ProcessParams *params, ObjectFile *obj_file) override
> {
> auto arch = obj_file->getArch();
> auto opsys = obj_file->getOpSys();
>
> if (arch != ObjectFile::SPARC64 && arch != ObjectFile::SPARC32)
> return nullptr;
>
> if (opsys == ObjectFile::UnknownOpSys) {
> warn("Unknown operating system; assuming Linux.");
> opsys = ObjectFile::Linux;
> }
>
> if (opsys != ObjectFile::Linux)
> return nullptr;
>
> if (arch == ObjectFile::SPARC64)
> return new Sparc64LinuxProcess(params, obj_file);
> else
> return new Sparc32LinuxProcess(params, obj_file);
> }
> };
>
> SparcLinuxObjectFileLoader loader;
>
> } // anonymous namespace
>