40a41
> #include "base/loader/object_file.hh"
53a55,88
> namespace
> {
>
> class RiscvLinuxObjectFileLoader : 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::Riscv64 && arch != ObjectFile::Riscv32)
> return nullptr;
>
> if (opsys == ObjectFile::UnknownOpSys) {
> warn("Unknown operating system; assuming Linux.");
> opsys = ObjectFile::Linux;
> }
>
> if (opsys != ObjectFile::Linux)
> return nullptr;
>
> if (arch == ObjectFile::Riscv64)
> return new RiscvLinuxProcess64(params, obj_file);
> else
> return new RiscvLinuxProcess32(params, obj_file);
> }
> };
>
> RiscvLinuxObjectFileLoader loader;
>
> } // anonymous namespace
>